menu
arrow_back

Launching and Managing a Web Application with AWS CloudFormation

1m setup · 110m access · 50m completion
Connection Details

Warning: Do not transmit data into the AWS Console that is not related to Qwiklabs or the lab you are taking.

Free

info_outline
You can take this lab for free! Other more advanced labs may cost credits to start.

01:50:00

Launching and Managing a Web Application with AWS CloudFormation

SPL-10 - Version 3.6.1

© 2018 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 aws-course-feedback@amazon.com.

Other questions? Contact us at https://aws.amazon.com/contact-us/aws-training/

Overview

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. You will enhance your application with IAM credentials and a key pair. Finally, you will add a load balancer and an Auto Scaling group based on an Auto Scaling configuration.

Topics covered

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.

An AWS CloudFormation template is a declaration of the AWS resources that make up a stack. The template is stored as a text file in either JavaScript Object Notation (JSON) or YAML format. Because they are just text files, you can create and edit them in any text editor and manage them in your source control system with the rest of your source code.

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.

Start Lab

Notice the lab properties below the lab title:

  • setup - The estimated time to set up the lab environment
  • access - The time the lab will run before automatically shutting down
  • completion - The estimated time the lab should take to complete
  1. Launch your lab by clicking START LAB

If you are prompted for a token, use the one distributed to you (or credits you've purchased).

A status bar shows the progress of the lab environment creation process (the AWS Management Console is accessible during lab resource creation, but your AWS resources may not be fully available until the process is complete).

  1. Open your lab by clicking OPEN CONSOLE

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 Open Console again

You should now be able to access the AWS Management Console.

Error: You must first log out

If you see this message:

  • Click To logout, click here
  • Close the browser tab to return to your initial Qwiklabs window
  • Click Open Console again

Join Qwiklabs to Read the Rest of this Lab...and More!

  • Get temporary access to the Google Cloud Console.
  • Nearly 100 labs from beginner to advanced levels.
  • Bite-sized so you can learn at your own pace.
Join to Start This Lab