CloudWithAWS TIO 1 v1.1
CloudWithAWS TIO 1 v1.1
The goal
4. Connect to the instance via SSH (optional for non technical learners)
5. Terminate an instance
Please note if a field (short for text field/text area/checkbox/radio/dropdown/list or any other UI element) is not specified in the following steps, it means the
default value of the field set by AWS needs to be used. No change is needed for those fields as part of this hands-on.
2. Change the region to N Virginia (if it is not already selected). The region dropdown is located at the top right of the EC2 management console.
3. From the EC2 management console, click on Launch Instance (ignore the template option).
4. The Choose an Amazon Machine Image (AMI) page displays a list of basic configurations, called Amazon Machine Images (AMIs), that serve as templates
for your instance. Click on the “Select” button of the HVM version of Amazon Linux 2. This should be the very first option in the list of AMIs displayed on this
screen.
5. On the Choose an Instance Type page, select the t2.micro instance type, which is selected by default. The t2.micro instance type is eligible for the free tier.
Click on the “Next: Configure Instance Details” button on the right bottom of the page.
c) In the user data field (bottom on the page) paste the following script (installs the http server and creates a home page) -
Important note - please copy the complete script properly. A typical mistake is to not select the first and the last few characters. It is also possible the
spaces in the script can be replaced with special characters which may lead to errors. It is best the script be copied to a pure text editor (Notepad++, GEdit
etc) and then copy from the editor to the user data field.
#!/bin/bash
yum update -y
yum install httpd -y
service httpd start
chkconfig httpd on
IP_ADDR=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)
echo "Manual instance with IP $IP_ADDR" > /var/www/html/index.html
d) Click on “Next: Add Storage” button (right side bottom of the page)
7. No changes are needed on the Add Storage page. Click on the “Next: Add Tags” button on the right side bottom of the page
a) Click on the link (in the middle of the page) “click to add a Name tag”
b) Ensure the Key field has the text Name already prepopulated (do not change this)
httpserver1
d) Click on “Next: Configure Security Group” button on the right side bottom of the page
a) Ensure the radio button Create a new security group is selected (should be already by default)
b) Paste the value of the Security Group Name field from below (remove any existing value from this field)
tio1-sg
c) Paste the value of the Description field from below (remove any existing value from this field)
d) A rule for SSH is already added, change the Source dropdown to Anywhere
e) Click on the Add Rule button to add the second rule for this security group
f) Click the Type dropdown of this row (not the earlier SSH row) and select HTTP, change the Source dropdown to Anywhere
g) Click on Review and Launch button on the right side bottom of the page
10. On the Review Instance Launch page, click the Launch button on the right side bottom of the page.
b) When prompted for a key pair, select Choose “Create a new key pair” from the dropdown
c) In the Key pair name field paste the following value
pgpcc-key1
d) Clik on the Download Key Pair button just below the Key pair name field
e) Save the file that is downloaded in a secure directory on your laptop/desktop (remember this location)
11. In the Launch Status confirmation page click on the View Instances button on the right side bottom of the page
12. Click on the Checkbox to the left of the httpserver1 displayed in the Instances table
13. The bottom of the screen shows the instance attributes and the Details tab is visible by default (do not change it)
14. Locate the display item “Public IPv4 address” and copy the public IP address (do not click on the open address link, it defaults to https and the page will not
work). Save this public IP address (does not start with 172.31.x.x) in a text editor or write it down on a piece of paper if you wish to do the SSH exercise.
15. Open a new browser tab, paste the public IP address and hit enter. The http page will be visible.
This hands-on is optional for learners who are not from technical background. Proceed to the next hands-on “C” if you intend to skip it.
Important note - please copy each command properly. A typical mistake is to not select the first and the last few characters leading to errors. All commands are
case sensitive and observe the spaces carefully between the command and the respective arguments. It is best to copy/paste these commands.
1. Open a terminal window (steps to install and verify a terminal window is in Olympus) on your laptop/desktop
2. Change the directory to the location where the PEM (or CER or TXT) file was downloaded in the previous exercise
3. Copy and Paste to execute (by hitting enter) the following command in the terminal window -
4. Copy and Paste the following command in the terminal window. Delete the bold text in the command below and type the public ip instead (refer to the text
editor or piece of paper) of the instance. Execute the command by hitting enter -
5. Apart from other display, there will be a prompt which may look like this “Are you sure you want to continue connecting (yes/no/[fingerprint])?”. Type in yes
and hit enter
6. Try out the following linux commands (copy paste the commands individually and hit enter after each)
ls -al
mkdir test
ls -al
cd /opt
exit
8. An alternative to SSH is via the “EC2 Instance Connect” option. To use it go back to the browser tab EC2 management console.
10. Click on the Checkbox to the left of the httpserver1 displayed in the Instances table (no action is necessary if the checkbox is already selected)
11. Click on the Connect button towards the top right side of the screen
12. In the new page which shows a few tabs, the default tab will be EC2 Instance Connect
13. Click on the Connect button and a new browser tab (popup may need to be enabled) will show the terminal window
14. Try out the linux commands from the earlier steps (note - creating the directory will fail because it already exists)
3. Click on the Checkbox to the left of the httpserver1 displayed in the Instances table (no action is necessary if the checkbox is already selected)
4. Click on the Instance state dropdown towards the top right side of the screen
7. The instance will show in Shutting down status and a few moments later will show as Terminated
8. Terminated instances do not attract any costs and will be auto removed from the instance listing in about 2 hours (or less)