AWS Official Blog

AWS CloudFormation Tagging of Amazon S3 and Amazon RDS

by Jeff Barr | on | in Amazon S3, AWS CloudFormation |

Last summer, I introduced cost allocation reports and tagging, a new system that allows you to organize and track your AWS resources and their associated cost. I also mentioned that well incrementally make this feature bigger and better over time. Today, Im glad to announce that AWS CloudFormation has added support for tagging Amazon S3 buckets and Amazon RDS DB Instances.

AWS CloudFormation makes it easy for you to provision and configure a set of related AWS resources. Using tags, you can now track the cost and usage of the following resources inside your CloudFormation stacks:

  • S3 buckets new
  • RDS DB Instances new
  • EC2 Instances
  • Auto Scaling groups
  • EBS volumes
  • VPN resources

Tags can represent your business dimensions such as a specific application or service that youre running on AWS or a cost center within your company. The cost allocation reports allow you to take these tags and track usage and cost associated with them.

To learn more about tagging specific resources, visit the Resource Types Reference in the AWS CloudFormation User Guide.

There are 3 ways to tag your stacks and their associated resources:

1- Automatic Tags
As a convenience, CloudFormation automatically adds preset tags to help you organize all resources within your stack. These preset tags (prefixed by aws:cloudformation) provide the logical name of a resource, its parent stack ID, and its parent stack name:   

2- Tag Your Stack
You can also add your custom tags to a CloudFormation stack. You can optionally also have these tags propagated to all resources within your stack.

3 – Tag a Specific Resource
You can also tag specific resources inside your CloudFormation template.

Heres a template snippet that shows you how to tag an RDS DB Instance. This tag could help you track your cost across all databases that your company might be using.

“Resources” : {
     “SaadDB” : {
         “Type” : “AWS::RDS::DBInstance” ,
         “Properties” : {
         “AllocatedStorage” : “100” ,
         “DBInstanceClass” : “db.m1.small” ,
         “Engine” : “MySQL” ,
         “EngineVersion” : “5.5” ,
         “Iops” : “1000” ,
         “MasterUsername” : { “Ref” : “DBUser” } ,
         “MasterUserPassword” : { “Ref” : “DBPassword” },
         “Tags” : [ { “Key” : “Type” , “Value” : “Database” } ]
        }
    }
}

Saad Ladki, Product Manager, AWS Elastic Beanstalk and AWS CloudFormation