This project demonstrates the creation of a custom AWS VPC to host secure and scalable cloud resources across public and private subnets. It includes routing, NAT gateway setup, Internet connectivity, security groups, IAM roles, and flow logging using CloudWatch and S3.
The infrastructure consists of:
- Custom VPC with a specific CIDR Block
- Public & Private Subnets across multiple Availability Zones
- Internet Gateway for outbound access
- NAT Gateway for private subnet internet connectivity
- Route Tables for public and private routing
- Security Groups and Network ACLs for traffic control
- VPC Flow Logs integrated with CloudWatch and S3
- VPC Endpoints for private AWS service access
- VPC Name:
umar-vpc - CIDR Block:
10.0.0.0/16
| Subnet Type | Name | AZ | CIDR |
|---|---|---|---|
| Public | public-subnet-a | us-west-2a | 10.0.0.0/24 |
| Public | public-subnet-b | us-west-2b | 10.0.1.0/24 |
| Private | private-subnet-a | us-west-2a | 10.0.2.0/24 |
| Private | private-subnet-b | us-west-2b | 10.0.3.0/24 |
- Name:
umar-igw - Attached to:
umar-vpc
| Route Table | Associated Subnets | Target |
|---|---|---|
umar-public-route-table |
public-subnet-a, public-subnet-b | Internet Gateway (umar-igw) |
umar-private-route-table |
private-subnet-a, private-subnet-b | NAT Gateway (umar-nat-gateway) |
- Name:
umar-nat-gateway - Subnet:
public-subnet-a - Elastic IP:
eipalloc-0d07b3272e0c6b5a2 - Destination:
0.0.0.0/0→umar-nat-gateway
Inbound Rules
- ICMP (Ping) —
0.0.0.0/0 - HTTP —
0.0.0.0/0 - SSH —
0.0.0.0/0
Outbound Rules
- All traffic —
0.0.0.0/0
Inbound Rules
- ICMP, HTTP, SSH — from
umar-public-sg
Outbound Rules
- All traffic —
0.0.0.0/0
| Instance | Subnet | AMI | Type | Key Pair | Security Group |
|---|---|---|---|---|---|
ec2-public-a |
public-subnet-a | Ubuntu 24.04 LTS | t3.micro | umarsatti.pem | umar-public-sg |
ec2-private-a |
private-subnet-a | Ubuntu 24.04 LTS | t3.micro | umarsatti.pem | umar-private-sg |
IAM Role: umar-vpc-flowlogs-role
Trusted Entity: vpc-flow-logs.amazonaws.com
Policy Permissions:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
- logs:DescribeLogGroups
- logs:DescribeLogStreams
- Name:
umar-vpc-logs - Retention: Never Expire
- Purpose: Store VPC Flow Logs for monitoring network activity.
- Name:
umar-vpc-flowlogs - Destination: CloudWatch Logs
- Log Group:
umar-vpc-logs - IAM Role:
umar-vpc-flowlogs-role
- Bucket Name:
umar-vpc-flowlogs-s3-bucket - Public Access: Blocked
- Encryption: SSE-S3 Enabled
- Versioning: Disabled
- Endpoint Name:
umar-vpc-endpoint-s3 - Service:
com.amazonaws.us-west-2.s3 - Type: Gateway
- Flow Log Destination: S3 bucket above
- Verify connectivity between public and private EC2 instances by pinging each other using their private IP addresses.
- Verify internet connectivity from both instances by pinging a public domain such as google.com (ping google.com).
- Use SSH Client to securely connect to EC2 instances after setting proper key permissions (chmod 400 <keypair.pem>).
- Confirm successful ICMP communication and internet access through CloudWatch log entries.
