This project documents the setup of a secure AWS Virtual Private Cloud (VPC) with a Bastion Host, a Private EC2 Instance, and properly configured firewall rules. The setup is performed manually via the AWS Management Console, with Elastic IP assignment for a stable public IP on the Bastion Host. Detailed steps, screenshots, and best practices are included.
✅ Public-EC2 (Bastion Host) for secure access.
✅ Private-EC2 with no direct public exposure.
✅ Elastic IP for a consistent public IP on the Bastion Host.
✅ Internet Gateway & Route Tables for controlled access.
✅ Key-based SSH authentication (No password login).
✅ Root login disabled for added security.
✅ Security Groups & Network ACLs for access control.
✅ Step-by-step guide with screenshots.
AWS-VPC-Security/
├── README.md # Project overview & usage guide
├── docs/ # Detailed setup and configuration guides
│ ├── setup-guide.md # Step-by-step AWS VPC setup with screenshots (if desired)
│ ├── security-hardening.md # Best security practices
│ └── troubleshooting.md # Common issues and fixes
├── screenshots/ # AWS console and CLI screenshots
└── LICENSE # License for the project
✅ AWS Account with IAM permissions to create VPC resources.
✅ AWS Management Console Access (No CLI automation required).
✅ SSH Key Pair for secure authentication.
✅ Basic Networking & AWS Knowledge.
- Navigate to AWS Management Console → VPC Dashboard.
- Click Create VPC.
- Set CIDR Block to
10.0.0.0/16
. - Enable DNS Support and DNS Hostnames.
- Save & note the VPC ID.
- 📸
- Create a Public Subnet (e.g.,
10.0.1.0/24
inus-east-1a
). - Create a Private Subnet (e.g.,
10.0.2.0/24
inus-east-1b
). - 📸
- 📸
- 📸
- Create an Internet Gateway, then attach it to your VPC.
- Create a Route Table for your public subnet:
- Add a route:
0.0.0.0/0
→ Internet Gateway. - Associate the Public Subnet with this new Public Route Table.
- Add a route:
- 📸
- 📸
- Bastion SG (assigned to your Public EC2):
- Allow SSH (
22/TCP
) from your IP address.
- Allow SSH (
- Private EC2 SG:
- Allow SSH (
22/TCP
) only from the Bastion SG (or the Bastion Host’s private IP).
- Allow SSH (
- 📸
- 📸
- Launch a Bastion Host (Public EC2) in the Public Subnet:
- Assign it the Bastion SG.
- Generate or choose an existing key pair (e.g.,
Public-EC2.pem
).
- Launch a Private EC2 in the Private Subnet:
- Assign it the Private EC2 SG.
- Use a key pair that can be accessed from the Bastion Host.
- 📸
- 📸
- Go to Elastic IPs in your EC2 dashboard.
- Click Allocate Elastic IP address.
- Under Network Border Group, select the same region as your Bastion Host.
- After allocation, select the Elastic IP, then click Actions → Associate Elastic IP address.
- Associate it with the Bastion Host’s Network Interface (or Instance ID).
- 📸
- 📸
Why Elastic IP?
An Elastic IP gives you a static public IP, so you don’t lose your connection if you stop/start or reboot the Bastion Host. It also simplifies SSH access.
Now that your Bastion Host has a stable public IP:
# Connect to Bastion Host (use your allocated Elastic IP)
ssh -i Public-EC2.pem ubuntu@<Elastic-IP>
ssh -i Public-EC2.pem ubuntu@
- 🚫 Disable Password Authentication: Enforce key-based SSH.
- 📸
- 📸
- 🔒 Restrict Security Groups: Limit access by IP.
- 📜 Enable AWS CloudTrail: Track API events.
- 🔐 Use IAM Roles: Avoid static AWS credentials.
- 📊 Monitor with AWS GuardDuty & VPC Flow Logs.
📸 VPC Dashboard
📸 Security Group Rules
📸 Route Table Configuration
📸 SSH Bastion to Private EC2
(All images stored in screenshots/
folder.)
If you can’t SSH into the Private EC2:
ssh -v -i Public-EC2.pem ubuntu@<Private-EC2-IP>
Check security group rules and route table settings.
Ensure NAT Gateway or Bastion forwarding is set up.
curl -s ifconfig.me # Check outbound traffic
This project is licensed under the MIT License.
Thanks to AWS, Cloud Security Experts, and Cybersecurity Communities for guidance.
✅ Upload Configuration & Screenshots
✅ Finalize Documentation
✅ Test Security Measures
🚀 Expand with AWS WAF & Logging
Pull requests are welcome! If you have security improvements or optimizations, feel free to contribute.
🔥 Project Complete? No, Just the Beginning. 🚀💾