Set Up Public VPC and EC2 for Internet Access
Tasks
- Create a public VPC named - devops-pub-vpc.
- Create a subnet named - devops-pub-subnetunder the VPC.
- Ensure public IPs are automatically assigned to resources in this subnet. 
- Create an EC2 instance named - devops-pub-ec2under this VPC.

- You successfully created vpc-0fe2735e948ae693d / devops-pub-vpc.  
- Enable Public DNS for the VPC - Select the newly created VPC ( - devops-pub-vpc) in the VPC dashboard.
- Go to the Actions dropdown and choose Edit DNS hostnames. 
- Enable both DNS resolution and DNS hostnames. 
- Save changes. - VPC → Your VPCs → vpc-0fe2735e948ae693d → Edit VPC settings  
 
- Create the Subnet - a) In the VPC Dashboard, click Create Subnet.  - b) Enter the following details: - VPC: Select - devops-pub-vpc.
- Subnet name: - devops-pub-subnet.
- Availability Zone: Select any (e.g., - us-east-1a).
- IPv4 CIDR block: - 10.0.1.0/24.
 
VPC → Subnets → Create subnet


- Enable Auto-assign public IPv4 address.  
- Create an Internet Gateway  
- Go to Actions, and choose Attach to VPC.  
- Select devops-pub-vpc and click Attach internet gateway.  
- Create and Configure a Route Table - In the VPC Dashboard, go to Route Tables. 
- Click Create route table. 
- Enter the following details: - Name tag: - devops-pub-rt
- VPC: Select - devops-pub-vpc.
 
- Click Create route table. - VPC → Route tables → Create route table  
 
- Click Edit routes.  
- Add the following route: - Destination: - 0.0.0.0/0
- Target: Internet Gateway (select - devops-igwfrom the dropdown).
- Save changes. 
 

- Edit subnet associations - VPC → Route tables → rtb-005a434e2701bf060 → Edit subnet associations  
- Create a Security Group - Enter the following details: - Security group name: - devops-pub-sg
- Description: Allow SSH access. 
- VPC: Select - devops-pub-vpc.
 
- Add an Inbound Rule: - Type: SSH 
- Protocol: TCP 
- Port Range: 22 
- Source: - 0.0.0.0/0
 

- Launch the EC2 Instance - Go to the EC2 Dashboard and click Launch Instances. 
- Enter the following details: - Name: - devops-pub-ec2.
- AMI: Any of ami ( I am choosing ubuntu right now) 
- Instance type: - t2.micro.
- Key pair: Select an existing key pair or create a new one. 
- Network settings: - VPC: Select - devops-pub-vpc.
- Subnet: Select - devops-pub-subnet.
- Auto-assign public IP: Enabled (should be automatic due to subnet settings). 
- Security group: Select - devops-pub-sg.
 
 
- Click Launch Instance.  - Congrats! You have successfully completed the task. 
 
