AWS CloudFormation
User Guide (API Version 2010-05-15)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.

Tagging Your Member Resources

AWS CloudFormation automatically tags your resources with the stack name that you can filter on when viewing those resources in the AWS Management Console.

In addition to the stack name tags that AWS CloudFormation adds for you, you can add custom tags to the resources that support tagging.

Note

Tags you add to a member resource do not appear in the output from aws cloudformation describe-stack-resources. However, they do appear in the AWS Management Console on the tab for the tagged resource.

Suppose you wanted to customize a template to include the tag Stage for deployment stage, and QA for its value. You could write the definition for the MyInstance resource as follows:

"MyInstance" : {
    "Type" : "AWS::EC2::Instance",
    "Properties" : {
        "SecurityGroups" : [ { "Ref" : "MySecurityGroup" } ],
        "AvailabilityZone" : "us-east-1a",
        "ImageId" : "ami-20b65349",
        "Volumes" : [
            { "VolumeId" : { "Ref" : "MyEBS" },
                       "Device" : "/dev/sdk" }
        ],
        "Tags" : [
            {
                "Key" : "Stage",
                "Value" : "QA"
            }
       ]
    }
}

After you created the stack, you could then filter on the Stage tag in the AWS Management Console.