0% found this document useful (0 votes)
81 views11 pages

VPC Creation and Configuration Lab

This document provides instructions for a guided lab on creating a virtual private cloud (VPC) using Amazon Virtual Private Cloud (Amazon VPC). The summary is: 1. The lab shows how to build a VPC, deploy resources within it, and create private connections between VPCs. 2. Steps include creating a VPC, public and private subnets, an internet gateway, and route tables. 3. Resources like an application server will be deployed to test the new VPC architecture.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views11 pages

VPC Creation and Configuration Lab

This document provides instructions for a guided lab on creating a virtual private cloud (VPC) using Amazon Virtual Private Cloud (Amazon VPC). The summary is: 1. The lab shows how to build a VPC, deploy resources within it, and create private connections between VPCs. 2. Steps include creating a VPC, public and private subnets, an internet gateway, and route tables. 3. Resources like an application server will be deployed to test the new VPC architecture.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Module 6 - Guided Lab: Creating a Virtual Private Cloud

Module 6 - Guided Lab: Creating a Virtual

Private Cloud
Lab overview and objectives
Traditional networking is difficult. It involves equipment, cabling, complex configurations,
and specialist skills. Amazon Virtual Private Cloud (Amazon VPC) hides the complexity, and
simplifies the deployment of secure private networks.

This lab shows you how to build your own virtual private cloud (VPC), deploy resources, and
create private peering connections between VPCs.

After completing this lab, you should be able to:

 Deploy a VPC
 Create an internet gateway and attach it to the VPC
 Create a public subnet
 Create private subnet
 Create an application server to test the VPC

Duration
This lab will require approximately 30 minutes to complete.

AWS service restrictions


In this lab environment, access to AWS services and service actions might be restricted to the
ones that are needed to complete the lab instructions. You might encounter errors if you
attempt to access other services or perform actions beyond the ones that are described in this
lab.

At the end of this lab, your architecture will look like the following example:
Accessing the AWS Management Console

1. At the top of these instructions, choose Start Lab to launch your lab.

A Start Lab panel opens, and it displays the lab status.

Tip: If you need more time to complete the lab, restart the timer for the environment
by choosing the Start Lab button again.
2. Wait until the Start Lab panel displays the message Lab status: ready, then close the
panel by choosing the X.

3. At the top of these instructions, choose AWS.

This action opens the AWS Management Console in a new browser tab. The system
automatically logs you in.

Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with the message that your browser is preventing the site from opening pop-
up windows. Choose the banner or icon, and then choose Allow pop-ups.

4. Arrange the AWS Management Console tab so that it displays alongside these
instructions. Ideally, you will have both browser tabs open at the same time so that
you can follow the lab steps more easily.

Do not change the Region unless specifically instructed to do so.

Task 1: Creating a VPC


You will begin by using Amazon VPC to create a new virtual private cloud, or VPC.

A VPC is a virtual network that is dedicated to your Amazon Web Services (AWS) account.
It is logically isolated from other virtual networks in the AWS Cloud. You can launch AWS
resources, such as Amazon Elastic Compute Cloud (Amazon EC2) instances, into the VPC.
You can configure the VPC by modifying its IP address range, and create subnets. You can
also configure route tables, network gateways, and security settings.

5. In the search box to the right of Services, search for and choose VPC to open the
VPC console.

The VPC console provides a wizard that can automatically create several VPC
architectures. However, in this lab, you will create the VPC components manually.

6. In the left navigation pane, choose Your VPCs.

A default VPC is provided so that you can launch resources as soon as you start using
AWS. There is also a Shared VPC that you will use later in the lab. However, you
will now create your own Lab VPC.
The VPC will have a Classless Inter-Domain Routing (CIDR) range of [Link]/16,
which includes all IP address that start with 10.0.x.x. It contains over 65,000
addresses. You will later divide the addresses into separate subnets.

7. Choose Create VPC and configure these settings:


o Name tag: Lab VPC
o IPv4 CIDR block: [Link]/16
o Choose Create VPC

A message that you successfully created the VPC appears.

8. In the lower half of the page, choose the Tags tab.

Tags are useful for identifying resources. For example, you can use a tag to identify
cost centers or different environments (such as development, test, or production).

9. Choose Actions and select Edit VPC settings.

This option assigns a friendly Domain Name System (DNS) name to EC2 instances in
the VPC, such as:

[Link]

10. Select Enable DNS hostname and then choose Save

Any EC2 instances that are launched into the VPC will now automatically receive a
DNS hostname. You can also add a more meaningful DNS name (such as
[Link]) later by using Amazon Route 53.

Task 2: Creating subnets


A subnet is a subrange of IP addresses in the VPC. AWS resources can be launched into a
specified subnet. Use a public subnet for resources that must be connected to the internet, and
use a private subnet for resources that must remain isolated from the internet.

In this task, you will create a public subnet and a private subnet:

Creating a public subnet


The public subnet will be used for internet-facing resources.

11. In the left navigation pane, choose Subnets.

12. Choose Create subnet and configure these settings:


o VPC ID: Lab VPC
o Subnet name: Public Subnet
o Availability Zone: Select the first Availability Zone in the list (do not keep
the No Preference default)
o IPv4 CIDR block: [Link]/24
o Choose Create subnet

The VPC has a CIDR block of [Link]/16, which includes all 10.0.x.x IP
addresses. The subnet you just created has a CIDR block of [Link]/24, which
includes all 10.0.0.x IP addresses. They might look similar, but the subnet is
smaller than the VPC because of the /24 in the CIDR range.

You will now configure the subnet to automatically assign a public IP address
for all instances that are launched in it.

13.
14. Select Public Subnet.

15. Choose Actions and select Edit subnet settings, then:


o Select Enable auto-assign public IPv4 address
o Choose Save

Though this subnet is named Public Subnet, it is not yet public. A public
subnet must have an internet gateway, which you attach in the next task.

Creating a private subnet

The private subnet will be used for resources that must remain isolated from the internet.

15. Use what you just learned to create another subnet with these settings:
o VPC ID: Lab VPC
o Subnet name: Private Subnet
o Availability Zone: Select the first Availability Zone in the list (do not keep
the No Preference default)
o IPv4 CIDR block: [Link]/23

The CIDR block of [Link]/23 includes all IP addresses that start with
10.0.2.x and 10.0.3.x. This is twice as large as the public subnet because most
resources should be kept private, unless they specifically must be accessible
from the internet.

Your VPC now has two subnets. However, the public subnet is totally isolated
and cannot communicate with resources outside the VPC. You will next
configure the public subnet to connect to the internet via an internet gateway.

Task 3: Creating an internet gateway


An internet gateway is a horizontally scaled, redundant, and highly available VPC
component. It allows communication between the instances in a VPC and the internet. It
imposes no availability risks or bandwidth constraints on network traffic.

An internet gateway serves two purposes:

 To provide a target in route tables that connects to the internet


 To perform network address translation (NAT) for instances that were assigned public
IPv4 addresses

In this task, you will create an internet gateway so that internet traffic can access the public
subnet.

16. In the left navigation pane, choose Internet Gateways.

17. Choose Create internet gateway and configure these settings:


o Name tag: Lab IGW
o Choose Create internet gateway

You can now attach the internet gateway to your Lab VPC.

18. Choose Actions then Attach to VPC, and configure these settings:
o Available VPCs: Place you cursor in the search box, then select Lab VPC
o Choose Attach internet gateway

This action will attach the internet gateway to your Lab VPC. Though you
created an internet gateway and attached it to your VPC, you must also
configure the public subnet route table so it uses the internet gateway.
Task 4: Configuring route tables
A route table contains a set of rules, called routes, that are used to determine where network
traffic is directed. Each subnet in a VPC must be associated with a route table because the
table controls the routing for the subnet. A subnet can only be associated with one route table
at a time, but you can associate multiple subnets with the same route table.

To use an internet gateway, a subnet's route table must contain a route that directs internet-
bound traffic to the internet gateway. If a subnet is associated with a route table that has a
route to an internet gateway, it is known as a public subnet.

In this task, you will:

 Create a public route table for internet-bound traffic


 Add a route to the route table to direct internet-bound traffic to the internet gateway
 Associate the public subnet with the new route table

19. In the left navigation pane, choose Route Tables.

Several route tables are displayed, but there is only one route table associated with
Lab VPC. This route table routes traffic locally, so it is called a private route table.

20. Scroll to the right so that you can see the VPC column, then expand the width of the
column so that you can see which one is used by Lab VPC.

21. Scroll back to the left and select the route table that shows Lab VPC.

22. In the Name column, choose then enter the name Private Route Table and
choose .

23. In the lower half of the page, choose the Routes tab.

There is only one route. It shows that all traffic that is destined for [Link]/16 (which
is the range of the Lab VPC) will be routed locally. This route allows all subnets in a
VPC to communicate with each other.
You will now create a new public route table to send public traffic to the internet
gateway.

24. Choose Create route table and configure these settings:


o Name: Public Route Table
o VPC: Lab VPC
o Choose Create route table

25. In the Routes tab, choose Edit routes

You will now add a route to direct internet-bound traffic ([Link]/0) to the internet
gateway.

26. Choose Add route then configure these settings:


o Destination: [Link]/0
o Target: Select Internet Gateway and then, from the list, select Lab IGW
o Choose Save changes

The last step is to associate this new route table with the public subnet.

27. Choose the Subnet associations tab.

28. Choose Edit subnet associations

29. Select the row with Public Subnet.

30. Choose Save associations

The public subnet is now public because it has a route table entry that sends traffic to
the internet via the internet gateway.

To summarize, you can create a public subnet by following these steps:

o Create an internet gateway


o Create a route table
o Add a route to the route table that directs [Link]/0 traffic to the internet
gateway
o Associate the route table with a subnet, which thus becomes a public subnet
Task 5: Creating a security group for the application
server
A security group acts as a virtual firewall for instances to control inbound and outbound
traffic. Security groups operate at the level of the elastic network interface for the instance.
Security groups do not operate at the subnet level. Thus, each instance can have its own
firewall that controls traffic. If you do not specify a particular security group at launch time,
the instance is automatically assigned to the default security group for the VPC.

In this task, you will create a security group that allows users to access your application
server via HTTP.

31. In the left navigation pane, choose Security Groups.

32. Choose Create security group and configure these settings:


o Security group name: App-SG
o Description: Allow HTTP traffic
o VPC: select the X to clear the default selection, then choose Lab VPC
o Scroll to the bottom and choose Create security group

33. Verify the Inbound rules tab is selected below.

The settings for Inbound Rules determine what traffic is permitted to reach the
instance. You will configure it to permit HTTP (port 80) traffic that comes from
anywhere on the internet ([Link]/0).

34. Choose Edit inbound rules

35. Choose Add rule and then configure these settings:


o Type: HTTP
o Source type: Anywhere-IPv4
o Description: Allow web access
o Choose Save rules

You use this App-SG in the next task.


Task 6: Launching an application server in the public
subnet
To test that your VPC is correctly configured, you will now launch an EC2 instance into the
public subnet. You will also confirm that you can access the EC2 instance from the internet.

36. In the search box to the right of Services, search for and choose EC2 to open the EC2
console.

37. From the Launch instance menu, choose Launch Instance. Configure these options:
o Name: App Server
o In the list of available Quick Start AMIs, keep the default Amazon Linux
selected. Also keep the specific default Amazon Linux 2023 AMI selected.
o In the Instance type panel, keep the default [Link] selected.
o From the Key pair name menu, select vockey.
o Next to Network settings, choose Edit, then configure:
 Network: Lab VPC
 Subnet: Public Subnet
o Under Firewall (security groups), choose Select an existing security group.
 For Common security groups, select App-SG.
o In the Configure storage section, keep the default settings.
o Expand the Advanced details panel.
o IAM instance profile: Inventory-App-Role
o For the Metadata version set to V1 and V2 (token optional).
o Scroll to the bottom of the page and then copy and paste the code shown
below into the User data box:

#!/bin/bash
# Install Apache Web Server and PHP
dnf install -y httpd wget php-fpm php-mysqli php-json php php-
devel
dnf install -y mariadb105-server
# Download Lab files
wget
[Link]
200-ACACAD-20-EN/mod6-guided/scripts/[Link]
unzip [Link] -d /var/www/html/
# Download and install the AWS SDK for PHP
wget
[Link]
.zip
unzip aws -d /var/www/html
# Turn on web server
systemctl enable httpd
systemctl start httpd

o At the bottom of the Summary panel on the right side of the screen choose
Launch instance
You will see a Success message.

38. Choose View all instances

39. Wait until the App Server instance shows 2/2 checks passed in the Status check
column.

This may take a few minutes. Choose the refresh icon at the top of the page every 30
seconds or so to more quickly become aware of the latest status of the instan

Common questions

Powered by AI

A subnet's status as public or private is determined by its association with a route table. For a subnet to be considered public, its route table must contain a route that directs internet-bound traffic to an internet gateway . This configuration allows instances within the subnet to communicate with the internet. Conversely, subnets without such a route in their associated route table remain private, as there is no direct path for internet-bound traffic .

To make a subnet public in an AWS VPC, the following steps are required: create an internet gateway, create a route table, add a route to the route table directing 0.0.0.0/0 traffic to the internet gateway, and associate the route table with the subnet . These steps ensure that the subnet has a route allowing traffic to flow to and from the internet, thus designating it as a public subnet .

To launch an application server in an AWS public subnet, first open the EC2 console and choose to launch an instance. Select a name, the default Amazon Linux AMI, and instance type t2.micro. Choose a key pair and edit network settings to select the Lab VPC and Public Subnet. Under firewall settings, select the security group (e.g., App-SG) for HTTP access. Configure instance details like IAM roles and user data scripts for server setup, then launch the instance and verify connectivity .

Configuring a route to the internet gateway is essential for public subnets because it enables internet-bound traffic to be directed to an internet gateway, thus allowing instances to communicate with external networks . Omitting this step would mean that even if an internet gateway is attached, the subnet would remain isolated from the internet as there would be no route guiding traffic to the gateway, impacting applications that require external network access .

Enabling auto-assign public IP addresses ensures that instances launched in the subnet will automatically receive a public IP address, which is essential for internet connectivity . This configuration is vital for resources in a public subnet that need to be accessible from the internet, such as servers hosting web applications. Without auto-assigned public IPs, instances would not be reachable from the outside internet, limiting their functionality to private network interactions only .

A larger CIDR block might be used for a private subnet to accommodate more resources within the VPC that do not require internet access. Since private subnets are designed for resources that must remain isolated from the internet, such as databases and internal servers, they often require more IP addresses to handle potentially larger and diverse internal infrastructure . This ensures the VPC can scale internally without exhausting IP addresses, while minimizing exposure to the internet .

Assigning a CIDR range to a VPC establishes the IP address space within which all subnets and resources in the VPC must exist. It defines the network boundary, allowing for the logical allocation of IP addresses to subnets. When creating subnets, they are assigned smaller CIDR blocks within the VPC's overall range, ensuring interconnected and non-overlapping address spaces for resource isolation and routing . This organization is fundamental for the functioning and management of network traffic within the VPC .

Assigning DNS hostnames is crucial for easy identification and access to EC2 instances. It allows instances to have a recognizable domain name rather than just an IP address, facilitating communication and management . DNS hostname assignment is enabled by editing VPC settings and selecting 'Enable DNS hostname' . This automatically provides instances with a DNS name, allowing users to later configure more meaningful domain names using services like Amazon Route 53 .

Amazon Virtual Private Cloud (Amazon VPC) simplifies the deployment of secure private networks by eliminating the complexities associated with traditional networking, such as equipment, cabling, complex configurations, and the need for specialist skills . Unlike traditional networking, which often requires manual and complicated setups, Amazon VPC allows users to easily deploy and configure private networks with logical isolation from other virtual networks in the AWS Cloud . This abstraction of complexity makes it accessible for individuals without deep networking expertise while providing scalability and integration with AWS services .

A security group in an AWS VPC acts as a virtual firewall at the instance level, controlling inbound and outbound traffic specifically to each EC2 instance . Unlike subnet-level firewalls that apply broad rules across all instances within a subnet, security groups provide granular security control, allowing different rules for different instances . They operate at the elastic network interface level, meaning each instance can be individually configured for security, allowing for fine-grained access policies .

Module 6 - Guided Lab: Creating a Virtual 
Private Cloud
Lab overview and objectives
Traditional networking is difficult. It
 
Accessing the AWS Management Console
 
1. At the top of these instructions, choose Start Lab to launch your lab.
A Start La
2. Wait until the Start Lab panel displays the message Lab status: ready, then close the 
panel by choosing the X.
 
3. At th
The VPC will have a Classless Inter-Domain Routing (CIDR) range of 10.0.0.0/16, 
which includes all IP address that start wit
The public subnet will be used for internet-facing resources.
 
11. In the left navigation pane, choose Subnets.
 
12. Choose
o
IPv4 CIDR block: 10.0.2.0/23
The CIDR block of 10.0.2.0/23 includes all IP addresses that start with 
10.0.2.x and 10.0.3.x
 
Task 4: Configuring route tables
A route table contains a set of rules, called routes, that are used to determine where net
You will now create a new public route table to send public traffic to the internet 
gateway.
 
24. Choose Create route table
 
Task 5: Creating a security group for the application 
server
A security group acts as a virtual firewall for instances to
Task 6: Launching an application server in the public 
subnet
To test that your VPC is correctly configured, you will now lau

You might also like