How to get AWS Region in Cloudformation template?

In this post I will show you how you can get the AWS Region in AWS Cloudformation template.

get AWS Region in Cloudformation template
How to get AWS Region in Cloudformation template? 2

Today, I was creating a Cloudformation template to create a private hosted zone in Route53 and it made me confusion for a while so I thought this information could be helpful for other people as well.

Following is the template snippet that can use used to assign a Region to the required property. This snippet will automatically pick up the region where the template is deployed.

!Ref "AWS::Region"

Example:

VPCs:
      VPCRegion: !Ref "AWS::Region"

In the above code, Region is assigned to the key `VPCRegion`.

Leave a Comment