How to get AWS Region in Cloudformation template? awscloudformation

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.

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.

To get AWS Region in AWS CloudFormation we can use the Pseudo Parameters available in AWS Cloudformation.

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`.


Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments