AWS CloudFormation
User Guide (API Version 2010-05-15)
« 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.Did this page help you?  Yes | No |  Tell us about it...


In the Resources sections of a template, you declare the AWS resources that you want AWS CloudFormation to manage, such as an Amazon EC2 instance or an Amazon S3 bucket. All templates must declare a Resources section with at least one resource. You must declare each resource separately; however, you can specify multiple resources of the same type.

Each resource declaration includes three parts:

  • A logical name that is unique within the template

  • A resource type

  • Properties for that resource

You use the logical name to reference the resource in other parts of the template. For example, if you want to map an Amazon Elastic Block Store to an Amazon EC2 instance, you reference the logical IDs of both the block stores and the instance to specify the mapping. Logical names must be alphanumeric (A-Za-z0-9). For a list of all the resource types, see AWS Resource Types Reference.

In addition to the logical ID, certain resources also have a physical ID, which is the actual assigned name for that resource, such as an Amazon EC2 instance ID or an Amazon S3 bucket name. You use the physical IDs to identify resources outside of AWS CloudFormation templates, but only after the resources have been created. For example, you might give an Amazon EC2 instance resource a logical ID of MyEC2Instance; but when AWS CloudFormation creates the instance, AWS CloudFormation automatically generates and assigns a physical ID (such as i-28f9ba55) to the instance. You can use this physical ID to identify the instance and view its properties (such as the DNS name) by using the Amazon EC2 console. For resources that support custom names, you can assign your own names (physical IDs) to help you quickly identify resources. For example, you can name an Amazon S3 bucket that stores logs as MyPerformanceLogs. For more information, see Name Type.

Resource properties are additional options that you can specify on a resource. For example, you can specify the DB snapshot property for an Amazon RDS DB instance in order to create a DB instance from a snapshot. The following example declares an Amazon EC2 image with an ID of myLinuxBundle-2011-12-30:

"Resources" :{
    "MySimpleImage" : {
        "Type" : "AWS::EC2::Image",
        "Properties" : {
            "ImageId" : "myLinuxBundle-2011-12-30",

For more information about resource properties, see Resource Properties.

For technical details about the Resources section format, see Resources Declaration.