Example

πŸ”Ή Complex VPC Setup in AWS – Step-by-Step Guide via AWS Console

This guide covers: βœ… Detailed explanation of VPC concepts βœ… Step-by-step AWS Console setup βœ… Real-world enterprise scenario βœ… Troubleshooting common issues


πŸ”Ή Key AWS Networking Components

Before creating a complex VPC setup, let's understand the key AWS networking components:

Component

Description

VPC (Virtual Private Cloud)

A logically isolated section of AWS where you can launch AWS resources in a virtual network.

Subnet

A subdivision of a VPC. Public subnets allow internet access, while private subnets are isolated.

Internet Gateway (IGW)

Enables internet access for instances in public subnets.

NAT Gateway (Network Address Translation)

Allows instances in private subnets to access the internet securely.

Route Table

Defines how traffic is directed within the VPC and to external networks.

Security Group

Controls inbound and outbound traffic to AWS resources.

NACL (Network ACL)

An optional layer of security for subnets, acting as a firewall.

VPC Peering

Connects two VPCs for seamless communication.

Transit Gateway

Connects multiple VPCs and on-premises networks through a central hub.

AWS VPN

Securely connects your AWS VPC to an on-premises network.


πŸ”Ή Real-World Enterprise VPC Setup

Scenario: A company is deploying a highly available web application. The infrastructure must: βœ” Host a public-facing web application βœ” Securely store databases in private subnets βœ” Allow application servers to communicate with databases βœ” Support multiple availability zones for high availability βœ” Enable secure communication between on-prem and AWS via VPN

VPC Design

  • VPC CIDR: 10.0.0.0/16

  • Subnets:

    • Public Subnets (Load Balancer, NAT Gateway)

    • Private Subnets (Application Servers)

    • Isolated Subnets (Databases & Secure Services)


πŸ”Ή Step-by-Step AWS Console Setup

1️⃣ Create a VPC

  1. Go to AWS Console β†’ VPC Dashboard β†’ Create VPC

  2. VPC Name: Enterprise-VPC

  3. IPv4 CIDR Block: 10.0.0.0/16

  4. Click Create VPC

βœ… Common Issue: "CIDR block overlaps with another VPC." πŸ”Ή Fix: Use a unique CIDR block that doesn’t overlap with other VPCs.


2️⃣ Create Subnets

  1. Go to VPC Dashboard β†’ Subnets β†’ Create subnet

  2. Select VPC: Enterprise-VPC

  3. Subnet Details:

    • Public Subnet (AZ1): 10.0.1.0/24

    • Public Subnet (AZ2): 10.0.2.0/24

    • Private Subnet (AZ1): 10.0.3.0/24

    • Private Subnet (AZ2): 10.0.4.0/24

    • Isolated Subnet (AZ1): 10.0.5.0/24

    • Isolated Subnet (AZ2): 10.0.6.0/24

  4. Click Create Subnet

βœ… Common Issue: "Subnet creation failed." πŸ”Ή Fix: Ensure the subnet CIDR is within the VPC range.


3️⃣ Create an Internet Gateway (IGW)

  1. Go to VPC Dashboard β†’ Internet Gateways β†’ Create Internet Gateway

  2. Name: Enterprise-IGW

  3. Click Create and Attach to VPC β†’ Enterprise-VPC

βœ… Common Issue: "Instances in public subnet can't access the internet." πŸ”Ή Fix: Ensure route tables direct internet traffic to the IGW.


4️⃣ Configure Route Tables

  1. Go to Route Tables β†’ Create Route Table

  2. Name: Public-RT

  3. Select VPC: Enterprise-VPC

  4. Add Route:

    • Destination: 0.0.0.0/0

    • Target: Internet Gateway (Enterprise-IGW)

  5. Associate Public Subnets with Public-RT

βœ… Common Issue: "Traffic isn't routing as expected." πŸ”Ή Fix: Ensure subnets are associated with the correct route table.


5️⃣ Create a NAT Gateway for Private Subnets

  1. Go to VPC Dashboard β†’ NAT Gateways β†’ Create NAT Gateway

  2. Select a Public Subnet

  3. Allocate an Elastic IP

  4. Click Create NAT Gateway

βœ… Common Issue: "Instances in private subnets can’t access the internet." πŸ”Ή Fix: Ensure the private subnet route table directs traffic to the NAT Gateway.


6️⃣ Configure Security Groups

  1. Go to EC2 Dashboard β†’ Security Groups β†’ Create Security Group

  2. Name: Web-SG

  3. Inbound Rules:

    • HTTP (80) β†’ Anywhere (0.0.0.0/0)

    • HTTPS (443) β†’ Anywhere (0.0.0.0/0)

  4. Click Create

βœ… Common Issue: "Application is inaccessible." πŸ”Ή Fix: Ensure security groups allow inbound HTTP/HTTPS traffic.


7️⃣ Enable VPC Peering (if needed)

  1. Go to VPC Dashboard β†’ VPC Peering β†’ Create Peering Connection

  2. Select VPCs to connect

  3. Accept the request in the target VPC

βœ… Common Issue: "VPCs cannot communicate." πŸ”Ή Fix: Update route tables to include routes for the peered VPC.


8️⃣ Set Up AWS VPN (for On-Prem Connectivity)

  1. Go to VPC Dashboard β†’ VPN Connections β†’ Create VPN Connection

  2. Select Customer Gateway (On-Prem Device)

  3. Attach to Transit Gateway or VPC

βœ… Common Issue: "VPN connection keeps dropping." πŸ”Ή Fix: Ensure correct BGP configuration on both AWS and on-prem routers.


πŸš€ Summary of Setup

βœ” Multi-tier architecture with public, private, and isolated subnets βœ” Internet access via IGW & NAT Gateway βœ” Security best practices with Security Groups & NACLs βœ” VPC Peering & VPN for hybrid cloud connectivity


πŸ”₯ Next Steps

Want to deploy an EKS cluster in this VPC? Let me know! πŸš€

Last updated