53 gp2 volumes, a CSV, and a status that is not "completed"

An EBS type migration done in two stages — inventory first, modify second — and the one API detail that decides how long it takes.

Infra

The inventory

list_wireless_instances_volumes.sh walks every region returned by describe-regions (all of them, every run), filters instances on a tag:Name prefix, and emits one CSV row per attached volume:

InstanceID,InstanceName,Region,VolumeID,VolumeType,SizeGiB,IOPS,Throughput,State

The run that mattered came back with 156 volumes on 52 instances across six regions (29,325 GiB in total), every one of them in-use. 103 were already gp3; 53 were still gp2 (34% of the fleet, spread over all six regions).

The gp2 rows are recognisable before you read the type column. Their Throughput reads N/A (gp2 has no throughput setting to report), and their IOPS come in exactly three values — 100, 150 and 1500. That is gp2's formula showing through: three IOPS per GiB, with a floor of 100. The IOPS number therefore tells you the size (1500 is a 500 GiB volume, 150 is a 50 GiB volume, 100 is anything under 34 GiB). The target is gp3 at a flat 3000 IOPS and 125 MB/s — more than every one of those 53 volumes had, including the 1500-IOPS ones.

Two scripts, not one

gp2-to-gp3.sh discovers everything itself. Four calls, in order: describe-regions, describe-instances filtered on the Name prefix, jq over BlockDeviceMappings[].Ebs.VolumeId, then describe-volumes per volume. gp2-to-gp3-from-csv.sh takes the inventory file as input instead, drops the jq dependency entirely (awk and a read loop), and adds two flags of its own (--status, --gp2-only).

Both default to dry run (no --apply, no API write). --apply is the only flag that changes anything, and both print CSV to stdout with an Action column, so a dry run is a plan you can diff:

Action,Region,InstanceID,InstanceName,VolumeID,CurrentType,NewType,NewIOPS,NewThroughput,Result
Plan,us-east-1,i-0...,...,vol-0...,gp2,gp3,3000,125,dry-run
Skip,us-east-1,i-0...,...,vol-0...,gp3,gp3,3000,125,not-gp2

The second script exists because of the review step. 156 rows is a file a person can read end to end. Separating discovery from modification means the thing you approve is the thing that runs — no second describe-instances call between approval and modify-volume, and so no chance of a different set.

Why "optimizing" counts as done

wait_for_mod polls describe-volumes-modifications every 10 seconds (the default, overridable) and returns success on a ModificationState of either optimizing or completed. Treating optimizing as done is the whole trick. A gp2 to gp3 modify-volume reaches optimizing in seconds, and at that point the volume already reports as gp3 at the new settings (3000 IOPS, 125 MB/s); completed arrives only after a background optimisation that can run for hours and changes nothing you asked for. Waiting for completed on 53 volumes, one after another, would have turned an afternoon into a week.

Two more details in that loop, both about distrusting the API's first answer. A modification record that does not exist yet reads back as unknown, which keeps waiting instead of failing. And the per-volume timeout is 1800 seconds, after which the row records timeout after 1800s with the last state and progress, so a stall lands in the output where the next run can see it.

The latency tester, and why there are two of it

A separate script measures round-trip time to s3.<region>.amazonaws.com for 33 regions, ten pings each (PING_COUNT=10), printing four numbers per region (min, average, max, deviation). There are two copies of it, and the reason is ping, not AWS.

The Linux version greps rtt min/avg/max/mdev. It resolves the name itself with dig +short @8.8.8.8, falling back to nslookup when that returns nothing. The macOS version greps round-trip min/avg/max/stddev. It lets ping resolve, then scrapes the address out of ping's own first line. Different label, different statistic name, different resolution path — one script could handle both (a uname check and two greps), and copying the file took thirty seconds.

Its real limitation is on one line: head -n 1. Only the first A record is pinged (one of several an S3 endpoint returns). What the table shows is the latency to one S3 edge per region — useful for ranking regions, useless as an absolute number (and not stable between runs).