💾 Archived View for cfdocs.wetterberg.nu › aws-properties-name.gemini captured on 2021-12-04 at 18:04:22. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

Name type

Search

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

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

"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

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:

AWS::ApiGateway::ApiKey

AWS::ApiGateway::Model

AWS::CloudWatch::Alarm

AWS::DynamoDB::Table

AWS::ElasticBeanstalk::Application

AWS::ElasticBeanstalk::Environment

AWS::CodeDeploy::Application

AWS::CodeDeploy::DeploymentConfig

AWS::CodeDeploy::DeploymentGroup

AWS::Config::ConfigRule

AWS::Config::DeliveryChannel

AWS::Config::ConfigurationRecorder

AWS::ElasticLoadBalancing::LoadBalancer

AWS::ElasticLoadBalancingV2::LoadBalancer

AWS::ElasticLoadBalancingV2::TargetGroup

AWS::EC2::SecurityGroup

AWS::ElastiCache::CacheCluster

AWS::ECR::Repository

AWS::ECS::Cluster

AWS::Elasticsearch::Domain

AWS::Events::Rule

AWS::IAM::Group

AWS::IAM::ManagedPolicy

AWS::IAM::Role

AWS::IAM::User

AWS::Lambda::Function

AWS::RDS::DBInstance

AWS::S3::Bucket

AWS::SNS::Topic

AWS::SQS::Queue