Services Covered

  • EC2 EC2

Lab description

In this lab a new VPC will be created with a public subnet. An Internet Gateway and Route Table will be attached in order to allow a EC2 Instance to communicate with internet

Learning Objectives

  • Create VPC
  • Create a subnet and an internet gateway
  • Configure routing for your VPC using a route table
  • Create and manage an EC2 instance and an associated Elastic IP Address (EIP) within your VPC

Lab date



  • AWS account

Lab steps

  1. In Management Console go to VPC and create a new one with following values: CIDR block:, No IPv6 CIDR block, tenancy: default.
  2. Create a new Subnet. VPC ID: choose the one created in previous step. Give it a name to indicate that it’ll be a public subnet, choose an AZ and provide CIDR block:
  3. Create a new Internet Gateway for your previously created VPC. Then attach the IGW to the VPC
  4. Add routes to your previously created VPC route table. Choose the route associated with your VPC, and in Routes tab click on Edit routes. Then Add route and set the values to Destination: and Target: choose Internet Gateway and then select the previously-created one.
  5. Create an EC2 instance inside your VPC. Navigate to EC2 and launch instance (Amazon Linux 2, t2.micro). Make sure that under Network you choose your VPC and enable assigning of Public IPv4 address. Create a new Security Group that will allow All CIMP – IPv4 from anywhere inbound traffic.

  6. Once your instance is running, copy the IPv4 Public IP and try pinging it from you computer:

  7. Allocate an EIP and associate it with your EC2 instance. Navigate to VPC tab and Allocate Elastic IP address. Then select it and from Actions choose Associate Elastic IP address. Provide the following values: Resource type: Instance, Instance: your earlier created instance, Private IP leave blank.
  8. Now if you ping that Elastic IP you should get responses from instance.

Lab files