Lab Guide

  1. In Systems Manager Parameter Store (located under Management & Governance), create a new secure string. Name the secure string UnicornLocation and use the default KMS key. Enter a value of Add a tag with the key “Classification” and value “Mythical” (no quotes).

  2. In the ECS Task Definition create a new revision of the cats task:

    a. Use the Task Role that starts with catsndogssetup

    b. Change the revision of the cats container from :v1 to :v2

    c. Add environment variables of:

    key data
    SECRET_PATH ValueFrom: UnicornLocation for example arn:aws:ssm:us-west-2:12345567891011:parameter/UnicornLocation
    REGION Value: for example: us-west-2
    Tag Value: v2
  3. Update the cats service to use the new revision of the cats task definition. Change the Minimum healthy percent to 50 and the Maximum healthy percent to 100. This instructs ECS to deploy the new revision without increasing the total number of running containers for the cats service.

  4. Get the DNS name of the Load Balancer and open it in your browser. Click the “I love cats” link to check that the new containers are deployed.

  5. You should see the cats page change to the new improved v2.0 cats page with a blue background. There is a one in ten chance that the page will load a unicorn image. Shout out loud when you see one!

Extension activity: The new cats pages show the containerID at the bottom of the page. Examine the cats_v2 source code and work out how this information is obtained, and how the v2 cats container obtains the location of the unicorns from Parameter Store.

What’s Next

Running ECS tasks based on time and events

Detailed Instructions

Deploying a new version of the cats service with secrets management - Detailed Instructions