Day 30: How to Enable Internet Access for Private EC2 using NAT Instance | AWS Networking

Welcome to Day 30 of the AWS & Cloud DevOps Series! In this video, we will learn how to provide internet access to a private EC2 instance using a NAT Instance. This is a practical AWS networking scenario where private servers need outbound internet connectivity without being directly exposed to the public internet. ---------------------------------------------------------------------------- STEP 1: Login & Find Existing Resources Go to VPC → Subnets → find xfusion-priv-subnet Note down: Its CIDR block (e.g. 10.1.1.0/24) Its Availability Zone (e.g. us-east-1a) Go to VPC → Your VPCs → find xfusion-priv-vpc Note its CIDR block (e.g. 10.1.0.0/16) STEP 2: Create Public Subnet VPC → Subnets → Create subnet VPC: xfusion-priv-vpc Name: xfusion-pub-subnet AZ: same as private subnet CIDR: a different range e.g. if private is 10.1.1.0/24 use 10.1.2.0/24 STEP 3: Create & Attach Internet Gateway VPC → Internet Gateways → Create Name: xfusion-igw After creation → Actions → Attach to VPC → select xfusion-priv-vpc STEP 4: Create Public Route Table VPC → Route Tables → Create route table Name: xfusion-pub-rt VPC: xfusion-priv-vpc Routes tab → Edit routes → Add route: Destination: 0.0.0.0/0 Target: xfusion-igw Subnet associations tab → Edit → associate xfusion-pub-subnet STEP 5: Create Security Group for NAT Instance EC2 → Security Groups → Create Name: xfusion-nat-sg VPC: xfusion-priv-vpc Inbound rules: All traffic — Source: private subnet CIDR (e.g. 10.1.1.0/24) SSH — Source: 0.0.0.0/0 Outbound: All traffic 0.0.0.0/0 (default) STEP 6: Launch NAT Instance EC2 → Launch Instance Name: xfusion-nat-instance AMI: Amazon Linux 2023 Type: t3.micro Network: xfusion-priv-vpc Subnet: xfusion-pub-subnet Auto-assign public IP: ENABLE ✅ Security group: xfusion-nat-sg STEP 7: Disable Source/Destination Check ⚠️ Don't skip! EC2 → select xfusion-nat-instance Actions → Networking → Change source/destination check Check the "Stop" box ✅ → Save STEP 8: Configure NAT on the Instance Connect via EC2 Instance Connect, then run: Install iptables sudo dnf install -y iptables-services Enable IP forwarding echo "net.ipv4.ip_forward=1" | sudo tee /etc/sysctl.d/nat.conf sudo sysctl -p /etc/sysctl.d/nat.conf Confirm forwarding is on (must output 1) cat /proc/sys/net/ipv4/ip_forward Check your interface name ip link show Look for the interface that is UP — likely ens5 Add NAT rule (replace ens5 if different) sudo iptables -t nat -A POSTROUTING -o ens5 -j MASQUERADE Save and enable sudo service iptables save sudo systemctl enable iptables sudo systemctl start iptables Verify rule is in place sudo iptables -t nat -L -v STEP 9: Update Private Subnet Route Table VPC → Route Tables → find the route table associated with xfusion-priv-subnet Edit routes → Add route: Destination: 0.0.0.0/0 Target: Instance → select xfusion-nat-instance STEP 10: Verify Wait 2 minutes, then: S3 → xfusion-nat-9963 → check for xfusion-test.txt ✅ ------------------------------------------------------------ By the end of this video, you will understand how private EC2 instances communicate with the internet using a NAT Instance and how routing works inside an AWS VPC. 👍 Like, Share & Subscribe for more AWS, Azure, Cloud Custodian, DevOps, and Cloud Security tutorials. 🔔 Upcoming Topics: AWS NAT Gateway VPC Peering Transit Gateway AWS Security Best Practices #AWS #EC2 #NATInstance #AWSNetworking #VPC #CloudComputing #DevOps #PrivateSubnet #PublicSubnet #CloudEngineer #AWSCloud #MultiCloudSupport

Day 29: Establishing Secure Communication Between Public and Private VPCs via VPC Peering | free lab
▶︎

Day 29: Establishing Secure Communication Between Public and Private VPCs via VPC Peering | free lab

How Proctor’s texts in Karen Read lawsuit could free dangerous criminals
▶︎

How Proctor’s texts in Karen Read lawsuit could free dangerous criminals

Access Private EC2 Without Internet (AWS VPC Endpoints)
▶︎

Access Private EC2 Without Internet (AWS VPC Endpoints)

25 Buddhist Stories for Every Kind of Human Struggle
▶︎

25 Buddhist Stories for Every Kind of Human Struggle

Moody Gardens Penguin Cam LIVE | Penguin Habitat Stream at the Aquarium in Galveston, Texas
▶︎

Moody Gardens Penguin Cam LIVE | Penguin Habitat Stream at the Aquarium in Galveston, Texas

Lab 4 Solution: Working with EBS | AWS Academy Cloud Foundations
▶︎

Lab 4 Solution: Working with EBS | AWS Academy Cloud Foundations

What is SonarQube | Introduction SonarQube | SonarQube Tutorial | SonarQube Basics | Intellipaat
▶︎

What is SonarQube | Introduction SonarQube | SonarQube Tutorial | SonarQube Basics | Intellipaat

Guided Lab : Encrypting Data at Rest by Using AWS Encryption Options
▶︎

Guided Lab : Encrypting Data at Rest by Using AWS Encryption Options

MIT Just Revealed the AI Bubble's Fatal Flaw
▶︎

MIT Just Revealed the AI Bubble's Fatal Flaw

Networking Concepts Every DevOps Engineer Must Know
▶︎

Networking Concepts Every DevOps Engineer Must Know

Trump Sends Vance to Concede to Iran & Reflecting Pool Is Filled with Corruption | The Daily Show
▶︎

Trump Sends Vance to Concede to Iran & Reflecting Pool Is Filled with Corruption | The Daily Show

Reverse Proxy vs Load Balancer vs API Gateway: The Real Difference ?
▶︎

Reverse Proxy vs Load Balancer vs API Gateway: The Real Difference ?

Day : 21 How to Assigning Public IP to Virtual Machines | Azure Step-by-Step Tutorial
▶︎

Day : 21 How to Assigning Public IP to Virtual Machines | Azure Step-by-Step Tutorial

AWS Networking Basics For Programmers | Hands On
▶︎

AWS Networking Basics For Programmers | Hands On

Guided Lab : Introducing Amazon Elastic File System Amazon EFS
▶︎

Guided Lab : Introducing Amazon Elastic File System Amazon EFS

System Design Explained: APIs, Databases, Caching, CDNs, Load Balancing & Production Infra
▶︎

System Design Explained: APIs, Databases, Caching, CDNs, Load Balancing & Production Infra

Keynote: After the AI Hype – What’s Real, and What’s Next - Richard Campbell - 2026
▶︎

Keynote: After the AI Hype – What’s Real, and What’s Next - Richard Campbell - 2026

Introduction to Cloud Custodian | Cloud Governance & Security Automation
▶︎

Introduction to Cloud Custodian | Cloud Governance & Security Automation

How AI agents & Claude skills work (Clearly Explained)
▶︎

How AI agents & Claude skills work (Clearly Explained)

Backend web development - a complete overview
▶︎

Backend web development - a complete overview