less than 1 minute read

Here’s how to modify the size of the volume attached to an EC2 instance “my_ec2”:

  • First identify the instance ID from the instance name:
$ jq -r '.Reservations[0].Instances[0].InstanceId' \
    <(aws ec2 describe-instances --filters Name="tag:Name",Values="bfg-devbox")
i-02f8f997c05932f66
  • Then identify the ID of the attached volume:
$ jq -r '.Volumes[0].VolumeId' \
    <(aws ec2 describe-volumes --filter Name="attachment.instance-id",Values="i-02f8f997c05932f66")
vol-0abf653a810ee073b
  • And now you can modify the volume size:
aws ec2 modify-volume --volume-id vol-0abf653a810ee073b --size 256 --dry-run

Via AWS describe-instances, describe-volumes, and modify-volume docs.

Leave a comment