Overview
Lab Details- The purpose of this lab is to give users a practical experience in setting up and configuring a virtual machine in Amazon’s cloud. The lab involves using Amazon Machine Images to launch Amazon EC2 Instances and using key pairs for SSH authentication to log in. The user will also create a web page, publish it, and test it using both public IP addresses and Elastic IP addresses. This lab aims to help users become familiar with Amazon Web Services (AWS) EC2 instances, key pairs, security groups, and Elastic IP addresses.
- Duration: 45 minutes
- AWS Region: US East (N. Virginia) us-east-1
Introduction
What is Elastic IP ?
- Elastic IP (EIP) is a static, public IPv4 address provided by Amazon Web Services (AWS) that is designed for dynamic cloud environments.
- It allows you to associate a fixed public IP address with an EC2 instance, enabling consistent access even if the instance is stopped or restarted.
- Elastic IPs can be remapped quickly to another instance in case of failures, improving availability and disaster recovery.
- AWS manages Elastic IPs, and they are free when attached to a running instance, but incur charges if unused or detached. In short, an Elastic IP ensures reliable, permanent public connectivity for AWS resources.
Architecture diagram

Task details
- Sign in to AWS Management Console
- Create an Amazon Linux Instance from an Amazon Linux AMI
- SSH into your instance and configure your server as a web server.
- Create and publish a sample index.html file.
- Test the page with the public IP address of EC2 Instance created.
- Allocate an Elastic IP and associate it to the EC2 Instance.
- Test the page with Elastic IP address of EC2 Instance.
- Validation of the lab
Prerequisites
- Download putty and puttygen from this link : https://www.chiark.greenend.org.uk/~sgtatham/putty/releases/0.74.html
Launching the lab environment
- To launch the lab environment, click on the Launch lab button.
- Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
- Once the Lab is started, you will be provided with IAM username, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time
Lab guide
Lab steps
Task 1: Sign in to AWS Management Console
- Click on the Open console button, and you will get redirected to AWS Console in a new browser tab.
-
On the AWS sign-in page,
- Leave the Account ID as default. Never edit/remove the 12-digit Account ID present in the AWS Console. Otherwise, you cannot proceed with the lab.
- Now copy your Username and Password in the Lab Console to the IAM Username and Password in AWS Console and click on the Sign-in button.
- Once Signed In to the AWS Management Console, make the default AWS Region as US East (N. Virginia) us-east-1.
- Select Maybe later in New AWS Console Home page pop-up
If you face any issues, please go through FAQs and Troubleshooting.
Task 2: Provision Default VPC
- Navigate to VPC by clicking on the Services menu in the top, then click on VPC or Open the Amazon VPC console via https://console.aws.amazon.com/vpc/.
-
Delete the default VPC by following the below steps:
- In the navigation pane, choose Your VPCs.
-
Select the VPC with value as yes in default VPC column.

-
Go to actions button and click on delete VPC button

- Check I acknowledge that I want to delete my default VPC option.
-
Type delete default VPC and click on Delete button

-
Now to provision Default VPC again
-
Refresh your console go to actions and click Create default VPC

-
Click Create default VPC button and your default VPC will get created


-
Refresh your console go to actions and click Create default VPC
If you are unable to delete the default VPC, see FAQs and Troubleshooting.

Task 3: Launching an EC2 Instance
In this task, we will launch an EC2 Instance by adding the name, instance type, key pair, security groups, and other details.- Make sure you are in the US East (N. Virginia) us-east-1 Region.
- Navigate to EC2 by clicking on the Services menu in the top, then click on EC2 in the Compute section.
- Navigate to Instances on the left panel and click on Launch instances button

-
Name : Enter MyEC2Server

-
For Amazon Machine Image (AMI): Search for Amazon Linux 2023 kernel-6.1 AMI in the search box and click on the select button.

- For Instance Type: Select t2.micro
-
For Key pair: Select Create a new key pair link.
- Key pair name: MyEC2Key
- Key pair type: RSA
-
Private key file format: Select .ppk
Note: If you are a Linux or MAC user, select the Private key file format as .pem

- Select Create key pair Button.
- In Network Settings, Click on Edit:
- Auto-assign public IP: Enable
- Select Create new Security group
- Security group name: Enter whizlabs_SG
-
Description: Enter a description of Security group for the whizlabs_SG
-
To add SSH,
- Choose Type: SSH
- Source: Anywhere
-
For HTTP,
- Click on Add security group rule
- Choose Type: HTTP
- Source: Anywhere
-
To add SSH,

- Keep rest thing Default and Click on Launch Instance Button.
- Select View all Instances to View the Instance you Created
- Launch Status: Your instance is now launching. Click on View Instances. In the dashboard, find your instance and wait for complete initialization of the instance until the instance state changes to running.

- Select the instance which you have created and then, below in details, note the IPv4 Public IP Address of the EC2 instance. A sample is shown in the screenshot below.

Task 4: SSH into EC2 Instance
- Once the instance is launched, Select EC2 Instance Connect option and click on Connect button.

- Please follow the steps in SSH into EC2 Instance for more options to SSH.
Task 5: Install an Apache Server
In this task, we will run some updates and install the Apache server using the commands mentioned below.-
Switch to root user.
-
Now run the updates using the following command:
-
Once completed, let’s install and run an apache server
-
Install the Apache web server:
- When prompted, press “Y” to confirm.
-
Start the web server
-
Now enable httpd:
-
Check the web server status:
- You can see the active status is running.
-
Install the Apache web server:
Task 6: Create and publish page
-
After installing Apache server, navigate to the HTML folder where we will put our HTML page to be published. Use command:
-
Create a sample index.html file using nano editor:
-
Enter sample HTML content provided below in the file and save the file with Ctrl+X. Click Y to confirm the save, then press Enter to confirm filename.
-
Restart the web server by using the following command:
-
Now enter the file name, i.e., /index.html after the public IPv4 Address which you got when you created the ec2 instance in the browser, and you can see your HTML content.
- Make sure URL Protocol is http not https.
- Syntax: http://<Your_Public_IPv4_Address>/index.html
- Sample URL: 52.90.56.138/index.html

- Now navigate to EC2 instances dashboard, select MyEC2Server and click on stop instance in instance state section.(Make a note of the IP address)

- Now confirm it by clicking Stop button.

- Wait till the instance is stopped and now click on start instance button in the instance state section.

- Once the instance is started, compare the new IP address allocated with the old one ,you can observe the public IP address of the EC2 instance is changed.
Task 7: Allocating Elastic IP Address
To avoid the modification of the IP address, we will allocate an Elastic IP Address in this task. Once it will be allocated , we will associate it with the EC2 Instance created earlier.- To use an Elastic IP address, you need to allocate one to your account and then associate it with your instance or a network interface.
- Navigate to EC2 Under EC2 Dashboard, click on Elastic IPs under Network & security section.
- Click on Allocate Elastic IP address
- Keep everything as default and click on Allocate button.

- You can see that the Elastic IP has been allocated successfully, as shown below.

Task 8: Associating an Elastic IP Address with a Running Instance
In this task, we will associate the allocated IP address with the EC2 Instance created earlier in the Task 2.- Select the Elastic IP address created and click on Actions. Click on Associate Elastic IP address.

-
Associate Elastic IP address
- Resource Type: Click on Instance
- Choose your instance in the drop-down below as shown below.
- Leave default values for the remaining fields and click on Associate button**.**

- Now you can see that the instance is associated with the Elastic IP address.

- Go to the EC2 Instance and check the IPv4 Public IP, and it should be the same as Elastic IP.

-
Next, we will check the web page by entering the Elastic IP address instead of the previous Public IP.
- Sample URL: 3.208.115.72/index.html

- Now navigate to EC2 instances dashboard, select MyEC2Server and click on stop instance in instance state section(Make a note of the IP address)

- Now confirm it by clicking the Stop button.

- Wait till the instance is stopped and now click on the start instance button in the instance state section.

- Wait till the instance starts. You can now observe that after attaching the elastic IP, even after restarting you can see the same public IP address. This prevents us from mapping another address even in case of failures in instances.
Task 9: Validation Test
- Once the lab steps are completed, please click on the Check my work button on the left side panel.
- This will validate the resources in the AWS account and shows you whether you have completed this lab successfully or not.
-
Enter the instance ID and Elastic IP address in their respective empty cells and click the Check my work button.
Sample output :

Completion and conclusion
- You have successfully created and launched an EC2 Instance.
- You have logged into the EC2 instance by SSH, installed the Apache server, and published a page.
- You have allocated an Elastic IP address and associated it with the running instance.
- You have checked the web page with Elastic IP address to make sure it works correctly.
- You have successfully validated the lab.
End lab
- Sign out of the AWS Account.
- You have successfully completed the lab.
- Once you have completed the steps click on End lab in the IP Lab Portal.
What gets checked
When you press Check my work, the platform verifies each of these:- Launch an EC2 Instance — Check whether an EC2 Instance is launched or not.
- Validate EC2 Instance Type t2.micro — Check whether the EC2 instance type is t2.micro.
- Launch EC2 AMI type Amazon Linux — Check whether the EC2 instance is launched using an Amazon AMI.
- Create an Elastic IP — Check whether an Elastic IP is created or not.
- Associate Elastic IP — Check whether an Elastic IP is attached to an EC2 Instance or not.