Launching and Managing a Web Application with AWS CloudFormation
SPL-10 - Version 3.6.11
© 2019 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may not be reproduced or redistributed, in whole or in part, without prior written permission from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
Errors or corrections? Email us at email@example.com.
Other questions? Contact us at https://aws.amazon.com/contact-us/aws-training/
In this lab you will learn how to use AWS CloudFormation to provision and update a web application with a number of supporting AWS products and services, including Auto Scaling groups, Amazon Elastic Cloud Compute (EC2) instances, and Elastic Load Balancing.
In the first part you will create a simple resource, an Amazon S3 bucket, with AWS CloudFormation and you will look at different retention policies applied when you delete an AWS CloudFormation stack or during a rollback.
In the second part, you will provision a simple PHP web application using an Amazon Linux instance. You will then see how to re-apply an AWS CloudFormation template to the existing application to change some resource attributes such as an Amazon EC2 instance type. Finally, you will add a load balancer and an Auto Scaling group based on an Auto Scaling configuration.
By the end of this lab, you will be able to:
- Create an Amazon Simple Storage Service (S3) bucket using AWS CloudFormation
- Provision a simple PHP web application using an Amazon Linux AMI
- Apply an AWS CloudFormation template to an existing application
- Modify an existing application using AWS CloudFormation
- Add IAM roles and Elastic Load Balancing to the application using AWS CloudFormation
Technical knowledge prerequisites
To successfully complete this lab, you should be comfortable editing scripts in a text editor.
Other AWS Services
Other AWS Services than the ones needed for this lab are disabled by IAM policy during your access time in this lab. In addition, the capabilities of the services used in this lab are limited to what’s required by the lab and in some cases are even further limited as an intentional aspect of the lab design. Expect errors when accessing other services or performing actions beyond those provided in this lab guide.
AWS CloudFormation gives developers and systems administrators an easy way to create and manage a collection of related AWS resources, provisioning and updating them in an orderly and predictable fashion.
You can use AWS CloudFormation sample templates or create your own templates to describe the AWS resources, and any associated dependencies or runtime parameters, required to run your application. You don’t need to figure out the order for provisioning AWS services or the subtleties of making those dependencies work. AWS CloudFormation takes care of this for you. After the AWS resources are deployed, you can modify and update them in a controlled and predictable way, in effect applying version control to your AWS infrastructure the same way you do with your software.
You can deploy and update a template and its associated collection of resources (called a stack) by using the AWS Management Console, AWS Command Line Interface, or APIs. AWS CloudFormation is available at no additional charge, and you pay only for the AWS resources needed to run your applications.
In the template, you use a JSON structure that AWS CloudFormation can interpret to declare the AWS resources you want to create and configure. In the JSON format, an object is declared as a name-value pair or a pairing of a name with a set of child objects enclosed within braces. Multiple sibling objects are separated by commas. An AWS CloudFormation template begins with an open brace and ends with a close brace. Within those braces, you can declare six top-level JSON objects: AWSTemplateFormatVersion, Description, Parameters, Mappings, Resources, and Outputs.
The only required top-level object is the Resources object, which must declare at least one resource. This lab will start with the most basic template containing only a Resources object, which contains a single resource declaration.
Definitions of each of these objects can be found in the online Template Anatomy documentation.
- At the top of your screen, launch your lab by clicking
This will start the process of provisioning your lab resources. An estimated amount of time to provision your lab resources will be displayed. You must wait for your resources to be provisioned before continuing.
If you are prompted for a token, use the one distributed to you (or credits you have purchased).
- Open your lab by clicking
This will automatically log you into the AWS Management Console.
Please do not change the Region unless instructed.
Common login errors
Error : Federated login credentials
If you see this message:
- Close the browser tab to return to your initial lab window
- Wait a few seconds
- Click again
You should now be able to access the AWS Management Console.
Error: You must first log out
If you see the message, You must first log out before logging into a different AWS account:
- Click click here
- Close your browser tab to return to your initial Qwiklabs window
- Click again
Join Qwiklabs to read the rest of this lab...and more!
- Get temporary access to the Amazon Web Services Console.
- Over 200 labs from beginner to advanced levels.
- Bite-sized so you can learn at your own pace.