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 catsndogs-assets.s3.amazonaws.com. Add a tag with the key “Classification” and value “Mythical” (no quotes).
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:
|SECRET_PATH||ValueFrom: UnicornLocation for example arn:aws:ssm:us-west-2:12345567891011:parameter/UnicornLocation|
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.
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.
You should see the cats page change to the catsndogs.lol 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.