Setting Up a Virtual Private Cloud (VPC)
Objective: Create a VPC to isolate resources.
- Log into AWS Management Console.
- Navigate to the VPC dashboard.
- Click on "Create VPC".
- Enter details:
- Name: my-new-vpc
- IPv4 CIDR block: 10.0.0.0/16 (explained as a range of IP addresses available within the VPC).
- Click "Create VPC".
Creating Public and Private Subnets
Objective: Establish separate network segments within the VPC for public and private resources. Navigate to the Subnets section within the VPC dashboard.
Public Subnet:
- Click on "Create Subnet".
- Name: public-subnet
- VPC: my-new-vpc
- Availability Zone: us-east-1a
- IPv4 CIDR block: 10.0.0.0/24
Private Subnet:
- Name: private-subnet
- VPC: my-new-vpc
- Availability Zone: us-east-1b
- IPv4 CIDR block: 10.0.1.0/24
- Launching EC2 Instances
Launching a Public EC2 Instance
Objective: Deploy an Amazon EC2 instance in the public subnet.
- Navigate to the EC2 dashboard.
- Click on "Launch Instance".
- Configure instance details:
- Name: my-public-instance
- Instance Type: t2.micro
- Network: my-new-vpc
- Subnet: public-subnet
- Auto-assign Public IP: Enable
- Security Group: Create or select SG-public with SSH rule.
- Launch the instance.
- Availability Zone: us-east-1a
Launching a Private EC2 Instance
Objective: Deploy another EC2 instance in the private subnet.
- Navigate to the EC2 dashboard.
- Click on "Launch Instance".
- Configure instance details:
- Name: my-private-instance
- Instance Type: t2.micro
- Network: my-new-vpc
- Subnet: private-subnet
- Security Group: Create or select SG-private with SSH rule.
- Launch the instance.
- Availability Zone: us-east-1b
- Internet Access with Internet Gateway
Setting Up Internet Gateway
Objective: Enable internet access for resources in the public subnet.
- Navigate to the VPC dashboard.
- Click on "Internet Gateways".
- Create a new Internet Gateway named my-internet-gateway.
- Attach the Internet Gateway to my-new-vpc.
Configuring Route Tables
Objective: Direct traffic from the public subnet to the Internet Gateway.
- Navigate to the Route Tables section in the VPC dashboard.
- Create a new route table for the public subnet named public-route-table.
- Edit the public-route-table:
- Add a route:
- Destination: 0.0.0.0/0
- Target: my-internet-gateway
- Associate the public-route-table with the public-subnet.
Accessing Private Instance via Public Instance
• Accessing the Private Instance
Top comments (0)