What You'll Learn
You'll discover how to use AWS's built-in pseudo parameters to make your CloudFormation templates smarter and more portable without hardcoding environment-specific values.
What Are Pseudo Parameters?
Pseudo parameters are special, read-only values automatically provided by AWS at stack creation time. Think of them like system variables in programming—you don't define them yourself, but AWS makes them available in every template.
Unlike the custom parameters you declare in the Parameters section, pseudo parameters are always present and always prefixed with AWS::.
The Most Common Pseudo Parameters
AWS::Region
Returns the AWS region where your stack is being created (like us-east-1 or eu-west-2). Perfect for creating region-specific resource names or referencing region-specific AMIs.
AWS::AccountId
Provides the AWS account ID (a 12-digit number) deploying the stack. Useful for building ARNs or enforcing account-specific policies.
AWS::StackName
Returns the name you gave your stack when creating it. Great for tagging resources or creating unique identifiers.
AWS::StackId
A unique identifier for the stack itself—helpful for tracking and debugging.
Why Pseudo Parameters Matter
Imagine you want your S3 bucket name to include the region and account ID. Instead of hardcoding my-bucket-us-east-1-123456789012, you reference pseudo parameters. Now the same template works in any region or account without modification—it adapts automatically.
They make templates portable and environment-aware without manual updates.
Usage with Intrinsic Functions
You'll typically use pseudo parameters with Ref or Fn::Sub to build dynamic values:
Ref: AWS::Regiongets the current region- In
Fn::Sub, use${AWS::AccountId}for string substitution
Key Takeaway: Pseudo parameters are AWS-provided, read-only values (like AWS::Region, AWS::AccountId, and AWS::StackName) that make your templates portable and environment-aware without hardcoding specific values.