Interview Prep/AWS/EC2, Auto Scaling and Load Balancing

`InvalidAMIID.NotFound: The image id '[ami-0abc123]' does not exist`.

BeginnerTroubleshootingEC2, Auto Scaling and Load Balancing
Answer

Likely causes → AMI IDs are Regional, so the ID belongs to another Region. Other causes: the AMI was deregistered, or it is private and not shared with your account.

Diagnose →

aws configure get region
aws ec2 describe-images --image-ids ami-0abc123 --region eu-west-1
aws ec2 describe-image-attribute --image-id ami-0abc123 --attribute launchPermission

Fix →

  1. Use the AMI ID for the right Region, or copy the AMI there: aws ec2 copy-image --source-region eu-west-1 --source-image-id ami-0abc123 --region us-east-1 --name app-v12
  2. Look up public AMIs through SSM parameters instead of hard-coding IDs: aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64

Prevent → Resolve AMIs dynamically (SSM parameter or a data source filtered by tag) and copy golden AMIs to every Region you use.

aws All AWS questions Roadmap: AWS core services

More on EC2, Auto Scaling and Load Balancing