Question

If I have a region string such as 'us-east-1', 'us-west-1', 'sa-east-1', ... and I want to create a short versions programmatically such as: 'ue1', 'uw1', 'se1',... how do I do that? Using Mapping is the only way?

Thanks

Was it helpful?

Solution

As stated here in the CloudFormation documentation (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) there are only these functions available in a template:

  • Fn::Base64
  • Fn::FindInMap
  • Fn::GetAtt
  • Fn::GetAZs
  • Fn::Join
  • Fn::Select
  • Ref

So I'd say that the only way to achieve what you want is to use Mapping and the Fn::FindInMap function.

e.g.

{
  "Mappings": {
    "ShortRegion": {
      "us-east-1": {
        "short": "ue1"
      },
      "us-west-1": {
        "short": "uw1"
      }
    }
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top