Interview Prep/AWS/S3, EBS and EFS

`InvalidVolume.ZoneMismatch: The volume 'vol-0abc' is not in the same availability zone as instance 'i-0def'`.

BeginnerTroubleshootingS3, EBS and EFS
Answer

Likely causes → An EBS volume exists in one AZ and can only attach to instances in that AZ.

Diagnose →

aws ec2 describe-volumes --volume-ids vol-0abc --query 'Volumes[].AvailabilityZone'
aws ec2 describe-instances --instance-ids i-0def --query 'Reservations[].Instances[].Placement.AvailabilityZone'

Fix →

aws ec2 create-snapshot --volume-id vol-0abc --description move-az
aws ec2 create-volume --snapshot-id snap-0123 --availability-zone us-east-1b --volume-type gp3

Then attach the new volume.

Prevent → Keep shared or portable data on EFS or S3, and pin stateful instances (and their ASG subnets) to the AZ of their volumes.

aws All AWS questions Roadmap: AWS core services

More on S3, EBS and EFS