Created
March 30, 2021 12:22
-
-
Save joker1007/49f6d65f6672a1ae27ef1b9544ea77e3 to your computer and use it in GitHub Desktop.
extend_ebs.sh
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
instance_ids="" | |
device_name="" | |
for vol in $(aws ec2 describe-instances --region ap-northeast-1 --instance-ids ${instance_ids} | jq '.Reservations[].Instances[] | .BlockDeviceMappings[] | select(.DeviceName == "'${device_name}'") | .Ebs.VolumeId' -r); do | |
current=$(aws ec2 describe-volumes --volume-ids ${vol} | jq '.Volumes[] | .Size') | |
target=$(expr $current + 50) | |
echo "${vol}: ${current} -> ${target}" | |
echo "aws ec2 modify-volume --volume-id ${vol} --size ${target} --dry-run" | |
#aws ec2 modify-volume --volume-id ${vol} --size ${target} --dry-run | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment