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

  1. Access EC2 Console
    • Search for EC2 in the AWS Management Console
    • Select EC2 service

Create EC2 Instance

  1. Launch Instance
    • Select Instances from the left sidebar
    • Click Launch instances

Create EC2 Instance

  1. Configure First Instance
    • Name: EC2 - My VPC
    • AMI: Amazon Linux 2 AMI (HVM), SSD Volume Type

Create EC2 Instance

  1. Choose Instance Type
    • Select t2.micro
    • Create new key pair

Create EC2 Instance

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

Create EC2 Instance

  1. 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

Create EC2 Instance Create EC2 Instance

  1. Verify Instance Creation
    • Click View all instances
    • Review instance details

Create EC2 Instance Create EC2 Instance

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

Create EC2 Instance Create EC2 Instance

  1. Configure Instance Type
    • Select t2.micro
    • Use existing key pair

Create EC2 Instance

  1. 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

Create EC2 Instance

  1. Verify Second Instance
    • Click View all instances
    • Review instance details

Create EC2 Instance Create EC2 Instance

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

Create EC2 Instance

  1. 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

Create EC2 Instance

🔒 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.