Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Using CloudFormation Drift Detection

This lab discusses CloudFormation drift detection. CloudFormation stack drift occurs when the resources in a stack have drifted from their original creation template. This can become a major problem — and drift detection can be used to identify it. After the problem is identified, the lab covers the stack update steps that can be taken to bring the CloudFormation stack back into sync with the original template.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Aug 02, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create CloudFormation Stack

    1. In EC2, create a key pair called driftlab.
    2. Create a CloudFormation stack using the ec24drift.json template file linked in the lab instructions. Use the following stack details:
      • Stack name: driftlab
      • InstanceType: t2.micro
      • KeyName: driftlab
      • MySubnet: Select any one of the listed subnets
      • myVPC: Select the only listed VPC
      • Give the stack a "name" tag of "driftlab"
  2. Challenge

    Terminate an EC2 Instance to Introduce Stack Drift

    1. In EC2, select Instance3, and under Actions > Security > Change security groups, remove the currently selected security group, and add the default security group.
    2. Select Instance 1, and terminate the instance.
    3. Go to Networking & Security > Security Groups. For the security group with driftlab-InstanceSecurityGroup in the name, add HTTP and HTTPS inbound rules.
    4. In S3, disable static website hosting for the bucket that was created (it will have driftlab in the name).
    5. In CloudFormation, detect drift and view the results.
  3. Challenge

    Eliminate Drift from Stack

    1. In EC2, select Instance3. Under Actions > Security > Change security groups, remove the default security group, and reassign the driftlab- security group.
    2. In CloudFormation, select EC2Instance3, detect drift, and view the results for the resource to see that it is now in sync.
    3. Still in CloudFormation, update the driftlab stack by uploading the afterdriftupdate.json file (link available in the lab instructions) as the template file.
    4. Detect drift and view the results to see that all resources are in sync.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans