AWS Fast Track – Section 1: Core for Infra Architects


AWS Global Infrastructure and Account Setup

Core Infrastructure Services


Labs

Lab 1: Build a 3-tier VPC with public/private subnets across 2 AZs

AWS Console Steps

  1. Services → VPC → Your VPCs → Create VPC
  2. Name: MyVPC, IPv4 CIDR: 10.0.0.0/16, Tenancy: Default
  3. Services → VPC → Subnets → Create subnet for each:
    • Public Subnet 1: VPC=MyVPC, AZ=us-east-1a, CIDR=10.0.1.0/24
    • Public Subnet 2: VPC=MyVPC, AZ=us-east-1b, CIDR=10.0.2.0/24
    • Private Subnet 1: VPC=MyVPC, AZ=us-east-1a, CIDR=10.0.101.0/24
    • Private Subnet 2: VPC=MyVPC, AZ=us-east-1b, CIDR=10.0.102.0/24
  4. VPC → Internet Gateways → Create IGW → Attach to MyVPC
  5. VPC → Route Tables → Create Route Table → Name: PublicRT → Associate with MyVPC
  6. Edit PublicRT routes: Add route 0.0.0.0/0 to IGW
  7. Associate PublicRT with public subnets
  8. VPC → NAT Gateways → Create NAT Gateway in Public Subnet 1 → Allocate Elastic IP
  9. Create PrivateRT route table → Add route 0.0.0.0/0 to NAT Gateway
  10. Associate PrivateRT with private subnets
  11. EC2 → Launch Instance → Amazon Linux AMI → Network: MyVPC, Subnet: Public Subnet 1 → Auto-assign Public IP Enabled
  12. Configure Bastion Security Group → Allow SSH (port 22) from your IP only
  13. Set up launch template/configuration for web servers
  14. Create Auto Scaling Group spanning private subnets
  15. Create Application Load Balancer in public subnets → Listeners on ports 80/443
  16. Attach ASG to ALB target group
  17. Configure Security Groups:
    • ALB SG: Allow inbound HTTP/HTTPS from 0.0.0.0/0
    • Web Server SG: Allow inbound HTTP only from ALB SG
    • Bastion SG: Allow inbound SSH only from your IP

AWS CLI Commands

# Create VPC
aws ec2 create-vpc --cidr-block 10.0.0.0/16 --tag-specifications 'ResourceType=vpc,Tags=[{Key=Name,Value=MyVPC}]'

# Create subnets
aws ec2 create-subnet --vpc-id vpc-xxxxxx --cidr-block 10.0.1.0/24 --availability-zone us-east-1a --tag-specifications 'ResourceType=subnet,Tags=[{Key=Name,Value=PublicSubnet1}]'

aws ec2 create-subnet --vpc-id vpc-xxxxxx --cidr-block 10.0.101.0/24 --availability-zone us-east-1a --tag-specifications 'ResourceType=subnet,Tags=[{Key=Name,Value=PrivateSubnet1}]'

# Create Internet Gateway and attach
aws ec2 create-internet-gateway --tag-specifications 'ResourceType=internet-gateway,Tags=[{Key=Name,Value=MyIGW}]'

aws ec2 attach-internet-gateway --vpc-id vpc-xxxxxx --internet-gateway-id igw-xxxxxx

# Create public route table and route to IGW
aws ec2 create-route-table --vpc-id vpc-xxxxxx --tag-specifications 'ResourceType=route-table,Tags=[{Key=Name,Value=PublicRT}]'

aws ec2 create-route --route-table-id rtb-xxxxxx --destination-cidr-block 0.0.0.0/0 --gateway-id igw-xxxxxx

aws ec2 associate-route-table --route-table-id rtb-xxxxxx --subnet-id subnet-xxxxxx

# Allocate Elastic IP and create NAT Gateway in public subnet
aws ec2 allocate-address --domain vpc

aws ec2 create-nat-gateway --subnet-id subnet-xxxxxx --allocation-id eipalloc-xxxxxx

# Create private route table and add route to NAT Gateway
aws ec2 create-route-table --vpc-id vpc-xxxxxx --tag-specifications 'ResourceType=route-table,Tags=[{Key=Name,Value=PrivateRT}]'

aws ec2 create-route --route-table-id rtb-private --destination-cidr-block 0.0.0.0/0 --nat-gateway-id nat-xxxxxx

aws ec2 associate-route-table --route-table-id rtb-private --subnet-id subnet-private-xxxxxx

Lab 2: Secure and Instrument Workload

AWS Console Steps

  1. Configure Security Groups:
    • ALB SG: Allow inbound HTTP/HTTPS from 0.0.0.0/0
    • Web Server SG: Allow inbound HTTP only from ALB SG
    • Bastion SG: Allow inbound SSH only from your IP address
  2. Enable monitoring on EC2 Auto Scaling Group instances
  3. Create CloudWatch alarm on CPUUtilization > 70% for 5 min
  4. Attach alarm action to scale out ASG by 1 instance
  5. Tag resources with Environment and Owner tags

AWS CLI Commands

# Create Security Group for ALB
aws ec2 create-security-group --group-name ALB-SG --description "Allow HTTP/HTTPS" --vpc-id vpc-xxxxxx

aws ec2 authorize-security-group-ingress --group-id sg-alb --protocol tcp --port 80 --cidr 0.0.0.0/0

aws ec2 authorize-security-group-ingress --group-id sg-alb --protocol tcp --port 443 --cidr 0.0.0.0/0

# Create Security Group for Web Server allowing only ALB SG traffic
aws ec2 create-security-group --group-name WebServer-SG --description "Allow only ALB" --vpc-id vpc-xxxxxx

aws ec2 authorize-security-group-ingress --group-id sg-web --protocol tcp --port 80 --source-group sg-alb

# Create Security Group for Bastion (SSH from your IP)
aws ec2 create-security-group --group-name Bastion-SG --description "Allow SSH" --vpc-id vpc-xxxxxx

aws ec2 authorize-security-group-ingress --group-id sg-bastion --protocol tcp --port 22 --cidr YOUR.IP.ADDRESS/32

# Create CloudWatch Alarm for CPU utilization (replace placeholders)
aws cloudwatch put-metric-alarm \
    --alarm-name "HighCPUUtilization" \
    --metric-name CPUUtilization \
    --namespace AWS/EC2 \
    --statistic Average \
    --period 300 \
    --threshold 70 \
    --comparison-operator GreaterThanThreshold \
    --dimensions Name=AutoScalingGroupName,Value=MyAutoScalingGroup \
    --evaluation-periods 1 \
    --alarm-actions arn:aws:autoscaling:REGION:ACCOUNT_ID:scalingPolicy:POLICY_ID:autoScalingGroupName/MyAutoScalingGroup:policyName/MyScaleOutPolicy \
    --unit Percent

Cleanup

AWS Console Steps

  1. EC2 → Auto Scaling Groups → Select → Actions → Delete
  2. EC2 → Launch Templates → Select → Actions → Delete
  3. EC2 → Load Balancers → Select → Actions → Delete
  4. EC2 → Instances → Select all instances → Actions → Terminate
  5. EC2 → Security Groups → Select ALB, Web Server, Bastion → Actions → Delete
  6. VPC → NAT Gateways → Select → Actions → Delete NAT Gateway
  7. VPC → Elastic IPs → Select → Release
  8. VPC → Route Tables → Select PublicRT, PrivateRT → Actions → Delete
  9. VPC → Internet Gateways → Detach → Delete
  10. VPC → Subnets → Select all → Delete
  11. VPC → Your VPCs → Select → Delete

AWS CLI Commands

aws autoscaling delete-auto-scaling-group --auto-scaling-group-name MyAutoScalingGroup --force-delete

aws ec2 delete-launch-template --launch-template-name MyLaunchTemplate

aws elbv2 delete-load-balancer --load-balancer-arn arn:aws:elasticloadbalancing:region:account-id:loadbalancer/app/my-load-balancer/ID

aws ec2 terminate-instances --instance-ids i-xxxxxxx i-yyyyyyy

aws ec2 delete-security-group --group-id sg-alb-id
aws ec2 delete-security-group --group-id sg-web-id
aws ec2 delete-security-group --group-id sg-bastion-id

aws ec2 delete-nat-gateway --nat-gateway-id nat-xxxxxxx

aws ec2 release-address --allocation-id eipalloc-xxxxxxx

aws ec2 delete-route-table --route-table-id rtb-public-id
aws ec2 delete-route-table --route-table-id rtb-private-id

aws ec2 detach-internet-gateway --internet-gateway-id igw-xxxxxxx --vpc-id vpc-xxxxxxx
aws ec2 delete-internet-gateway --internet-gateway-id igw-xxxxxxx

aws ec2 delete-subnet --subnet-id subnet-public1-id
aws ec2 delete-subnet --subnet-id subnet-public2-id
aws ec2 delete-subnet --subnet-id subnet-private1-id
aws ec2 delete-subnet --subnet-id subnet-private2-id

aws ec2 delete-vpc --vpc-id vpc-xxxxxxx