简体   繁体   中英

How to implement region specific configuration for AWS CloudFormation stack and resources

Scenario:

  1. We need to create CloudFormation stack with certain set of resources like Lambda, API Gateway, DynamoDB, ElasticSearch etc.
  2. These stacks needs to be deployed in multiple regions, to be more specific 5 different regions like Oregon, Sydney etc.
  3. Each stack has different configuration based on a region eg DynamoDB auto-scaling values are different for each region and Lambda concurrency or Instance types for ElasticSearch etc. are region specific.

What we currently doing:

Currently we have a single CloudFormation template with Mappings defined for region specific values. ie we are using condition functions like if-else to check current AWS region and based on that we select the mapping for that region.

Problem:

  • As the need grows to support more and more regions the size of mappings also increasing
  • For each new resource getting added we need to update mapping to add the configuration for new resource
  • Supporting multiple regions and resource configurations along with conditions becoming unmanageable

Expectation:

We are looking for a comprehensive solution to support multiple regions using the same CloudFormation template and need to get rid of mappings and find more manageable way to handle region specific configurations.

Any help is highly appreciated.

You can use SSM parameters to solve your issue. If you don't know, SSM allows you to store parameters in your AWS environment. The parameters are scoped to each region. The procedure would be:

  1. Create a CloudFormation template with all parameters. Create the stack in each region using the defined values for that region;
  2. Change you current template to read the parameters from Parameter Store instead of the parameter map;
  3. Create your main stack.

You can find more information regarding this feature here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM