Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

Name Type

For some resources, you can specify a custom name. By default, AWS CloudFormation generates a unique physical ID to name a resource. For example, AWS CloudFormation might name an Amazon S3 bucket with the following physical ID stack123123123123-s3bucket-abcdefghijk1. With custom names, you can specify a name that's easier to read and identify, such as production-app-logs or business-metrics.

Resource names must be unique across all of your active stacks. If you reuse templates to create multiple stacks, you must change or remove custom names from your template. If you don't specify a name, AWS CloudFormation generates a unique physical ID to name the resource. Names must begin with a letter; contain only ASCII letters, digits, and hyphens; and not end with a hyphen or contain two consecutive hyphens.

Also, do not manage stack resources outside of AWS CloudFormation. For example, if you rename an Amazon S3 bucket that's part of a stack without using AWS CloudFormation, you might get an error any time you try to update or delete that stack.

Important

You can't perform an update that causes a custom-named resource to be replaced. If you must replace the resource, specify a new name.

Example

If you want to use a custom name, specify a name property for that resource in your AWS CloudFormation template. Each resource that supports custom names has its own property that you specify. For example, to name an DynamoDB table, you use the TableName property, as shown in the following sample:

JSON

Copy
"myDynamoDBTable" : { "Type" : "AWS::DynamoDB::Table", "Properties" : { "KeySchema" : { "HashKeyElement": { "AttributeName" : "AttributeName1", "AttributeType" : "S" }, "RangeKeyElement" : { "AttributeName" : "AttributeName2", "AttributeType" : "N" } }, "ProvisionedThroughput" : { "ReadCapacityUnits" : "5", "WriteCapacityUnits" : "10" }, "TableName" : "SampleTable" } }

YAML

Copy
myDynamoDBTable: Type: "AWS::DynamoDB::Table" Properties: KeySchema: HashKeyElement: AttributeName: "AttributeName1" AttributeType: "S" RangeKeyElement: AttributeName: "AttributeName2" AttributeType: "N" ProvisionedThroughput: ReadCapacityUnits: "5" WriteCapacityUnits: "10" TableName: "SampleTable"

Supported Resources

The following resource types support custom names: