Clone CS5910 AWSEC2 Instance
Clone CS5910 AWSEC2 Instance
In this lesson, we show how to create AWS EC2 Instance using Platform as a Service from AWS.
We follow the workflow of seven-step process to configure the instance. We will create a
t2.micro (free tier) instance with default 8GB elastic storage.
We also choose VPN private LAN for its network connectivity so that it is protected by default.
We will configure its security group (firewall) with SSH, HTTP, and HTTPS services open and only
allow your local machine to access by specifying the IP address of the local machine as the only
source to connect. At the last step of the configuration, be sure to create the public/private key
pair for accessing your customized Linux machine and download the private key in .PEM file
format. Backup the private key in some safe place. Once you lost the private key you cannot
the Linux machine again.
Note that the AWS remembers which region you last access.
After choosing the region, click the ec2 service on the left. See Figure 1.
We are presented with EC2 tool windows. The right side is EC2 dashboard, where the key
resources such as current instances can be clicked and accessed. The Images section contains
public and private images for cloning the instances. The snapshots can also be accessed there.
The network & Security shows the Security Groups, Elastic IPs, KeyPairs. The middle canvas
window shows the current statistics of resources available in our account.
Click “Launch Instance” to create a new EC2 instance. See Figure 2.
Figure 5b shows that in the drop down menu for subnet, we see there are 3 different subnets,
(us-east-2a, us-east-2b. and us-east-2c) in different availability zones of us-east-2 (Ohio
Region). The availability zones are located in the same region but not at the same building or
campus. In case there are natural or man-made disasters such as earth quake, cyber attacks, or
fire to one available zone, others may not be affected. Setting up two instances with the same
image on different availability zones or different regions increase the availability of the system.
Figure 5b. Choose availability zones within a region to host the instance
Enter it with /32 in all source entries. This setting restricts the access of the instance and only
allow access from my machine at home. It is critical that we protect this infant instance, since it
is not yet patched and we do not want a hacker to invade it! We can later relax the access
restriction once it is patched. Click Review and Launch. See Figure 9.
Figure 9. Specify Security Group (firewall) including ports allowed open and source allow in.
After click “Launch”, you will prompt to create public/private key pair for accessing the
instance. It is a very critical step here! The pop up box shows up. It reminds us to download the
private key or use existing keypair. See Figure 11.
Select “Create a new key pair” from the drop down menu; enter private key file name; click
“Download Key Pair” Actually here we only download the private key, not public key. The
public key is saved in the .ssh/authorized_keys files for verifying of our ssh access later. You
must download the private key file now. No more second chance!! Save the downloaded
private key to a safe place and duplicated them. Once you lost it, no way to get it back.
Click the Launch Instance. Then click the “view instance” button.
Figure 11. Choose to create new key pair or use existing key pair in the system. Make sure to
download the private key (Even though the button say Download Key Pair).
We then went back to the EC2 main interface. Click on the Instances. The instance will be
shown to have yellow color and “Initializing”, later on when it changed to the green and
“Running” as label. Then we know the instance is ready for access and providing services.
See Figure 12. Here we see the entry with cchow@uccs.edu_AMILinux_1 as Name of the
instance, and next is the instance ID which can be used as a parameter in ec2 api call to access
and manage this instance. We will demonstrate that in later session.
When the instance is selected, the lower panel wil show the related instance information.
The right side of the lower panel shows the public IP address and public DNS name AWS create
automatically for us. It is quite a long name. We see the public IP address is included as portion
of the DNS name with -. Later we can show how to create our own shorter domain name if you
obtain a dns domain through the Route 53 service. For now ,we can use the public IP address,
which is shorter, to access the instance.
This complete the cloning of an instance. In our specialization, we will ask you to clone the
above Coursera-CS591-AMI2 AMI image. Later we will clone a Kali AMI image and a Windows
XP image for penetration testing exercise. We can also use these instances for setting up DMZ
subnet for cyber defense exercises.