Skip to content

Instantly share code, notes, and snippets.

@joker1007
Created March 30, 2021 12:22
Show Gist options
  • Select an option

  • Save joker1007/49f6d65f6672a1ae27ef1b9544ea77e3 to your computer and use it in GitHub Desktop.

Select an option

Save joker1007/49f6d65f6672a1ae27ef1b9544ea77e3 to your computer and use it in GitHub Desktop.

Revisions

  1. joker1007 created this gist Mar 30, 2021.
    9 changes: 9 additions & 0 deletions extend_ebs.sh
    Original 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