Skip to content

Instantly share code, notes, and snippets.

View akhil850's full-sized avatar
🏠
Working from home

Akhil Varughese akhil850

🏠
Working from home
View GitHub Profile
@akhil850
akhil850 / gp2gp3.sh
Created October 24, 2023 06:33 — forked from kepstein/gp2gp3.sh
Script to automatically change all gp2 volumes to gp3 with aws-cli
#! /bin/bash
region='us-east-1'
# Find all gp2 volumes within the given region
volume_ids=$(/usr/bin/aws ec2 describe-volumes --region "${region}" --filters Name=volume-type,Values=gp2 | jq -r '.Volumes[].VolumeId')
# Iterate all gp2 volumes and change its type to gp3
for volume_id in ${volume_ids};do
result=$(/usr/bin/aws ec2 modify-volume --region "${region}" --volume-type=gp3 --volume-id "${volume_id}" | jq '.VolumeModification.ModificationState' | sed 's/"//g')