A CloudFormation template creates multiple EC2 instances successfully in us-east-1 but fails in us-west-2 with the error AMI [ami-12345678] does not exist. How can the administrator make the template work in every region?
Choose an answer
Tap an option to check your answer.
Correct answer: Add AMI IDs for each region into the template's Mappings section and reference the appropriate mapping for the region..
Why this is the answer
The correct approach is to use the Mappings section in your CloudFormation template. AMIs are region-specific, meaning an AMI ID valid in us-east-1 will not exist in us-west-2. By defining a mapping that associates each region with its corresponding AMI ID, CloudFormation can dynamically select the correct AMI based on the deployment region. This ensures the template is portable and works across multiple regions without manual modification. Incorrect options: You cannot give a copied AMI the same ID; AWS assigns unique IDs. Including a region code in an AMI ID is not how AMI identifiers work; they are globally unique within a region. An AWS::EC2::AMI::ImageID control is used for user input during stack creation, not for automatically resolving region-specific AMIs within the template itself.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed