In this step, we will set up the entire network infrastructure for the Rookwork project, consisting of 3 main parts:
ap-southeast-1 region.VPC and more (not “VPC only”).| Parameter | Value |
|---|---|
| Name tag auto-generation | rookwork |
| IPv4 CIDR block | 10.0.0.0/16 |
| IPv6 CIDR block | No IPv6 CIDR block |
| Tenancy | Default |
| Number of Availability Zones | 2 (ap-southeast-1a and ap-southeast-1b) |
| Number of public subnets | 2 |
| Number of private subnets | 2 |
| NAT gateways | None (to be created separately in Part 2) |
| VPC endpoints | S3 Gateway |
| DNS hostnames | Enable |
| DNS resolution | Enable |
The right side of the screen will display a Preview of the VPC diagram containing 4 Subnets across 2 AZs.

None (we will create this manually in Part 2).S3 Gateway to create a VPC Endpoint for connecting to S3 internally without going through the internet.
Click Create VPC to deploy.
The system automatically generates:
rookwork-vpc — CIDR 10.0.0.0/16rookwork-igwrookwork-vpce-s3 (S3 Gateway)[!TIP] After creation, go to Your VPCs → rookwork-vpc → Resource Map tab to verify that the entire network routing is configured correctly.
The NAT Gateway allows resources in the Private Subnet (EC2 Backend) to download packages and updates from the internet without exposing their IP addresses.
| Parameter | Value |
|---|---|
| Name | rookwork-nat |
| Availability mode | Regional - new |
| VPC | rookwork-vpc |
| Connectivity type | Public |
| Elastic IP allocation | Automatic |

Name = rookwork-nat is filled in correctly.
Pending, wait 1–2 minutes and refresh the page.[!NOTE] NAT Gateways are billed per hour and per GB of data processed. Remember to delete this resource after completing the lab in step 5.6 – Resource Cleanup.
Security Groups act as virtual firewalls at the instance level. We create 3 Security Groups using a layered security model:
rookwork-alb-sg: Opens HTTP/HTTPS ports from the internet → receives user requests.backend-sg: Only accepts traffic from rookwork-alb-sg → backend has no direct internet exposure.rds-ec2-1: Only accepts PostgreSQL connections (port 5432) from ec2-rds-1 → RDS is completely isolated from the internet.rookwork-alb-sg)| Field | Value |
|---|---|
| Security group name | rookwork-alb-sg |
| Description | Security group for Application Load Balancer |
| VPC | rookwork-vpc |
Inbound rules:
| Type | Protocol | Port | Source |
|---|---|---|---|
| HTTPS | TCP | 443 | 0.0.0.0/0 |
| HTTP | TCP | 80 | 0.0.0.0/0 |
Outbound rules: Keep default (All traffic). Click Create security group.

backend-sg)| Field | Value |
|---|---|
| Security group name | backend-sg |
| Description | Security group for Backend EC2 instances |
| VPC | rookwork-vpc |
Inbound rules: Leave empty (to be added in Step 3).
Outbound rules: Keep default. Click Create security group.

backend-sgOnce rookwork-alb-sg has been created and has a Security Group ID, return to edit backend-sg → Inbound rules → Edit inbound rules:
| Type | Protocol | Port | Source |
|---|---|---|---|
| Custom TCP | TCP | 8080 | rookwork-alb-sg (select SG ID) |
| HTTP | TCP | 80 | rookwork-alb-sg (select SG ID) |
[!IMPORTANT] For the Source, select Custom and enter the name or ID of
rookwork-alb-sginstead of entering a CIDR IP. This ensures the Backend only accepts traffic from the Load Balancer, never directly from the internet.
Click Save rules.

rds-ec2-1)To protect the database, we create a dedicated Security Group that only allows connections from the EC2 Backend on the PostgreSQL port.
| Field | Value |
|---|---|
| Security group name | rds-ec2-1 |
| Description | Security group for RDS PostgreSQL |
| VPC | rookwork-vpc |
Inbound rules — Add 2 rules:
| Type | Protocol | Port | Source |
|---|---|---|---|
| PostgreSQL | TCP | 5432 | ec2-rds-1 (EC2 Security Group ID) |
| PostgreSQL | TCP | 5432 | backend-sg (Security Group ID) |
[!IMPORTANT] For the Source, select Custom and type the Security Group ID of
ec2-rds-1orbackend-sg. This ensures the RDS only accepts database connections from the EC2 Backend and is never exposed directly to the internet.
Click Save rules.

After completing all 3 parts, the Rookwork network infrastructure is ready:
| Resource | Name | Status |
|---|---|---|
| VPC | rookwork-vpc | Available |
| Public Subnets | rookwork-subnet-public1/2-... | Available |
| Private Subnets | rookwork-subnet-private1/2-... | Available |
| Internet Gateway | rookwork-igw | Attached |
| NAT Gateway | rookwork-nat | Available |
| VPC Endpoint | rookwork-vpce-s3 | Available |
| Security Group ALB | rookwork-alb-sg | Created |
| Security Group Backend | backend-sg | Created |
| Security Group RDS | rds-ec2-1 | Created |
[!TIP] Defense-in-Depth security model: ALB → Backend → RDS. Each layer only accepts incoming traffic from the preceding layer, ensuring the database is completely isolated from the internet.