You can use a single template to specify different parameter values for different regions when you create a stack group.
When you create a stack group from a single template, you may need different parameter values for each region. For example, you might use a different image in each region. Define a Mappings section that associates keys, such as region IDs, with corresponding values, such as image IDs. Then, in the Resources or Outputs sections, call Fn::FindInMap to retrieve a value from the map. To look up the value for the current deployment region, pass the ALIYUN::Region pseudo parameter to Fn::FindInMap.
ROSTemplateFormatVersion: '2015-09-01'
Mappings:
RegionMap:
cn-shenzhen:
ImageId: m-2vca5gczbrozn1vwp****
cn-beijing:
ImageId: m-hp38urk0l2aioidn****
us-west-1:
ImageId: m-rj9b5x7xtspmbage****
cn-shanghai:
ImageId: m-2ze1bpkyqvylc2ag****
cn-hangzhou:
ImageId: m-bp1h1cr4n27d3owq****
Outputs:
ImageId:
Value:
Fn::FindInMap:
- RegionMap
- Ref: ALIYUN::Region
- ImageId
Console example
If you create a stack group and select China (Hangzhou) as the deployment region, the template automatically uses the ImageId value that corresponds to cn-hangzhou in the RegionMap.
On the stack details page, click the Outputs tab to view the ImageId output and its value.