Interview Prep/AWS/Rapid-Fire AWS CLI

How do you convert all gp2 volumes in a region to gp3?

IntermediateProductionRapid-Fire AWS CLI
Answer
for v in $(aws ec2 describe-volumes --filters Name=volume-type,Values=gp2 \
    --query 'Volumes[].VolumeId' --output text); do
  aws ec2 modify-volume --volume-id "$v" --volume-type gp3
done
aws ec2 describe-volumes-modifications --query 'VolumesModifications[].[VolumeId,ModificationState,Progress]' --output table

The change is online. Check large gp2 volumes first: their baseline IOPS (3 per GB) may exceed gp3's 3,000 default, so set --iops to match.

aws All AWS questions

More on Rapid-Fire AWS CLI