Creating & Configuring VPC From AWS Management Console (Part 1).
Tags: aws, vpc, cloud, cloudcomputing
Published: 2022-07-15 10:31:38

Amongst the 3 main types of cloud computing: private clouds, public clouds and hybrid clouds, public cloud is the one that gets a lot of people confused.

I've had a lot of people ask me (and some rant) why anyone would ever consider provisioning their workloads in the public cloud where it can be accessed by the general public. Laugh out loud, if you've ever had this thought fret not, you're not the first.

Public cloud can be confusing to those who are new to the cloud and cloud concepts as a rest of the "public" in the name. You must not however that even though the public cloud is accessible to the general public through an Internet connection, no one who you haven't explicitly given the permission or access can access your resources. Your workload in the public cloud remain private to you through virtualization.

## Enters VPC

The VPC, Virtual private cloud, is a logically isolated network housing your resources in the cloud. From a security stand point, a VPC is the most important service offered by any cloud provider. Think of it as your private home network, devices outside your network cannot connect and communicate with your network without a router routing the traffic in and out.

You can also think of the VPC as your apartment in a collection of apartment buildings. Only yourself and those you allow have the permission to access your apartment.

The beauty of the virtual private cloud is that all the control resides with you, it allows you customize your networking configuration when provisioning from scratch. You choose your private IP Address range, internet gateways, subnets, and configure network access control lists.

## Creating VPCs From the AWS Management Console
In the AWS management console there are two ways of creating and configuring your VPC, You can create it by manually creating all the supporting components one after the order or by creating the  VPC along with all other components all at once.

It is worthy of note that every region in AWS comes with a default VPC already created by AWS for you. You can make use of it but considering that your VPCs should be project specific, you would need to create more VPCs as time goes on.

## Method 1: Individual Creation of VPC and it's Components. 
Before we get begin we need an action item list of the components required for the configuration of your VPC.

To fully configure your VPC, we need to create:
* VPC itself
* Subnets
* Route table
* Internet Gateway
 
### Step 1. Login to aws.amazon.com with your Username and Password.
On your browser navigate to https://aws.amazon.com/console/
![AWS Login](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7h3y1992kzs5m4g6fc9.png)

On the top right side, click on the **sign in to console** sign
![AWS Login Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbeqgf4e0sdlkjz2iv2l.png)
Fill in all your details and hit sign in.

### Step 2. Select Services
At the topmost left hand side of the the page, click on **services**, locate **Networking and content delivery** from the drop down and select VPC from the subcategory that appears.
![AWS Services](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/trrvhzx6qmejdgnfi3ol.png)

### Step 3. Time to Start Creating.
<img width="100%" style="width:100%" src="https://media.giphy.com/media/dsGcvvBPzXJ9KSnLPg/giphy.gif">
To create a VPC click on **create VPC** to take you to the VPC creation page.
![Create VPC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g6fqmg4ks2q8edv58pxu.png)

### Step 4. Enter your VPC Details.
Remember that VPCs are project specific so our naming conventions for our VPCs and it's components should reflect that said project.
We're naming this VPC "Sample-VPC"

Select VPC only.
![AWS VPC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xmz6hshz249qjqfqoxp.png)
 
Enter all the details
* Name tag [your-vpc-name][sample-VPC].
* Leave the IPv4 CIDR block on manual input to allow you specify your choice of IP address range.
<kbd>![IPv4 CIDR block](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qvmxcvdhrna2f3kw9fd0.png)<kbd>
 

* IPv4 CIDR Block [10.0.0.0/16] - This gives you 65,536 IP addresses to split across the whole VPC in various subnet ranges.
* Leave the IPv6 CIDR Block as is (No IPv6 CIDR Block) unless you want to use IPv6. In this walk through we won't be using IPv6.

<kbd>![IPv6 CIDR Block](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pl375u3dynq7hmh5w6dj.png)<kbd>
 
* Tenancy, select Default.
* You can add any more tags you want that can help you identify your VPC (like department and location).

This is what our page should look like at this point. Review your selection to ensure you haven't made any mistakes.

<kbd>![Create VPC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iunu0r914322a4191npq.png)<kbd>
 

* Click Create.

If you have successfully created your VPC you should see a green block confirming that you have successfully created said VPC.
![AWS VPC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jigstashp57t1x3q3n6y.png)
 

### Step 5. Creating Subnets
A subnet is a logical subdivision of an IP network. It is a network inside a network. Subnets make networks more efficient. We can use the subnets in our VPC to represent an availability zone in other to improve the availability of our resource. 

We would create 4 subnets and configure 2 to be private subnets and the other 2 to be public facing subnets. Our private subnets will be inaccessible to the world wide web.

To create subnets, navigate to the left of your AWS management console and select Subnets as shown in the image.
![Subnets](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mc2whu5kocyocl4vawo6.png)

Select "**Create Subnet**"

![AWS Subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ev5lbvr39n9l7v20i6vt.png)

* Select the VPC we just created from the drop down at the provided area. **Be sure to select the correct VPC in order to avoid misconfiguration.**

![AWS VPC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5i46ef4dpn68st2uviki.png)

#### Subnet settings
Remember we are creating 4 subnets, in two availability zones. 2 that we would configure to be public facing and 2 that would remain private.

Ensure to select the IPv4 CIDR blocks that do not overlap.
Below are the IPv4 CIDR blocks we would use for our 4 subnets
* 10.0.0.0/24 (Sample-Public-1A)
* 10.0.1.0/24 (Sample-Public-1B)
* 10.0.2.0/24 (Sample-Private-1A)
* 10.0.3.0/24 (Sample-Private-1B)

**Subnet 1**

* We will name our first subnet "Sample-Public-1A" VPC name specifying public or private  and then AZ (we do not specify region because we are provisioning our VPC to only one region in this tutorial.

* Select the correct AZ in the region your VPC is located.

* Enter the IPv4 CIDR block for Sample-Public-1A, 10.0.0.0/24

* Click "**Add new Subnet**"

![AWS Subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtcq6f5t6lr3f1v2hyvx.png)

**Subnet 2**

* Enter the name "Sample-Public-1B".

* Choose a different AZ zone from subnet 1 but in the same region as your VPC.

* Enter the IPv4 CIDR block for Sample-Public-1A, 10.0.1.0/24

* Click "**Add new Subnet**"

![AWS Subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ubh2nt8hpq4dfxlrby76.png)

**Subnet 3**

* Enter the name "Sample-Private-1A".

* Choose the same AZ zone as subnet 1 in the same region as your VPC.

* Enter the IPv4 CIDR block for Sample-Private-1A, 10.0.2.0/24

* Click "**Add new Subnet**"

![AWS Subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/14yo3tn4hgilhh1tmaj7.png)

**Subnet 4**

* Enter the name "Sample-Private-1B".

* Choose the same AZ zone as subnet 2 in the same region as your VPC.

* Enter the IPv4 CIDR block for Sample-Public-1A, 10.0.3.0/24

* Click "**Create Subnet**"

![AWS Subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5v6uuqvy6ussk61q00m.png)

Confirmation that we have successfully created 4 subnets.
![AWS Subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7b8t0mj0aduelp89t3w7.png)

### Step 6. Creating Internet Gateway.
Merely naming your subnets public and private does not automatically make them public and private, your internet gateway is the trigger. To provide internet access to the subnets in your VPC you need to attach an internet gateway to a Route Table.

We will create our Internet gateway before our route tables so that it is readily available to attach to the route table once it is created.

* To create the Internet gateway navigate to the left hand side of your management console and click on "Internet gateways".
![AWS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qq1ukf65jxxfzvag5hyn.png)

* Click on the "Create Internet Gateway"
![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lx0ileo4ab5l3eg6hu4m.png)

* This one is pretty straight forward. Enter the name (Sample-IGW in this case) and then click "Create Internet Gateway".

![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6099nffnitjt6z5gx0xs.png)

* Time to attach our Internet Gateway to our VPC. Upon successful creation of our Internet Gateway we would get a message informing us about the internet gateway that was just created, we can click on the "attach to VPC" in that message or click on "actions" and select "attach to VPC" from the drop down.

![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50nd9uu1a7rvrpikn3qi.png)
 

* Select our Sample-VPC
![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2r8qi5u201o706t7uut.png)

* Click "Attach Internet Gateway"
![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxx1kl8tzf1zh3bg9xwa.png)

* We have successful attached our Internet Gateway to our VPC.
![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d2knslyy0ehgpjiyyk4u.png)

### Step 7. Configuring our Public Route Tables.
A Route table defines a set of rules called routes, that is used to determine where network traffic is directed in your VPC. Each subnet is always associated with a Route table and Route tables can span across multiple availability zones (subnets).

By default, AWS creates a route table for us whenever we provision a VPC. We would use that as our Public route table and create another one to use as our Private route table. Then associate both route tables with our Public and Private subnets. 

* On the left hand side of your management console, select Route Tables.
![VPC Route Table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxcoizo84wjtyx3dde7s.png)

* We can find the Sample-VPC route table AWS created for us in two ways: 
 1. By using the search function on the top of the page to search, enter the VPC name and search. 
 2. Or by expanding the VPC column on the table and picking out the route table associated with the Sample-VPC.
 3. When we find the route table, we need to rename it so that it is not hard to find consequently. Rename it to "Sample-Public-RT"
 4. Click "Save". 
![AWS Route Tables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mzg46yj54607y9a3bkrz.png)

* Next we edit the subnet association, to associate our public subnets to this route table.
  1. Check the box close to the name of the route table.
  2. Click the "actions" option.
  3. Select "Edit Subnet Associations".
![AWS Subnets](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2044d97m592igc67l7gg.png)

* AWS brings up all subnets belonging to the VPC associated with the route table we are working on.
  1. Check the boxes of all your public subnets, as this is the public route table we would be editing the routes to allow in internet connectivity to the public.
  2. Click "Save Associations"
![Subnet Association](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/or4ddztrtgg94lgto3t0.png)

* Success
![AWS Subnet Association](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kdeqxhmpqbt605v2dakk.png)
 
* Let's configure our route next. With our Sample-Public-RT box still ticked there are two ways we can get to the page to edit our route table.
  1. You could click on "Actions" and select "Edit Route" from the drop down menu.
OR
  2. You could scroll to the bottom of the page, click on the "Routes" column and select the "Edit Route" box at the top right side.

![AWS Edit Route](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/44vr8mljqhmawg13di1m.png)
 
* When the page opens up we see that AWS has configured a default route for us already, leave that as it is. Click on "Add Route".

![AWS Edit Route](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/grtps8gggiv6yyjwkspn.png)

* Under Destination enter 0.0.0.0/0 and to the right, click on the space provided for Target and select Internet gateway.

![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kqnqpx2mwkmivilrmpjh.png)

* As we already attached our Internet gateway to our VPC we would be given that internet gateway to choose (Sample-IGW), select it and click "Save Changes".

![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jsockyqacmxi4kvroi0s.png)

* We have successfully completed this task.

![AWS Internet Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rhuyvdd1p5jnqiwxn6w4.png)

### Step 8. Route Table 
We will speed through this process because you should have a good understanding of the process at this point.
* Click on "Route Tables" on the left and Click on "Create Route Table"

![AWS Route Table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/avkvjfz3z4q9jfdg1rw2.png)

* Enter the name of your route table (Sample-Private-RT in this case), attach it to our Sample-VPC and click "Create Route Table".

![AWS Route Table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dqhmmme1umsg0x88smrc.png)

* Edit subnet association. 
  1. Click on "Actions"
  2. Select "Edit Subnet Association"

![AWS Route Table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9w4cx8la6606alypcxx.png)

* Choose the 2 Private subnets we created earlier and save changes.

![AWS Route Table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qpkyd208hcnmu1yegl3s.png)

**There's more**

The last step is to Edit the route of this route table.

We won't be doing that in this post. What you should know is that you can allow your private subnets access the Internet through a mask while denying traffic back into the subnet directly, therefore ensuring it remains private.

To do this we use a Nat Gateway.

In other post I would be showing you how to add a NAT gateway to your Private route table along with the Elastic IP, how to clean up and all other things beautiful. 

It's been one very long post. Thanks for sticking to the end, hope you learnt something.