0% found this document useful (0 votes)
10 views14 pages

AWS VPC and EC2 Setup Guide

The document outlines a practical file for a Cloud Computing course, detailing the steps to set up an AWS Virtual Private Cloud (VPC) and EC2 instances. It includes phases such as creating a VPC, building subnets, configuring an Internet Gateway, setting up routing, and launching EC2 instances. The final phase involves deploying a web server and verifying the setup by accessing the public IP in a browser.

Uploaded by

demo.972350
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views14 pages

AWS VPC and EC2 Setup Guide

The document outlines a practical file for a Cloud Computing course, detailing the steps to set up an AWS Virtual Private Cloud (VPC) and EC2 instances. It includes phases such as creating a VPC, building subnets, configuring an Internet Gateway, setting up routing, and launching EC2 instances. The final phase involves deploying a web server and verifying the setup by accessing the public IP in a browser.

Uploaded by

demo.972350
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Swarrnim Startup & Innovation University

Swarrnim School of Computing & IT

Practical File
Subject: Cloud Computing Course

Code:

Semester: III (MCA)

Faculty Name: kamlesh sir

Student Name: Brahmbhatt


Dhruv Y

Enrollment No.: 2414607025

Batch: MCA – Semester III

List of Practical Problems: -

AWS VPC and EC2 Setup


Phase 1: Creating the Virtual Private Cloud (VPC)
The VPC is your private, isolated network on the AWS global infrastructure.

• Step 1: Sign In: Access the AWS Management Console.


• Step 2: Access VPC Service: Search for VPC in the top search bar.

• Step 3: Create VPC: Select VPC only.


o Name tag: MyVPC.
o IPv4 CIDR block: [Link]/16. This defines the private IP range for your
entire network. The /16 mask provides 65,536 addresses.
o Tenancy: Default (ensures your instances run on shared hardware, which is
cost-effective).
• Outcome: You now have a private network container with no subnets or internet
access.

Phase 2: Building the Subnets


Subnets divide your VPC into smaller segments. We use two Availability Zones (AZs) for
high availability (redundancy).

• Step 1: Create Public Subnets:


o PublicSubnet1: VPC: MyVPC, AZ: us-east-1a, CIDR: [Link]/24. o
PublicSubnet2: VPC: MyVPC, AZ: us-east-1b, CIDR: [Link]/24.
• Step 2: Create Private Subnets:
o PrivateSubnet1: VPC: MyVPC, AZ: us-east-1a, CIDR: [Link]/24.
o PrivateSubnet2: VPC: MyVPC, AZ: us-east-1b, CIDR: [Link]/24.

• Step 3: Enable Auto-Assign Public IP:


o Select PublicSubnet1 > Actions > Edit subnet settings > Check
Enable auto-assign IPv4 public IP. Repeat for PublicSubnet2. o
Why? This ensures any EC2 launched here automatically gets a public
IP address to communicate with the world.

Phase 3: Internet Gateway (IGW)


An IGW is a horizontally scaled, redundant, and highly available VPC component that allows
communication between your VPC and the internet.
• Step 1: Create IGW: Go to Internet Gateways > Create internet gateway > Name:
MyIGW.
• Step 2: Attach to VPC: Select MyIGW > Actions > Attach to VPC > Select MyVPC.

• Explanation: Think of the IGW as the "doorway" to the internet. Without it, your
VPC is completely "air-gapped."
Phase 4: Routing and Traffic Flow
Route tables tell network packets where to go.

• Step 1: Create Public Route Table:


o Name: PublicRouteTable.

o Routes Tab: Edit routes and add Destination: [Link]/0 (this represents the
entire internet) and Target: Internet Gateway (MyIGW).

o Subnet Associations: Explicitly associate PublicSubnet1 and


PublicSubnet2.
• Step 2: Create Private Route Table:
o Name: PrivateRouteTable. o Subnet Associations: Associate
PrivateSubnet1 and PrivateSubnet2.
o Initial Status: Currently, these subnets can talk to each other but not to the
internet.
Phase 5: NAT Gateway (The Outbound Bridge)
A NAT Gateway allows instances in a private subnet to connect to the internet (e.g., to
download security patches) but prevents the internet from initiating a connection with those
instances.

• Step 1: Create NAT Gateway: * Subnet: Must be placed in a Public Subnet


(PublicSubnet1). o Elastic IP: Click
Allocate Elastic IP.

• Step 2: Route Traffic: Go back to PrivateRouteTable > Routes > Edit routes. Add
Destination: [Link]/0 and Target: NAT Gateway.

• Explanation: Private instances now "mask" their identity behind the NAT Gateway's
public IP to reach the internet.
Phase 6: Security Group (Firewall)
Security groups act as a firewall at the instance level, not the subnet level.

• Step 1: Create Security Group: Name: MySG, VPC: MyVPC.

• Step 2: Inbound Rules:


o SSH (Port 22): Allows you to log in via terminal. o HTTP
(Port 80): Allows web traffic to reach your web server.
• Step 3: Outbound Rules: Leave as All Traffic (default) so the instance can respond
to requests.

Phase 7: Launching EC2 Instances


These are your virtual servers.

• Step 1: Public Instance: Launch a [Link] in PublicSubnet1. Use MySG and


download your .pem key pair.
• Step 2: Private Instance: Launch a [Link] in PrivateSubnet1. Use the same
security group. o Note: You will not be able to SSH directly into this from your
home computer because it has no public IP.
Phase 8: Deployment and Verification
Making the Public EC2 a live web server.

1. SSH Login: Run ssh -i "[Link]" ec2-user@<Public-IP>.

2. Update & Install:


o sudo yum update -y: Updatesthe OS packages.
o sudo yum install httpd -y: Installs the Apache web server.

3. Launch Web Page:


o sudo systemctl start httpd: Starts the server. o sudo systemctl enable
httpd: Ensures it starts even if the server reboots. o echo "Hello from
Public EC2!" | sudo tee

/var/www/html/[Link]: Creates your homepage.

4. Verification: Paste the Public IP into your browser. If you see the text, your VPC
architecture is perfectly configured.

You might also like