Created
January 13, 2021 00:41
-
-
Save bryanherger/aa652591aa166e02054d68c6d2e1678c to your computer and use it in GitHub Desktop.
Convert AWS EBS volumes in a region to gp3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you can save a bit of money and sometimes get better performance by upgrading older volume types to gp3. | |
# this script can update all volumes in a region; it's a "hot" upgrade so can be done on all. | |
# though you may wish to set a filter: in this examples, only update gp2 types are touched (--filter Name=volume-type,Values=gp2) | |
# this script takes one optional argument: region (default us-east-1) | |
# be sure to run "aws configure" and set a key pair or set an IAM role that can modify EBS volumes | |
#!/bin/bash | |
r=${1:-us-east-1} | |
for v in $(aws ec2 describe-volumes --query 'Volumes[*].[VolumeId]' --region $r --output text --filter Name=volume-type,Values=gp2) | |
do | |
echo $v | |
aws ec2 modify-volume --region $r --volume-id $v --volume-type gp3 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment