I want to write a script that finds my unused volumes in AWS. (the 'status' of used volumes is 'in-use').
When I use the aws ec2 describe-volumes --filters Name=status,Values=available I got the next response for example.
{ "Volumes": [ { "Attachments": [], "AvailabilityZone": "us-east-1a", "CreateTime": "2022-04-21T08:45:29.704000+00:00", "Encrypted": false, "Size": 1, "SnapshotId": "", "State": "available", "VolumeId": "vol-0e81644ad6193439f", "Iops": 100, "Tags": [ { "Key": "sre", "Value": "test" } ], "VolumeType": "gp2", "MultiAttachEnabled": false } ] }
I want to save just the state, volumeId & tags.
Volumes
array and theTags
array)?