Courseiva
mediumMultiple ChoiceObjective-mapped

CloudFormation Stack Failure: Invalid AMI ID

Exhibit

StackStatus: "ROLLBACK_IN_PROGRESS"
StackEvents:
  - ResourceStatus: "CREATE_FAILED"
    ResourceType: "AWS::EC2::Instance"
    ResourceStatusReason: "Value of property ImageId is invalid. Please use a valid AMI."

Refer to the exhibit. A cloud administrator launched a CloudFormation stack to deploy an EC2 instance, but the stack is rolling back. What is the MOST likely cause?

Quick Answer

The answer is an invalid or deregistered AMI ID. CloudFormation stack creation fails and rolls back when the specified AMI ID cannot be used to launch an EC2 instance, because the service validates the AMI during resource provisioning—if the ID is mistyped, belongs to a different AWS region, or has been deregistered, the instance launch fails and triggers a stack rollback. On the CompTIA Cloud+ CV0-004 exam, this scenario tests your understanding of template portability errors, a common trap when copying CloudFormation templates between regions without updating region-specific AMI IDs. Remember that AMI IDs are region-specific and can change when an AMI owner deregisters the image, so always verify the ID before deployment. A helpful memory tip: “AMI IDs are regional—copy the template, but not the ID.”

⚠ Common exam trap

Watch out — candidates often assume a missing security group or wrong subnet causes rollbacks, but CloudFormation performs upfront validation for those parameters, whereas an invalid AMI ID is only detected at launch time, making it the most likely cause of a rollback.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The AMI ID is invalid or has been deregistered.

CloudFormation validates the AMI ID during stack creation. If the AMI ID is invalid (e.g., mistyped, belongs to a different region, or has been deregistered), the EC2 instance launch fails, causing CloudFormation to roll back the stack. This is a common misconfiguration when copying templates across regions without updating AMI IDs.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The security group referenced in the template does not exist.

    Why it's wrong here

    A missing security group would produce an error about the security group, not ImageId.

  • The subnet ID is in a different VPC.

    Why it's wrong here

    A subnet mismatch would produce an error about subnet or VPC, not ImageId.

  • The AMI ID is invalid or has been deregistered.

    Why this is correct

    The error directly states 'ImageId is invalid', so the AMI ID is incorrect or no longer exists.

  • The instance type is not available in the selected region.

    Why it's wrong here

    The error mentions ImageId, not instance type; an unsupported instance type would give a different error.

About these practice questions

One of 977 original CV0-004 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on CV0-004

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A cloud administrator is debugging a failed CloudFormation stack creation. The exhibit shows the stack events. What is the most likely cause of the failure?

medium
  • A.The instance type is not supported in the region.
  • B.The stack name already exists.
  • C.The AMI ID is incorrect.
  • D.The referenced security group does not exist in the chosen VPC.

Why D: The stack creation fails with a 'CREATE_FAILED' status on the security group resource, and the error message indicates that the security group does not exist in the specified VPC. This is a common issue when a CloudFormation template references a security group by ID or name that is not present in the target VPC, causing the resource creation to fail. The stack events show the security group resource as the point of failure, confirming that the referenced security group is missing.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CV0-004 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CV0-004 exam.