Created
March 30, 2021 12:22
-
-
Save joker1007/49f6d65f6672a1ae27ef1b9544ea77e3 to your computer and use it in GitHub Desktop.
Revisions
-
joker1007 created this gist
Mar 30, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ 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