Skip to content

Deba43/AWS-VPC-Monitoring-Traffic-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ AWS VPC Monitoring & Connectivity (Flow Logs + CloudWatch Logs Insights)

This project is a hands-on implementation of AWS VPC networking + monitoring where I built multiple VPCs, configured peering, tested connectivity using EC2, and analyzed real network traffic using VPC Flow Logs and CloudWatch Logs Insights.

Without a VPC, all AWS resources would exist in one giant open cloud network β€” like a country with no cities or districts.
A VPC (Virtual Private Cloud) gives you an isolated network where you can define:

βœ… IP ranges
βœ… Subnets (Public/Private)
βœ… Security rules
βœ… Connectivity between resources
βœ… Monitoring and traffic visibility


πŸ“Œ Project Goals

βœ… Build and configure two separate VPCs
βœ… Create subnets, route tables, Internet Gateway (IGW), Security Groups, and NACLs
βœ… Establish VPC Peering between VPCs
βœ… Launch EC2 instances and validate connectivity
βœ… Enable VPC Flow Logs β†’ CloudWatch Log Group
βœ… Run CloudWatch Logs Insights queries to analyze traffic patterns


🧠 Networking Concepts (Explained Simply)

βœ… What is a VPC?

A VPC is your private network environment inside AWS.
It’s the reason you can launch resources that are private to you and control how they communicate without using the public internet.


βœ… What is a CIDR Block?

CIDR (Classless Inter-Domain Routing) defines an IP address range for your VPC or subnet.

Examples

CIDR Block IP Address Range
10.0.0.0/8 10.0.0.0 β†’ 10.255.255.255
10.0.0.0/16 10.0.0.0 β†’ 10.0.255.255
10.0.0.0/24 10.0.0.0 β†’ 10.0.0.255

βœ… What are Subnets?

If a VPC is a city, subnets are neighborhoods inside that city.

  • Public Subnet 🌐 β†’ connected to the internet
  • Private Subnet πŸ” β†’ no direct internet access

πŸ“Œ Important rule: Subnets inside the same VPC must not overlap (each subnet must have a unique CIDR block).


βœ… What is an Internet Gateway (IGW)?

An Internet Gateway connects your VPC to the internet.

It allows resources (like EC2 in a public subnet) to:

  • access the internet (outbound)
  • be accessed from the internet (inbound)

βœ… What is a Route Table?

A Route Table works like a GPS for subnet traffic.

It contains routes (rules) that define where traffic should go.
Every subnet must be associated with a route table.


βœ… What does 0.0.0.0/0 mean?

0.0.0.0/0 represents all IPv4 addresses.

If a subnet route table contains:

  • destination: 0.0.0.0/0
  • target: Internet Gateway

➑️ That subnet becomes a public subnet.


βœ… What is a Security Group (SG)?

A Security Group is like a security guard for a specific resource (like an EC2 instance).

βœ… Security Groups attach to resources, not subnets
βœ… They control:

  • inbound traffic (who can enter)
  • outbound traffic (what your instance can send)

They filter traffic using:

  • IP addresses
  • protocols (HTTP, SSH, FTP, SMTP, etc.)
  • port numbers

βœ… What is a Network ACL (NACL)?

A Network ACL acts like traffic police for an entire subnet.

βœ… NACLs apply to subnets, not individual instances
βœ… Useful for broad rules like:

  • block a range of IPs
  • deny traffic on specific ports

βœ… Security Group vs NACL (Quick Difference)

Feature Security Group Network ACL
Applies to Instance/Resource Subnet
Level Fine-grained Broad
Works like Security guard at building Traffic police at neighborhood
Controls Inbound + Outbound Inbound + Outbound

πŸ–₯️ EC2 Basics Used in This Project

βœ… Key Pair

Key pairs enable secure access to EC2 instances using cryptography.

  • Public key β†’ stored on EC2
  • Private key β†’ stored with the user

Only someone with the private key can authenticate successfully.


βœ… What is an AMI?

AMI (Amazon Machine Image) is a template used to create EC2 instances.
It includes:

  • OS
  • required base software
  • configuration setup

βœ… Instance Type

If AMI = software blueprint, instance type = hardware configuration.

It defines:

  • CPU
  • RAM
  • performance level
  • storage/network capacity

βœ… SSH (Secure Shell)

SSH is the secure protocol used to connect to EC2 instances.

Once connected, all communication is encrypted, making it safe for remote access.


🌐 NAT Gateway vs Internet Gateway

βœ… NAT Gateway

NAT Gateway allows private subnet instances to access the internet (outbound only).

βœ… Useful for:

  • installing updates
  • downloading patches
  • accessing external APIs securely

❌ Does NOT allow inbound connections from the internet.


βœ… Internet Gateway

Internet Gateway allows public subnet instances to communicate with the internet both ways.

βœ… inbound + outbound


πŸ” VPC Connectivity + Testing

βœ… EC2 Instance Connect

Instead of using local SSH terminal, EC2 Instance Connect allows secure browser-based access from AWS Console.


βœ… ICMP (Ping) Traffic

Ping uses ICMP (Internet Control Message Protocol) to test connectivity.

ICMP is often blocked by default to prevent abuse (example: ping flood attacks).
Allowing All ICMP - IPv4 helps troubleshoot connectivity issues.


βœ… Real Ping Output Concepts

While pinging between servers, I observed:

  • time β†’ latency (round trip time)
  • TTL (Time to Live) β†’ packet lifespan across routers
  • sequence number β†’ matches requests & replies

πŸ”— VPC Peering Connection

A VPC peering connection is a private connection between two VPCs.

βœ… Traffic flows between VPCs using private IP addresses
βœ… Communication stays inside AWS network (no public internet)

Without peering, VPC-to-VPC communication would require public routing.


πŸ“Œ Elastic IP (EIP)

An Elastic IP is a static public IPv4 address.

Why it matters:

  • EC2 public IPs are usually dynamic (change after stop/start)
  • Elastic IP provides a permanent public address

πŸ“Š Monitoring with Amazon CloudWatch

βœ… CloudWatch Overview

AWS services publish metrics and logs to CloudWatch.

CloudWatch helps you:

  • visualize performance
  • monitor health
  • troubleshoot issues
  • build dashboards & alarms

βœ… Log Group

A Log Group is like a folder where related logs are stored together.

πŸ“Œ Logs are region-specific, but dashboards can combine data across regions.


βœ… Logs

Logs are the history/diary of what happens inside your system:

  • access attempts
  • errors
  • system events
  • traffic details

βœ… VPC Flow Logs

Flow logs capture traffic information for a VPC (or subnet / network interface).

They record:

  • source IP
  • destination IP
  • ports
  • accept/reject actions
  • bytes transferred

βœ… CloudWatch Logs Insights

Logs Insights allows you to query logs using filters and analytics.

Useful for: βœ… troubleshooting
βœ… identifying rejected traffic
βœ… understanding who is talking to whom
βœ… traffic pattern analysis


βœ… What is a Network Interface (ENI)?

An Elastic Network Interface is automatically attached to your EC2 instance and connects it to your VPC.

It acts as the networking layer that enables sending and receiving data.


βœ… Key Learnings

πŸ”Ή Learned real-world AWS networking by building the setup manually
πŸ”Ή Understood the difference between Security Group vs NACL in actual traffic behavior
πŸ”Ή Verified connectivity using private and public IP addressing
πŸ”Ή Gained hands-on experience with VPC Flow Logs
πŸ”Ή Used Logs Insights queries to observe:

  • ACCEPT vs REJECT traffic
  • bytes transferred
  • top IP talkers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors