Skip to main content

Posts

Showing posts from 2017

CloudFormation Templates: Using Ref to Access Run Time Information

When working with AWS CloudFormation, many of the resource properties we reference in our stack template will not be available until the stack is built and creation of that particular resource has been initiated. For example, suppose we're declaring an ECS service called MigrateDatabaseService to run and maintain a task based on the MigrateTask task definition. One of the required properties of the AWS::ECS::Service resource is a string containing the Amazon Resource Name (ARN) of the task definition (including the revision number) that we want to run on the cluster. The problem is that the task definition is declared in the same template, but the ARN will not be available until run time. So, how do we specify a run time value at design time? CloudFormation provides eleven built-in, or intrinsic, functions that we can use to assign values to properties that are not available until run time. The intrinsic function we need to use to populate the TaskDefinition propert