AWS Pseudo Parameters - krdheeraj51/aws-labs GitHub Wiki
Overview:
Pseudo parameters are predefined parameters provided by AWS CloudFormation. They allow you to reference information about the stack, such as the AWS account ID, region, and stack name, without having to define these values explicitly in your template.
Common Pseudo Parameters:
Property | Description | Example |
---|---|---|
AWS::AccountId | Returns the AWS account ID of the account in which the stack is being created. | 123456789012 |
AWS::Region | Returns the AWS region in which the stack is being created. | us-east-1 |
AWS::StackId | Returns the unique identifier of the stack. | arn:aws:cloudformation:us-east-1:123456789012:stack/MyStack/1a2b3c4d-5678-90ab-cdef-EXAMPLE11111 |
AWS::StackName | Returns the name of the stack as specified during stack creation. | MyStack |
AWS::Partition | Returns the partition that the resource is in. For standard AWS regions, the partition is aws. For resources in other partitions, the partition is aws-cn or aws-us-gov. | aws |
AWS::URLSuffix | Returns the suffix for the Amazon S3 URL in the current region. | amazonaws.com |
AWS::NotificationARNs | Returns the list of notification Amazon Resource Names (ARNs) for the current stack. | arn:aws:sns:us-east-1:123456789012:MyTopic |
AWS::NoValue |
Example:
Resources:
MyBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: !Sub "${AWS::StackName}-bucket"
Outputs:
AccountId:
Description: "The AWS Account ID"
Value: !Ref "AWS::AccountId"
Region:
Description: "The AWS Region"
Value: !Ref "AWS::Region"
StackId:
Description: "The Stack ID"
Value: !Ref "AWS::StackId"
StackName:
Description: "The Stack Name"
Value: !Ref "AWS::StackName"