Create EC2 Instance
Create EC2 Instance
ℹ️ Information: In this step, you will create two EC2 instances in the public subnets of two VPCs. This exercise assumes familiarity with EC2 instance creation. For detailed EC2 initialization steps, refer to the lab Initialize EC2 VMs.
💡 Pro Tip: Using consistent naming conventions for your EC2 instances helps with resource management and identification.
Implementation Steps
- Access EC2 Console
- Search for EC2 in the AWS Management Console
- Select EC2 service

- Launch Instance
- Select Instances from the left sidebar
- Click Launch instances

- Configure First Instance
- Name, type
EC2 - My VPC - Choose AMI: Amazon Linux 2023 kernel-6.1 AMI

- Choose Instance Type
- Select t3.micro
- Create new key pair

- Create Key Pair
- Key pair name:
vpcpeering-key - Key pair type: RSA
- Private key file format: .pem
- Click Create key pair

- Configure Network Settings
- Network: My VPC
- Subnet: My VPC-Public-Subnet-2
- Auto-assign Public IP: Enable
- Security group: My VPC SG
- Click Launch instance

- Click View all instances
- Review instance details

- Verify Instance Creation

- Continue Launch Second Instance by choose Launch instances

- Perform instance configuration
- Name:
EC2 - HG VPC - AMI: Amazon Linux 2 AMI (HVM), SSD Volume Type

- Choose Instance type
- Select t3.micro
- Use existing Key pair

- Configure Network Settings
- VPC: HG VPC
- Subnet: HG VPC-Public-Subnet-2
- Auto-assign Public IP: Enable
- Security group: HG VPC SG
- Click Launch instance

- Instance created successfully, click View all instances

- View detailed information about the newly created instance

- Test Connectivity
- SSH into EC2 - My VPC
- Ping EC2 - HG VPC’s Public IP
- Command:
ping <EC2 Public IPv4> -c5

- Now, try connecting SSH to EC2 - My VPC and ping the Public IP address of EC2 - HG VPC (with the command
ping <EC2 Public IPv4> -c5)
💡 Pro Tip: There are two ways to connect SSH to EC2:
- Connect to Amazon EC2 Linux 2 using MobaXterm
- Connect to Amazon EC2 Linux 2 using PuTTY
Here I connect to Amazon EC2 Linux 2 using MobaXterm.
You can review how to connect SSH to EC2 by accessing Lab Introduction to Amazon EC2 section 4.2.

ℹ️ Information: You will see the ping is successful because the two instances are communicating with each other over the Public Internet.
- Keep the SSH connection to EC2 - My VPC, now try pinging the Private IP address of EC2 - HG VPC. You will see the ping fails because the two VPCs are separate and not yet connected to each other.
