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: EC2 - My VPC
- AMI: Amazon Linux 2 AMI (HVM), SSD Volume Type

- Choose Instance Type
- Select t2.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 (AZ2)
- Auto-assign Public IP: Enable
- Security group: My VPC SG
- Click Launch instance

- Verify Instance Creation
- Click View all instances
- Review instance details

- Launch Second Instance
- Click Launch instances
- Configure as follows:
- Name: EC2 - HG VPC
- AMI: Amazon Linux 2 AMI (HVM), SSD Volume Type

- Configure Instance Type
- Select t2.micro
- Use existing key pair

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

- Verify Second Instance
- Click View all instances
- Review instance details

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

- Test Private IP Connectivity
- From EC2 - My VPC
- Ping EC2 - HG VPC’s Private IP
- Note: This will fail as VPCs are not yet connected

🔒 Security Note: Always use secure methods to connect to your EC2 instances. Consider using AWS Systems Manager Session Manager for secure shell access without opening inbound ports.
⚠️ Warning: Ensure you have the correct permissions and security group configurations before attempting to connect to your instances.
💡 Pro Tip: For detailed SSH connection instructions, refer to the lab About Amazon EC2 section 4.2.