> ## Documentation Index
> Fetch the complete documentation index at: https://docs.briankimemia.is-a.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# VPC Traffic Flow and Security

> VPC Traffic Flow and Security

# Set Up Your VPC Basics

<Disclaimer>
  ⚠️ **Disclaimer:** This guide assumes basic familiarity with AWS services. Ensure you have the necessary permissions in your AWS account before proceeding.
</Disclaimer>

We're repeating our steps from the first networking project to set up our VPC, subnet, and internet gateway. Let's go!

***

## Visualize Your Network (Mermaid Diagram)

```mermaid theme={null}
graph TD
    A[VPC: NextWork VPC] -->|10.0.0.0/16| B[Subnet: Public 1]
    B -->|Route Table| C[Internet Gateway: NextWork IG]
    B -->|Auto-assign Public IP| D[EC2 Instance]
```

This diagram helps visualize the basic structure we’re setting up: a VPC with a public subnet connected to an internet gateway.

***

## Create a VPC

Your VPC is the foundation for the rest of this project and represents your corner of the AWS Cloud.

### Steps:

1. Log in to your AWS Account.
2. Head to your **VPC console**.

<Tip>
  💡 **What is a VPC?**
  A Virtual Private Cloud (VPC) is like managing your own city inside the AWS Cloud. You design neighborhoods (subnets), traffic rules, and security measures, giving you full privacy and control over how your resources work together.
</Tip>

3. Create a VPC with the following settings:
   * **Name tag:** NextWork VPC
   * **IPv4 CIDR:** 10.0.0.0/16

<Tip>
  💡 **What is a CIDR block?**
  CIDR assigns a block of IP addresses. The number after the slash determines the size of the block:

  * **/16:** 65,536 addresses
  * **/24:** 256 addresses
  * **/8:** 16,777,216 addresses
</Tip>

4. Click **Create VPC**.

***

## Create Subnets

Now that we have our VPC, let's create a **public subnet**.

### Steps:

1. In your VPC console, select your **NextWork VPC**.
2. Create a subnet with the following details:
   * **VPC ID:** NextWork VPC
   * **Subnet name:** Public 1
   * **Availability Zone:** First in the list
   * **IPv4 Subnet CIDR block:** 10.0.0.0/24

<Tip>
  💡 **Is my Public 1 subnet a public subnet?**
  Not yet! A public subnet requires a route to an internet gateway. We’ll attach one shortly.
</Tip>

3. Enable the **auto-assign public IPv4 address** setting for the subnet.

<Tip>
  💡 **Why enable auto-assign public IPv4 address?**
  This automatically assigns a public IP to any EC2 instance launched in the subnet, making it internet-accessible without manual IP assignment.
</Tip>

***

## Create an Internet Gateway

### Steps:

1. Go to the **Internet Gateway** section in the VPC console.
2. Create an internet gateway with the following settings:
   * **Name tag:** NextWork IG
3. Attach the internet gateway to your **NextWork VPC**.

<Tip>
  💡 **What does attaching an internet gateway mean?**
  This allows resources in your VPC to access the internet and makes public instances reachable from outside.
</Tip>

***

## Create a Route Table

Even though we’ve attached an internet gateway, we still need to configure a route table to direct traffic.

### Steps:

1. Go to the **Route Tables** section in the VPC console.
2. Rename your **NextWork VPC** route table to `NextWork Route Table`.
3. Add a new route with the following settings:
   * **Destination:** 0.0.0.0/0

<Tip>
  💡 **Why 0.0.0.0/0?**
  This represents all IPv4 addresses, creating a default route for internet-bound traffic.
</Tip>

4. **Target:** Select the internet gateway you created.
5. Associate the route table with your **Public 1** subnet.

<Warning>
  🚨 **Important:** Without a route table linked to an internet gateway, your subnet remains private and cannot communicate with the internet.
</Warning>

***

## Create a Security Group

Lastly, we’ll add a security group to control access to resources in the VPC.

<Tip>
  💡 **What is a security group?**
  Think of it as a security checkpoint for resources. It controls inbound and outbound traffic based on rules for IP addresses, protocols, and port numbers.
</Tip>

### Steps:

1. Go to the **Security Groups** section in the VPC console.
2. Create a security group with the following details:
   * **Name tag:** NextWork SG
   * **VPC:** NextWork VPC
3. Configure inbound rules to allow:
   * **Protocol:** HTTP (port 80)
   * **Protocol:** SSH (port 22, for secure server access)
4. Save the security group.

***

<Summary>
  🎉 **Summary:**
  You’ve successfully set up your VPC with a public subnet, an internet gateway, a route table, and a security group. Your VPC is now ready to host internet-accessible resources like EC2 instances.
</Summary>

<NextSteps>
  👉 **What’s next?**

  * Launch an EC2 instance in your public subnet.
  * Experiment with private subnets and NAT gateways for internal-only resources.
  * Explore advanced VPC features like VPC Peering and Transit Gateways.
</NextSteps>

## 📧 Contact

For questions or feedback, reach out:

📨 Email: [projects@briankimemia.is-a.dev](mailto:projects@briankimemia.is-a.dev)
🌐 Portfolio: [Brian Kimemia](https://briankimemia.is-a.dev/)
**GitHub:** [BrianKN019](https://github.com/BrianKN019)

***

**Thank you for exploring this project! Let’s innovate and build secure AWS solutions together. 🚀**
