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...

Resource Declaration

The required Resources section describes the member resources in your AWS CloudFormation template.

In the Resources section you declare the AWS resources you want as part of your stack. Resources are separated by a comma.

Each resource must have a logical name unique within the template. This is the name you use elsewhere in the template as a dereference argument. Because constraints on the names of resources vary by service, all resource logical names must be alphanumeric [a-zA-Z0-9] only.

You must specify the type for each resource. Type names are fixed according to those listed in Resource Property Types Reference.

If a resource does not require any properties to be declared, you can omit the Properties section of that resource. For information about declaring a Property section, see Properties Declaration.

The following example shows a typical Resource declaration. It defines two resources. The MyInstance resource includes the MyQueue resource as part of its UserData property:

  "Resources" : {
    "MyInstance" : {
        "Type" : "AWS::EC2::Instance",
        "Properties" : {
            "UserData" : {
                "Fn::Base64" : {
                    "Fn::Join" : [ "", [ "Queue=", { "Ref" : "MyQueue" } ] ]
                 } },
            "AvailabilityZone" : "us-east-1a",
            "ImageId" : "ami-20b65349"
        }
    },

    "MyQueue" : {
        "Type" : "AWS::SQS::Queue",
        "Properties" : {
        }
    }
}