Cloud Architecting Lab Manual
Cloud Architecting Lab Manual
LIST OF PROGRAMS
4.Decoupling Infrastructure
8.Sandbox
You can easily host a static website on Amazon Simple Storage Service (Amazon
S3) by uploading the content and making it publicly accessible. No servers are
needed, and you can use Amazon S3 to store and retrieve any amount of data at
any time, from anywhere on the web.
##Duration
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.
Thus, for this lab, you will use a bucket name that includes a random
number, such as: website-123
o Verify the AWS Region is set to us-east-1 (if it is not, choose the us-
east-1 Region)
4. In the Object Ownership section, select ACLs enabled, then verify
Bucket owner preferred is selected.
5. Clear Block all public access, then select the box that states I
acknowledge that the current settings may result in this bucket and
the objects within becoming public.
6. Choose Create bucket.
● Key: Department
● Value: Marketing
Next, you will configure the bucket for static website hosting.
2. Stay in the Properties console.
3. Scroll to the Static website hosting panel.
4. Choose Edit
5. Configure the following settings:
o Static web hosting: Enable
o Hosting type: Host a static website
o Index document: index.html
▪ Note: You must enter this value, even though it is already
displayed.
o Error document: error.html
6. Choose Save changes
7. In the Static website hosting panel, choose the link under Bucket
website endpoint.
You will receive a 403 Forbidden message because the bucket permissions
have not been configured yet. Keep this tab open in your web browser so
that you can return to it later.
1. Right-click each of these links and download the files to your computer:
Ensure that each file keeps the same file name, including the extension.
o index.html
o script.js
o style.css
2. Return to the Amazon S3 console and in the website-<123> bucket you
created earlier, choose the Objects tab.
3. Choose Upload
4. Choose Add files
5. Locate and select the three files that you downloaded.
6. If prompted, choose I acknowledge that existing objects with the same
name will be overwritten.
7. Choose Upload
In this task, you will make the uploaded objects publicly accessible.
1. Return to the browser tab that showed the 403 Forbidden message.
2. Refresh the webpage.
If you accidentally closed this tab, go to the Properties tab, and in the
Static website hosting panel choose the Endpoint link again.
Analysis: This response is expected! This message indicates that your static
website is being hosted by Amazon S3, but that the content is private.
You can make Amazon S3 objects public through two different ways:
3. Return to the web browser tab with the Amazon S3 console (but do not
close the website tab).
4. Select all three objects.
5. In the Actions menu, choose Make public via ACL.
7. Return to the web browser tab that has the 403 Forbidden message.
8. Refresh the webpage.
You should now see the static website that is being hosted by Amazon S3.
Amazon S3 is an object storage service, so you must upload the whole file. This
action replaces the existing object in your bucket. You cannot edit the contents
of an object—instead, the whole object must be replaced.
1. On your computer, load the index.html file into a text editor (for
example, Notepad or TextEdit).
2. Find the text Served from Amazon S3 and replace it with Created by
<YOUR-NAME>, substituting your name for <YOUR-NAME> (for example,
Created by Jane).
3. Save the file.
4. Return to the Amazon S3 console and upload the index.html file that you
just edited.
5. Select index.html and use the Actions menu to choose the Make public
via ACL option again.
6. Return to the web browser tab with the static website and refresh the
page.
Lab complete
Congratulations! You have completed the lab.
1. Choose End Lab at the top of this page, and then select Yes to confirm that
you want to end the lab.
A panel indicates that DELETE has been initiated... You may close this
message box now.
objectives
This lab introduces you to Amazon Elastic File System (Amazon EFS) by using the
AWS Management Console.
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.
This action opens the AWS Management Console in a new browser tab.
The system automatically logs you in.
The security group that you associate with a mount target must allow inbound
access for TCP on port 2049 for Network File System (NFS). This is the security group
that you will now create, configure, and attach to your EFS mount targets.
● Type: NFS
● Source:
o Custom
o In the Custom box, paste the security group's Security group ID that you copied
to your text editor
● Choose Create security group.
10.On Step 1:
o Uncheck Enable automatic backups.
o Lifecycle management: Select None
o In the Tags section, configure:
▪ Key: Name
▪ Value: My First EFS File System
10.Choose Next
Your mount targets should look like the following example. The diagram shows
two mount targets in the Lab VPC that use the EFS Mount Target security
group. In this lab, you should be using the Lab VPC.
18.Choose Next
19.On Step 3, choose Next
20.On Step 4:
● Review your configuration.
● Choose Create
A Credentials window opens.
● Choose Session
● Host Name (or IP address): Paste the EC2PublicIP for the instance you noted
earlier
o Alternatively, return to the Amazon EC2 console and choose Instances
o Select the instance you want to connect to
o In the Description tab, copy the IPv4 Public IP
● Back in PuTTY, in the Connection list, expand SSH
● Choose Auth (but don't expand it)
● Choose Browse
● Choose Open again
A Credentials window opens.
Because you are using a key pair for authentication, you are not prompted for a
password.
Task 4: Creating a new directory and
mounting the EFS file system
Amazon EFS supports the NFSv4.1 and NFSv4.0 protocols when it mounts your
file systems on EC2 instances. Though NFSv4.0 is supported, we recommend
that you use NFSv4.1. When you mount your EFS file system on your EC2
instance, you must also use an NFS client that supports your chosen NFSv4
protocol. The EC2 instance that was launched as a part of this lab includes an
NFSv4.1 client, which is already installed on it.
47.In your Linux SSH session, mount your Amazon EFS file system by:
o Pasting the command
o Pressing ENTER
48.Get a full summary of the available and used disk space usage by entering:
sudo df -hT
df -hT
You might need to wait 2–3 minutes and refresh the screen several times before
all available metrics, including PermittedThroughput, calculate and populate.
55.On the graph, choose and drag around the data line. If you do not see the line
graph, adjust the time range of the graph to display the period during which you
ran the fio command.
56.Pause your pointer on the data line in the graph. The value should be 105M.
56.The throughput of Amazon EFS scales as the file system grows. File-based
workloads are typically spiky. They drive high levels of throughput for short
periods of time, and low levels of throughput the rest of the time. Because of
this behavior, Amazon EFS is designed to burst to high throughput levels for
periods of time. All file systems, regardless of size, can burst to 100 MiB/s of
throughput. For more information about performance characteristics of your
EFS file system, see the official Amazon Elastic File System documentation.
If you do not see DataWriteIOBytes in the list of metrics, use the File System
Metrics search to find it.
62.Pause your pointer on the peak of the line graph. Take this number (in bytes)
and divide it by the duration in seconds (60 seconds). The result gives you the
write throughput (B/s) of your file system during your test.
The throughput that is available to a file system scales as a file system grows. All file
systems deliver a consistent baseline performance of 50 MiB/s per TiB of storage. Also,
all file systems (regardless of size) can burst to 100 MiB/s. File systems that are larger
than 1T B can burst to 100 MiB/s per TiB of storage. As you add data to your file system,
the maximum throughput that is available to the file system scales linearly and
automatically with your storage.
EX:3
At the end of this lab, your architecture will look like the following example:
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.
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.
Windows Users: Use Chrome or Firefox as your web browser for this lab. The
lab instructions are not compatible with Internet Explorer because of a
difference in the Amazon RDS console.
5. In the search box to the right of Services, search for and choose RDS to open
the RDS console.
The options include several use cases, ranging from enterprise-class databases
to Dev/Test systems. In the options, you might notice Amazon Aurora. Aurora is
a MySQL-compatible system that was re-architected for the cloud. If your
company uses large-scale MySQL or PostgreSQL databases, Aurora can provide
enhanced performance.
9.
10.Under the Settings section, configure these options:
o DB instance identifier: inventory-db
o Username: admin
o Password: lab-password
o Confirm password: lab-password
Note: This is the logical name of the database that will be used by the
application.
Feel free to review the many other options displayed on the page, but leave
them set to their default values. Options include automatic backups, the ability
to export log files, and automatic version upgrades. The ability to activate these
features through check boxes demonstrates the power of using a fully managed
database solution instead of installing, backing up, and maintaining the database
yourself.
You should receive a message indicating that your database is being created.
Before you continue to the next task, the database instance status must be
Available. This process might take several minutes.
14.In the search box to the right of Services, search for and choose EC2 to open the
EC2 console.
In the center pane, there should be a running instance that is named App
Server.
17.In the Details tab, copy the Public IPv4 address to your clipboard.
Tip: If you hover over the IP address, a copy icon appears. To copy the displayed
value, choose the icon.
18.Open a new web browser tab, paste the IP address into the address bar, and
then press ENTER.
The web application should appear. It does not display much information
because the application is not yet connected to the database.
19.Choose Settings.
You can now configure the application to use the RDS DB instance you created
earlier. You will first retrieve the Database Endpoint so that the application
knows how to connect to a database.
20.Return to the AWS Management Console, but do not close the application tab.
(You will return to it soon.
21.In the Services search box, search for and choose RDS to open the RDS console.
22.In the left navigation pane, choose Databases.
23.Choose inventory-db.
24.Scroll to the Connectivity & Security section and copy the Endpoint to your
clipboard.
25.Return to the browser tab with the Inventory application, and enter these values:
o Endpoint: Paste the endpoint you copied earlier
o Database: inventory
o Username: admin
o Password: lab-password
o Choose Save
The application will now connect to the database, load some initial data, and
display information.
26.Add inventory, edit, and delete inventory information by using the web
application.
The inventory information is stored in the Amazon RDS MySQL database that
you created earlier in the lab. This means that any failure in the application
server will not lose any data. It also means that multiple application servers can
access the same data.
27.Insert new records into the table. Ensure that the table has 5 or more inventory
records before submitting your work.
You have now successfully launched the application and connected it to the
database!
Optional: You can access the saved parameters in the Systems Manager
console, under Parameter Store.
29.If the results don't display after a couple of minutes, return to the top of these
instructions and choose Grades
Tip: You can submit your work multiple times. After you change your work,
choose Submit again. Your last submission is what will be recorded for this lab.
30.To find detailed feedback on your work, choose Details followed by View
Submission Report.
Lab complete
Congratulations! You have completed the lab.
31.Choose End Lab at the top of this page, and then select Yes to confirm that you
want to end the lab.
A panel should appear with this message: DELETE has been initiated... You may
close this message box now.
Ex 4 : 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.
● Deploy a VPC
Duration
This lab will require approximately 30 minutes to complete.
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.
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.
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.
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.
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 10.0.0.0/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.
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).
This option assigns a friendly Domain Name System (DNS) name to EC2 instances
in the VPC, such as:
ec2-52-42-133-255.us-west-2.compute.amazonaws.com
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.
o Availability Zone: Select the first Availability Zone in the list (do not keep the No
Preference default)
The VPC has a CIDR block of 10.0.0.0/16, which includes all 10.0.x.x IP addresses.
The subnet you just created has a CIDR block of 10.0.0.0/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.
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 Availability Zone: Select the first Availability Zone in the list (do not keep the No
Preference default)
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. 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.
In this task, you will create an internet gateway so that internet traffic can access
the public subnet.
o Available VPCs: Place you cursor in the search box, then select Lab VPC
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.
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.
● Add a route to the route table to direct internet-bound traffic to the internet
gateway
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 10.0.0.0/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.
You will now add a route to direct internet-bound traffic (0.0.0.0/0) to the
internet gateway.
27.Choose the Subnet associations tab.
The public subnet is now public because it has a route table entry that sends
traffic to the internet via the internet gateway.
In this task, you will create a security group that allows users to access your
application server via HTTP.
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 (0.0.0.0/0).
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 In the list of available Quick Start AMIs, keep the default Amazon Linux selected.
Also keep the specific default Amazon Linux 2 AMI (HVM) selected.
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
yum install -y httpd mysql
amazon-linux-extras install -y php7.2
# Download Lab files
wget https://aws-tc-largeobjects.s3-us-west-2.amazonaws.com/ILT-TF-200-ACACAD-20-EN/mod6-guided/
scripts/inventory-app.zip
unzip inventory-app.zip -d /var/www/html/
# Download and install the AWS SDK for PHP
wget https://github.com/aws/aws-sdk-php/releases/download/3.62.3/aws.zip
unzip aws -d /var/www/html
# Turn on web server
chkconfig httpd on
service httpd start
o At the bottom of the Summary panel on the right side of the screen choose
Launch instance
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
instance.
41.Copy the Public IPv4 DNS value shown in the Details tab at the bottom of the
page.
If you configured the VPC correctly, the Inventory application and this message
should appear: Please configure Settings to connect to database. You have not
configured any database settings yet, but the appearance of the Inventory
application demonstrates that the public subnet was correctly configured.
If the Inventory application does not appear, wait 60 seconds and refresh the
page to try again. It can take a couple of minutes for the EC2 instance to boot
and run the script that installs the software.
44.If the results don't display after a minute, return to the top of these instructions
and choose Grades
Tip: You can submit your work multiple times. After you change your work,
choose Submit again. Your last submission is what will be recorded for this lab.
45.To find detailed feedback on your work, choose Details followed by View
Submission Report.
Lab complete
Congratulations! You have completed the lab.
46.Choose End Lab at the top of this page, and then select Yes to confirm that you
want to end the lab.
A panel indicates that DELETE has been initiated... You may close this message box
now.
Duration
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.
Two VPCs are provided as part of this lab: Lab VPC and Shared VPC. Lab VPC has
an Inventory application that runs on an Amazon Elastic Compute Cloud
(Amazon EC2) instance in a public subnet. Shared VPC has a database instance
that runs in a private subnet.
5. In the AWS Management Console, on the Services menu, choose VPC.
6. In the left navigation pane, choose Peering Connections.
7. Choose Create Peering Connection and configure:
o Peering connection name tag: Lab-Peer
o VPC (Requester): Lab VPC
o VPC (Accepter): Shared VPC
o Choose Create Peering Connection then choose OK
When a VPC peering connection is created, the target VPC must accept the
connection request. The target VPC must accept the request because it might be
owned by a different account. Alternatively, the user that creates the peering
connection might not have permission to accept the connection request for the
target VPC. However, in this lab, you will accept the connection yourself.
8. Select Lab-Peer.
9. Choose Actions then select Accept Request, and choose Yes, Accept to accept
the request.
10.In the pop-up box, choose Close.
You will now configure the reverse flow for traffic that comes from Shared
VPC and goes to Lab VPC.
14.Select Shared-VPC Route Table. If the check boxes for any other route tables
are selected, clear them.
This route table is for Shared VPC. You will now configure it to send traffic to the
peering connection if the destination IP address falls in the range of Lab VPC.
You should see the Inventory application and the following message: "Please
configure settings to connect to database"
20.Choose Settings and configure:
o Endpoint: Paste the database endpoint. To find this endpoint, select Details.
Next to AWS, choose Show. Then, copy the Endpoint.
o Database: inventory
o Username: admin
o Password: lab-password
o Choose Save
This step confirms that the VPC peering connection was established
because Shared VPC does not have an internet gateway. The only way to access
the database is through the VPC peering connection.
Lab complete
Congratulations! You have completed the lab.
24.Choose End Lab at the top of this page, and then select Yes to confirm that you
want to end the lab.
A panel indicates that DELETE has been initiated... You may close this message box
now.
environment. He should
also be able to see all
Amazon EC2 resources
and configuration
details, but he shouldn't
be able to modify them.
● Create IAM users and IAM groups, and associate IAM policies with IAM groups
● Indicate how limited access rights affect what resources IAM users can access and what
actions they can take
● Use AWS managed IAM policies to modify user access rights and observe the results
● Use the IAM Policy Simulator to observe the scope of the access that is granted by
different policies
● Access the IAM Access Advisor to observe what access rights different users are taking
advantage of
● Create custom IAM policies by using the visual editor
Tip: If you ever need more time to complete the lab that is displayed on the
timer, choose the Start Lab button again to restart the timer for the environment.
Doing so will not delete resources you have created.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS.
This opens the AWS Management Console in a new browser tab. The system will
automatically log 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.
Note: You can also uncheck the box next to Terminal at the top of the screen, to
hide it from view.
As Sofía, you will create an IAM group and assign AWS managed policies to the
group. You will then create a new IAM user, and add that user as a member of
the group. Next, you will create an AWS Cloud9 environment on the existing EC2
instance where the development version of the café web application runs.
Finally, you will share the development environment with the new user.
Note: The user you are logged in as displays in the upper-right area of the webpage.
It should currently indicate that you are logged in as a voclabs user. In this lab,
imagine that the voclabs user is Sofía.
6. Create an IAM group named AppDevelopers, and attach the following IAM policies
to it:
o AmazonEC2ReadOnlyAccess
o AWSCloud9EnvironmentMember
7. Create an IAM user and add the user to the AppDevelopers group.
o In the Success screen, you can optionally choose Download .csv and save the
file to your computer
o Choose Close
8. While still logged in as the voclabs user (Sofía), connect to the AWS Cloud9 IDE
and set up the café web application.
o Open the AWS Cloud9 service page and under DEVCafeServer, choose Open
IDE.
The AWS Cloud9 IDE that run on an EC2 instance should now display.
o In the Bash terminal window at the bottom of the screen, paste and run these
three commands:
wget https://aws-tc-largeobjects.s3-us-west-2.amazonaws.com/ILT-TF-200-ACACAD-20-EN/mod8-challenge/
install-cafe-app.sh
chmod +x install-cafe-app.sh
./install-cafe-app.sh
Note: You do not need to wait for the script to finish running. Instead, go to the
next step.
o In the Share this environment panel, under Invite Members, enterNikhil and
choose Invite.
Important: Close the AWS Cloud9 IDE browser tab, but leave open at least one
other browser tab where you are logged into the AWS Management Console as
the voclabs user (Sofía).
● For example, if you are using Chrome, choose File > New Incognito Window. If you are
using Firefox, choose File > New Private Window.
● Alternatively, use a different browser (for example, if you used Chrome to complete
Task 1, use Firefox, Edge, or Safari for Task 2).
o In the browser tab where you are logged in as the voclabs user (Sofía), open the
IAM console, choose Users, and then choose Nikhil.
o Choose the Security credentials tab, and in the Sign-in credentials section,
copy the Console sign-in link.
o Paste the link into an incognito or private browser tab (or other browser as
explained in the previous tip).
o In the Sign in as IAM user screen, enter Nikhil's credentials and choose Sign in.
▪ Password: @ppD3veloper2020!
11.Open the Amazon EC2 console and in a browser tab, load the café web
application.
o Verify that you are in the correct Region (for example, N. Virginia) and switch to
it, if necessary.
o You should be able to view all the details of the EC2 instances.
The café website should display. Keep this browser tab open for later in the lab.
12.Test your Amazon EC2 access further by attempting to restart the web server.
Tip: To find the Reboot option, select the instance and look in the Actions
menu.
o Above these instructions, choose the Details menu, and then choose Show.
o At the bottom of the page, choose the Access the multiple choice questions
link.
The questions should load in a new browser tab.
14.In the webpage that you just opened, answer the first two questions:
o Question 1: What happened when Nikhil tried to reboot the EC2 instance?
o Question 2: Which IAM policy allowed Nikhil to access the AWS Cloud9
environment?
Note: Leave the questions webpage open in your browser tab. You will return to
it later in this lab.
Tip: Remember that you can see which user you are using in the top-right area
of the browser interface.
16.Browse to the AWS Cloud9 console, and connect to the AWS Cloud9 IDE on the
DEVCafeServer EC2 instance.
o On the left, expand the menu by choosing the (menu icon), choose Shared with
you, and verify that the DEVCafeServer environment is available.
17.On the development instance of the café website, modify the main heading for
the webpage.
o Open the main webpage in the editor by going to the file browser, navigating to
the DEVCafeServer/www/html/cafe directory, and double-clicking index.php.
Notice that, while acting as Nikhil, you changed the main heading of the
webpage in the development environment.
19.Return to the browser tab with the multiple-choice questions for this lab, and
answer the following question.
o Question 3: Which message was displayed on the Menu page of the café
website's development instance?
Nikhil recalls that the database connection parameters are stored in the AWS
Systems Manager Parameter Store.
o From the menu on the left, choose Application Management > Parameter
Store.
21.Return to the browser tab with the multiple-choice questions for this lab, and
answer the following question.
o Question 4: Which message was displayed when Nikhil opened the Systems Manager
Parameter Store page in the console?
Nikhil alerts Sofía about the issue on the development server that's preventing
him from improving the café web application. Sofía is concerned. She asks Nikhil
to check if the production version of the website is experiencing the same issue.
22.As Nikhil, verify that the production café web application is working correctly.
o Open the Amazon EC2 console and copy the IPv4 Public IP address of the
PRODCafeServer instance.
o In a new browser window, load http://prod-public-ip-address/cafe/menu.php.
o Does the webpage display correctly, and can you place orders?
Sofía decides that she will ask Olivia to fix the issue. However, Sofía must first
define the AWS account access rights for database administrators. She must
then create an IAM user resource so that Olivia can log in to the account.
23.Back in the browser where you are logged in as the voclabs user (Sofía), create
an IAM group named DBAdministrators, with the following permissions:
o AmazonRDSReadOnlyAccess
o AmazonSSMFullAccess
Note: In a real-world situation, Sofia would need to grant more than simply read
only access to RDS to her database administrators. However, the permissions in
this lab environment, do not allow you to attach the AmazonRDSFullAccess
policy. Instead, for this lab, you should use the AmazonRDSReadOnlyAccess
policy as a substitute.
24.Create an IAM user that's named Olivia with access to the AWS Management
Console.
25. Add Olivia to the DBAdministrators group.
Tip: Use the incognito session, private session, or other browser type that you
used to log in as Nikhil. To do this:
The Sign in as IAM user screen should display, with the Account ID pre-
populated.
Note: If the login screen doesn't display the account ID, return to the browser
tab where you are still logged in as the voclabs (Sofía) user. In the IAM console,
choose Users and choose Olivia. Choose the Security credentials tab. In the
Sign-in credentials section, copy the Console sign-in link.
▪ Password: Db@dministrat0r2020!
29.Return to the browser tab with the multiple-choice questions for this lab, and
answer the following question.
o Question 5: Why can't Olivia access the EC2 instance details?
Olivia tells Sofía that she can't access the EC2 instances, and Sofía goes back to
the console to troubleshoot this issue.
You will now work as Sofia to review and update Olivia's access to AWS
resources.
30.Return to the browser tab where you are logged in as the voclabs user (Sofía).
32.Still as the voclabs user (Sofía), check which services and features Olivia used.
o In the IAM console, open the Olivia user, and choose the Access Advisor tab
o Notice that you can see which service areas that Olivia visited. Recent service
activity usually appears within 4 hours (as stated in the Access Advisor details).
You might not see any Last accessed data for Olivia yet.
You can use this view to gain insight into how a user's permissions might be
more open than they should be. This information enables you to more closely
align access rights with the principle of least privilege.
33.
34.As Olivia, return to the browser tab where the Olivia user is logged in and refresh
the instances page of the Amazon EC2 console.
34.Return to the browser tab with the multiple-choice questions for this lab and
answer the following question.
o Question 6: Name two specific actions in the policy that allow the café web application
on this instance to access the database credentials in the Parameter Store.
Olivia is now convinced that the web application on the development EC2
instance can access the Parameter Store. Maybe the problem is something else.
Olivia discusses the issue with Sofía.
After some conversation, Sofía remembers that the development environment
previously used a local database, but that it now uses Amazon RDS. The local
database had a different user name that allowed the web application to connect
to the database. Connecting to the database on Amazon RDS requires a different
database user name. That must be the issue!
Sofía asks Olivia to check whether the database user name is the source of the
problem and to update it.
35.As Olivia, update the dbUser value in the Systems Manager Parameter Store.
36.In the web application on the development café server, refresh the Menu page.
o If this webpage isn't already open, load http://<dev-public-ip-address>/cafe/menu.php in a
browser (where <dev-public-ip-address> is the actual IPv4 public IP address of the aws-
cloud9-DEVCafeServer instance).
o Does the full page of content display correctly now? Can you successfully submit an
order?
Congratulations! You acted as a member of the DBAdministrators group, and you
fixed the website. Nikhil thanks Olivia for resolving the issue, and Olivia also
informs Sofía that the issue is resolved.
New business requirement: Refining IAM
user access (Challenge #3)
Frank and Martha are happy that Sofía and the team improved the security of
the AWS account. Meanwhile, Sofía is happy that she was able to configure
different permissions for her application developers and database
administrators. She likes that assigning separate permissions to each role
results in team members working together—each within their area of core
competency and assigned responsibility—to do development and to
troubleshoot issues.
Sofía takes a minute to relax with her friends. However, she's already thinking
about further customizing the security settings that she assigned to the different
users. Some of the permissions are still too open and don't fully follow the
principle of least privilege. In this final challenge in the lab, you will take on the
role of Sofía. You will work to define a custom IAM policy that reduces the
number of allowed IAM actions that are granted to members of the database
administrators group. However, you must also grant them enough IAM access to
accomplish their job responsibilities.
39.In the IAM Policies list, make sure that the IAMReadOnlyAccess policy is
selected. However, clear the check boxes of the other policies.
40.In the Policy Simulator section, choose Select service. In the Filter search box,
enter Ident and select Identity and Access Management.
41.Choose the Select All option (to the right of the Select actions menu), and then
choose Run Simulation.
o In the Action Settings and Results panel, a list of actions should display.
o The Permission column displays Olivia's permissions for each action. The
IAMReadOnlyAccess policy denies Olivia the permissions to perform Add or Create
actions. However, scroll to find the actions that she can take.
o The summary (at the top of the list) shows that Olivia is currently allowed to take 57 IAM
actions.
42.Return to the browser tab where you are logged in as the voclabs user (Sofía).
43.In the IAM console, choose Policies and then choose Create policy.
44.In the Visual editor tab, configure the following settings.
o Click Choose a service. Search for and choose EC2.
▪ In the Actions search box, search for IAM and select
DescribeIamInstanceProfileAssociations.
44.
o At the bottom of the screen, choose Add additional permissions.
o Click Choose a service. Search for and choose IAM.
▪ In the Actions search box, search for Get and select the following actions –
▪ GetPolicyVersion
▪ GetRole
▪ GetRolePolicy
▪ Back in the search box, search for List and select the following actions –
▪ ListAttachedRolePolicies
▪ ListInstanceProfiles
▪ ListInstanceProfilesForRole
▪ ListPolicies
▪ ListRolePolicies
▪ ListRoles
o Expand the Resources section and for all three resource types (instance-profile,
policy, and role) select Any in this account.
o Back at the top of the screen, choose the JSON tab
This view shows the JSON document that you just composed by using the visual
editor.
o Verify that the policy document details match what is shown in the following
example:
45.Exit the Create policy wizard by choosing Cancel.
Observe that the policy details match the one you worked to build, as shown in
the previous screen capture.
Note: The Sid elements in a policy are optional. Also, the order in which Effect,
Action, and Resource appear in a policy document doesn't affect how the policy
works.
Sofía asks Olivia to confirm that she can still access the details of the CafeRole
IAM role, even with the more limited IAM access rights now granted to her.
48.Return to the browser tab where you are logged in as Olivia, and verify that you
can still access the details of CafeRole.
o In the Amazon EC2 console, select the aws-cloud9-DEVCafeServer instance.
o In the Description tab, choose the IAM role > CafeRole.
o Expand the AmazonSSMManagedInstanceCore policy and verify that you can
still see the JSON document details.
49.(Optional) Return to the IAM Policy Simulator browser tab where you are
logged in as the voclabs user (Sofía). Run the simulation again (for what IAM
actions Olivia can take).
o Tip: To display the new IAM policies that apply to Olivia, refresh the browser
page.
o Before the change to the DBAdministrators IAM group, Olivia was allowed to
perform 57 actions that are related to the IAM service. However, after the
change, her access to the IAM service is now much more limited.
o The new policy grants fewer IAM permissions. However, Olivia still has the
access that she needs to perform her job functions.
Update from the café
Sofía believes that she's becoming good at managing user access to the AWS
account!
She knows how to use AWS managed IAM policies to control access, and she also
knows how to use the IAM Policy Simulator to observe the scope of the
permissions that different policies grant. She knows how to access the IAM
Access Analyzer to observe what access rights different users are taking
advantage of. And finally, she also practiced using the IAM policy Visual Editor to
create custom IAM policies.
51.If the results don't display after a couple of minutes, return to the top of these
instructions and choose Grades
Tip: You can submit your work multiple times. After you change your work,
choose Submit again. Your last submission is what will be recorded for this lab.
52.To find detailed feedback on your work, choose Details followed by View
Submission Report.
Lab complete
Congratulations! You have completed the lab.
53.To confirm that you want to end the lab, at the top of this page, choose End Lab,
and then choose Yes.
A panel should appear with this message: DELETE has been initiated... You may
close this message box now.
Many AWS services are inherently highly available, such as load balancers. Many
AWS services can also be configured for high availability, such as deploying
Amazon Elastic Compute Cloud (Amazon EC2) instances in multiple Availability
Zones.
In this lab, you will start with an application that runs on a single EC2 instance.
You will then make the application highly available.
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.
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.
● A VPC
● Public and private subnets in two Availability Zones
● An internet gateway (not shown) that is associated with the public subnets
● A Network Address Translation (NAT) gateway in one of the public subnets
● An Amazon Relational Database Service (Amazon RDS) instance in one of the
private subnets
5. On the AWS Management Console, on the Services menu, choose VPC.
6. In the left navigation pane, under Filter by VPC, choose the Select a VPC box
and select Lab VPC.
This setting will limit the console to only show resources that are associated with
the Lab VPC.
Here, you can access information about the Lab VPC that was created for you.
The IPv4 CIDR column has a value of 10.0.0.0/16, which means that this VPC
includes all IP addresses that start with 10.0.x.x.
o The VPC column shows that this subnet exists inside of Lab VPC.
o The IPv4 CIDR column has a value of 10.0.0.0/24, which means that this subnet
includes the 256 IP addresses between 10.0.0.0 and 10.0.0.255. Five of these
addresses are reserved and unusable.
o The Availability Zone column lists the Availability Zone where this subnet
resides.
9. To reveal more details at the bottom of the page, select Public Subnet 1.
Tip: To adjust the size of the lower window pane, you can drag the divider.
10.In the lower half of the page, choose the Route table tab.
This tab includes details about the routing for this subnet:
o The first entry specifies that traffic destined within the Classless Inter-Domain
Routing (CIDR) range for the VPC (10.0.0.0/16) will be routed within the VPC
(local).
o The second entry specifies that any traffic destined for the internet (0.0.0.0/0) is
routed to the internet gateway (igw-). This setting makes the subnet a public
subnet.
This tab has information about the network access control list (network ACL) that
is associated with the subnet. The rules currently permit all traffic to flow in and
out of the subnet, but the rules can be further restricted by using security
groups.
14.Select Inventory-DB.
15.In the lower half of the page, choose the Inbound rules tab.
These rules permit inbound MySQL or Aurora traffic (port 3306) from anywhere
in the VPC (10.0.0.0/16). You will later modify this setting so it only accepts traffic
from the application servers.
By default, security groups allow all outbound traffic. However, this setting can
be modified as needed.
Because the application runs on multiple application servers, you will need a
way to distribute traffic amongst those servers. You can accomplish this goal by
using a load balancer. This load balancer will also perform health checks on
instances and only send requests to healthy instances.
18.In the left navigation pane, choose Load Balancers (you might need to scroll
down to find it).
Several types of load balancers are displayed. Read the descriptions of each type
to understand their capabilities.
21.For Load balancer name, enter: Inventory-LB
22.Scroll down to the Network mapping section, then for VPC, select Lab VPC.
Important: Be sure to choose Lab VPC. It is likely not the default selection.
You will now specify which subnets the load balancer should use. It will be a
public load balancer, so you will select both public subnets.
23.Under Mappings, choose the first Availability Zone, then choose the Public
Subnet that displays.
24.Choose the second Availability Zone, then choose the Public Subnet that
displays.
You should now have selected two subnets: Public Subnet 1 and Public Subnet
2. (If not, go back and try the configuration again.)
25.In the Security groups section, select Create new security group, then
configure:
o Security group name: Inventory-LB
o Description: Enable web access to load balancer
o VPC: Remove the default VPC by choosing the X to the right of it. Then select Lab
VPC.
27.Still under Inbound rules, choose Add rule again and configure:
o Type: HTTPS
o Source: Anywhere-IPv4
28.Choose Create security group.
30.In the Listeners and routing section, choose Create target group.
Analysis: Target groups define where to send traffic that comes into the load
balancer. The Application Load Balancer can send traffic to multiple target
groups based upon the URL of the incoming request, such as having requests
from mobile apps going to a different set of servers. Your web application will
use only one target group.
31.A new browser tab will open. Configure the target group as described here:
o Choose a target type: Instances
o Target group name: Inventory-App
o VPC: Ensure that Lab VPC is chosen.
o Scroll down and expand Advanced health check settings.
Note: The Application Load Balancer automatically performs health checks on all
instances to ensure that they are responding to requests. The default settings
are recommended, but you will make them slightly faster for use in this lab.
o Healthy threshold: 2
o Interval: 10 (seconds)
This means that the health check will be performed every 10 seconds, and if the
instance responds correctly twice in a row, it will be considered healthy.
You do not have any web application instances yet, so you can skip this step.
32.Return to the browser tab where you already started defining the load balancer.
33.In the Listeners and routing section, choose the refresh icon.
34.For the Listener HTTP:80 row, set the Default action to forward to Inventory-
app.
35.Scroll to the bottom of the page, and choose Create load balancer.
o The load balancer is successfully created.
o Choose View load balancer.
In this task, you will create an Auto Scaling group that deploys EC2 instances
across your private subnets, which is a security best practice for application
deployment. Instances in a private subnet cannot be accessed from the internet.
Instead, users send requests to the load balancer, which forwards the requests
to EC2 instances in the private subnets.
Create an AMI for Auto Scaling
You will create an Amazon Machine Image (AMI) from the existing Web Server 1.
This will save the contents of the boot disk so that new instances can be
launched with identical content.
36. In the AWS Management Console, on the Services menu, choose EC2.
First, you will confirm that the instance created for you in this lab is running.
38.Wait until the Status check for Web Server 1 displays 2/2 checks passed. Choose
refresh to update.
40.In the Actions menu, choose Image and templates > Create image, then
configure:
o Image name: Web Server AMI
o Image description: Lab AMI for Web Server
A banner at the top of the screen displays the AMI ID for your new AMI.
You will use this AMI when launching the Auto Scaling group later in the lab.
o Instance type:
▪ Select Choose instance type
▪ Select t3.micro
▪ Select Choose
Note: If you have launched the lab in the us-east-1 Region, select the t2.micro
instance type. To find the Region, look in the upper-right corner of the Amazon
EC2 console.
Note: If you receive the error message Something went wrong. Please refresh and
try again, you may ignore it and continue with the exercise.
o Additional configuration:
▪ IAM instance profile: Inventory-App-Role
o Monitoring: Select Enable EC2 instance detailed monitoring within CloudWatch
45. Expand Advanced details. Under User data, copy and paste this script:
#!/bin/bash
# Install Apache Web Server and PHP
yum install -y httpd mysql
amazon-linux-extras install -y php7.2
# Download Lab files
wget https://aws-tc-largeobjects.s3-us-west-2.amazonaws.com/ILT-TF-200-ACACAD-20-EN/mod9-guided/
scripts/inventory-app.zip
unzip inventory-app.zip -d /var/www/html/
# Download and install the AWS SDK for PHP
wget https://github.com/aws/aws-sdk-php/releases/download/3.62.3/aws.zip
unzip aws -d /var/www/html
# Turn on web server
chkconfig httpd on
service httpd start
46. Under Security groups, for Select an existing security group, choose Inventory-App.
You will receive a warning that You will not able to connect to the instance. You can
ignore this warning because you will not need connect to the instance. All
configuration is done via the user data script.
50. From the Actions menu, choose Create Auto Scaling group.
51. For Auto Scaling group name, enter: Inventory-ASG (ASG stands for Auto Scaling group)
This will launch EC2 instances in private subnets across both Availability Zones.
These settings tell the Auto Scaling group to register new EC2 instances as part
of the Inventory-App target group that you created earlier. The load balancer will
send traffic to instances that are in this target group.
57. Under Additional settings, select Enable group metrics collection within
CloudWatch.
For this lab, you will maintain two instances at all times to ensure high availability.
If the application is expected to receive varying loads of traffic, you can also
create scaling policies that define when to launch or terminate instances.
However, you do not need to create scaling policies for the Inventory application
in this lab.
62. On the Add notifications page, choose Next. You do not need to configure any of
these settings.
63.On the Add tags page, choose Add tag and configure:
o Key: Name
o Value: Inventory-App
o Select Next
These settings will tag the Auto Scaling group with a Name, which will also
appear on the EC2 instances that are launched by the Auto Scaling group. You
can use tags to identify which Amazon EC2 instances are associated with which
application. You could also add tags such as Cost Center to assign application
costs in the billing files.
Your application will soon run across two Availability Zones. Amazon EC2 Auto
Scaling will maintain that configuration even if an instance or Availability Zone
fails.
After a minute, choose the refresh icon to update the display. It should show
that 2 instances are running.
The load balancer has been configured to forward incoming requests to a target
group. When Auto Scaling launches new instances, it will automatically add those
instances to the target group.
Application security group
The application security group was provided as part of the lab setup. You will now
configure it to only accept incoming traffic from the load balancer.
69. In the lower half of the page, choose the Inbound rules tab.
The security group is currently empty. You will now add a rule to accept
incoming HTTP traffic from the load balancer. You do not need to configure
HTTPS traffic because the load balancer was configured to forward HTTPS
requests via HTTP. This practice offloads security to the load balancer, reducing
the amount of work that is required by the individual application servers.
71. On the Edit inbound rules page, choose Add rule and configure these settings:
● Type: HTTP
● Source:
o Choose the search box to the right of Custom
o Delete the current contents
o Enter sg
o From the list that appears, select Inventory-LB
● Description: Traffic from load balancer
The application servers can now receive traffic from the load balancer. This
includes health checks that the load balancer performs automatically.
Database security group
You will now configure the database security group to only accept incoming traffic
from the application servers.
72.In the Security groups list, choose Inventory-DB (and make sure that no other
security groups are selected).
The existing rule permits traffic on port 3306 (used by MySQL) from any IP
address within the VPC. This is a good rule, but security can be restricted further.
73.In the Inbound rules tab, choose Edit inbound rules and configure these
settings:
o Delete the existing rule.
o Choose Add rule.
o For Type, choose MYSQL/Aurora
o Choose the search box to the right of Custom
o Enter sg
o From the list that appears, select Inventory-App
o Description: Traffic from application servers
o Choose Save rules
You have now configured three-tier security. Each element in the tier only accepts
traffic from the tier above.
In addition, the use of private subnets means that you have two security barriers
between the internet and your application resources. This architecture follows
the best practice of applying multiple layers of security.
In this task, you will confirm that your web application is running. You will also
test that it is highly available.
75.In the lower half of the page, choose the Targets tab.
This tab should show two registered targets. The Status column shows the results
of the load balancer health check that is performed against the instances.
76.In the Registered targets area, occasionally choose the refresh icon until the
Status for both instances appears as healthy.
If the status does not eventually change to healthy, ask your educator for help
with diagnosing the configuration.
You will test the application by connecting to the load balancer, which will then
send your request to one of the EC2 instances. You will first need to retrieve the
Domain Name System (DNS) name of the load balancer.
78.In the Description tab in the lower half of the window, copy the DNS name to
your clipboard.
79.Open a new web browser tab, paste the DNS name from your clipboard and
press ENTER.
The load balancer forwarded your request to one of the EC2 instances. The
instance ID and Availability Zone are shown at the bottom of the webpage.
80.Reload the page in your web browser. You should notice that the instance ID
and Availability Zone sometimes change between the two instances.
You sent the request to the load balancer, which resides in the public subnets that
are connected to the internet.
● The load balancer chose one of the EC2 instances that reside in the private
subnets and forwarded the request to it.
● The EC2 instance then returned the webpage to the load balancer, which
returned it to your web browser.
81.Return to the Amazon EC2 console tab in your web browser (but do not close
the web application tab—you will return to it soon).
You will now terminate one of the web application instances to simulate a
failure.
83.Select one of the Inventory-App instances (it does not matter which one you
select).
85.Choose Terminate.
In a short time, the load balancer health checks will notice that the instance is
not responding. The load balancer will automatically route all requests to the
remaining instance.
86.Return to the web application tab in your web browser and reload the page
several times.
You should notice that the Availability Zone that is shown at the bottom of the
page stays the same. Though an instance failed, your application remains
available.
After a few minutes, Amazon EC2 Auto Scaling will also notice the instance
failure. It was configured to keep two instances running, so Amazon EC2 Auto
Scaling will automatically launch a replacement instance.
87.Return to the Amazon EC2 console tab where you have the instances list
displayed. In the top-right area, choose the refresh icon every 30 seconds or so
until a new EC2 instance appears.
After a few minutes, the health check for the new instance should become
healthy. The load balancer will resume sending traffic between the two
Availability Zones. You can reload your web application tab to see this happen.
The application architecture is now highly available. However, the Amazon RDS
database operates from only one database instance.
In this optional task, you will make the database highly available by configuring it
88.
91.Choose Modify
92.Scroll down to the Availability & durability section. For Multi-AZ deployment,
select Create a standby instance.
Analysis: You only need to reconfigure this one setting to convert the database to
run across multiple data centers (Availability Zones).
This option does not mean that the database is distributed across multiple
instances. Instead, one instance is the primary instance, which handles all
requests. Another instance will be launched as the standby instance, which takes
over if the primary instance fails. Your application continues to use the same
DNS name for the database. However, the connections will automatically
redirect to the currently active database server.
You can scale an EC2 instance by changing attributes, and you can also scale an
RDS database this way. You will now scale up the database.
This action doubles the amount of space that is allocated to the database.
Feel free to explore the other options on the page, but do not change any other
settings.
97.Choose Modify DB instance
The database enters a modifying state while it applies the changes. You do not
need to wait for it to complete.
The application servers run in a private subnet. If the servers must access the
internet (for example, to download data), the requests must be redirected
through a Network Address Translation (NAT) gateway. (The NAT gateway must be
located in a public subnet).
The current architecture has only one NAT gateway in Public Subnet 1. Thus, if
Availability Zone 1 fails, the application servers will not be able to communicate
with the internet.
In this optional task, you will make the NAT gateway highly available by
launching another NAT gateway in the other Availability Zone. The resulting
architecture will be highly available:
98.
The existing NAT gateway displays. You will now create a NAT gateway for the
other Availability Zone.
You will now create a new route table for Private Subnet 2. This route table will
redirect traffic to the new NAT gateway.
Currently, one route directs all traffic locally. You will now add a route to send
internet-bound traffic through the new NAT gateway.
The NAT gateway that is listed under the Details button (which is above these
instructions) is for Public Subnet 1. You are configuring this route table to use the
other NAT gateway.
This action now sends internet-bound traffic from Private Subnet 2 to the NAT
gateway that is in the same Availability Zone.
Your NAT gateways are now highly available. A failure in one Availability Zone
will not impact traffic in the other Availability Zone.
110. If the results don't display after a couple of minutes, return to the top of
these instructions and choose Grades
Tip: You can submit your work multiple times. After you change your work,
choose Submit again. Your last submission is what will be recorded for this lab.
111. To find detailed feedback on your work, choose Details followed by View
Submission Report.
Lab complete
Congratulations! You have completed the lab.
112. Choose End Lab at the top of this page, and then select Yes to confirm that
you want to end the lab.
A panel indicates that DELETE has been initiated... You may close this message box
now.
113. Select the X in the top right corner to close the panel.
EX 8: Automating Infrastructure
Deployment with AWS
CloudFormation
Lab overview and objectives
Deploying infrastructure in a consistent, reliable manner is difficult. It requires
people to follow documented procedures without taking any undocumented
shortcuts. It can also be difficult to deploy infrastructure out-of-hours when
fewer staff are available. AWS CloudFormation changes this situation by defining
infrastructure in a template that can be automatically deployed—even on an
automated schedule.
In this lab, you will learn how to deploy multiple layers of infrastructure with
AWS CloudFormation, update a CloudFormation stack, and delete a stack (while
retaining some resources).
● Use AWS CloudFormation to deploy a virtual private cloud (VPC) networking layer
● Use AWS CloudFormation to deploy an application layer that references the networking
layer
● Explore templates with AWS CloudFormation Designer
● Delete a stack that has a deletion policy
Duration
This lab will require approximately 20 minutes to complete.
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.
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.
This way, templates can be reused between systems. For example, you can
deploy a common network topology between development, test, and production
environments, or deploy a standard database for multiple applications.
In this task, you will deploy an AWS CloudFormation template that creates
a networking layer by using Amazon VPC.
5. Right-click the following link and download the template to your computer: lab-
network.yaml
If you want, you can open the template in a text editor to see how the AWS
resources are defined.
7. If you see this message, click Try it out now and provide us feedback:
11.Choose the Resources tab.
You will see a list of the resources that were created by the template.
The events log shows (from more recent to less recent) the activities that were
performed by AWS CloudFormation. Example events include starting to create a
resource and then completing the resource creation. Any errors that were
encountered during the creation of the stack will be listed in this tab.
13.Choose the Outputs tab.
14.Choose the Template tab.
This tab shows the template that was used to create the stack—that is, the
template that you uploaded while you created the stack. Feel free to examine
the template and see the resources that were created. Also feel free to explore
the Outputs section at the end (this section defined which values to export).
15.Right-click the following link and download the template to your computer: lab-
application.yaml
If you want, you can open the template in a text editor to see how resources are
defined.
17.Select Create stack > With new resources (standard), and then configure
these settings.
19.Choose the Outputs tab.
20.Copy the URL that is displayed, open a new web browser tab, paste the URL, and
press ENTER.
The browser tab will open the application, which is running on the web server
that this new CloudFormation stack created.
WebServerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Enable HTTP ingress
VpcId:
Fn::ImportValue:
!Sub ${NetworkStackName}-VPCID
The last line uses the network stack name that you provided (lab-network) when
the stack was created. It imports the value of lab-network-VPCID from
the Outputs of the first stack. It then inserts the value into the VPC ID field of the
security group definition. The result is that the security group is created in the
VPC that was created by the first stack.
Here is another example, which is in the CloudFormation template that you just
used to create the application stack. This template code places the EC2 instance
into the subnet that was created by the network stack:
SubnetId:
Fn::ImportValue:
!Sub ${NetworkStackName}-SubnetID
It takes the subnet ID from the lab-network stack and uses it in the lab-
application stack to launch the instance into the public subnet, which was
created by the first stack.
Task 3: Updating a Stack
AWS CloudFormation can also update a stack that has been deployed. When you
update a stack, AWS CloudFormation will only modify or replace the resources
that are being changed. Any resources that are not being changed will be left as-
is.
First, you will examine the current settings for the security group.
Currently, only one rule is in the security group. The rule permits HTTP traffic.
26.Right-click the following link and download the updated template to your
computer: lab-application2.yaml
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
27.In the Stacks list of the AWS CloudFormation console, select lab-application.
21.Choose Update stack
22.In the Stack info tab, wait for the Status to change to UPDATE_COMPLETE.
In this task, you will gain some hands-on experience with Designer.
Tip: You might need to expand the left navigation pane by choosing the menu
icon.
34.Experiment with the features of the Designer. Some things to try are:
o Click the displayed resources. The lower pane will then display the portion of the
template that defines the resources.
o Try dragging a new resource—from the Resource types pane on the left—into
the design area. The definition of the resource will be automatically inserted into
the template.
o Try dragging the resource connector circles to create relationships between
resources.
o Open the lab-network.yaml template that you downloaded earlier in the lab
and also explore its resources in Designer.
DiskVolume:
Type: AWS::EC2::Volume
Properties:
Size: 100
AvailabilityZone: !GetAtt WebServerInstance.AvailabilityZone
Tags:
- Key: Name
Value: Web Data
DeletionPolicy: Snapshot
You can monitor the deletion process in the Events tab and update the screen
by choosing Refresh occasionally. You might also see an events log entry that
indicates that the EBS snapshot is being created.
42.Wait for the stack to be deleted. It will disappear from the stacks list.
The application stack __ removed, but the network stack remained untouched.
This scenario reinforces the idea that different teams (for example, the network
team or the application team) could manage their own stacks.
You will now verify that a snapshot of the EBS volume was created before the
EBS volume was deleted.
You should see a snapshot with a Started time in the last few minutes.
Tip: You can submit your work multiple times. After you change your work,
choose Submit again. Your last submission is what will be recorded for this lab.
47.To find detailed feedback on your work, choose Details followed by View
Submission Report.
Lab complete
Congratulations! You have completed the lab.
48.Choose End Lab at the top of this page, and then select Yes to confirm that you
want to end the lab.
A panel indicates that DELETE has been initiated... You may close this message box
now.