Last active
August 6, 2019 05:54
-
-
Save linjungz/1e59d84aefbef4e9c56587dc402f6e45 to your computer and use it in GitHub Desktop.
Filter EBS volumes by tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
client = boto3.client('ec2') | |
volumes = client.describe_volumes( | |
Filters = [ | |
{ | |
'Name': 'tag:Owner', | |
'Values': [ | |
'Randy' | |
] | |
} | |
] | |
) | |
for volume in volumes['Volumes']: | |
print(volume['VolumeId']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment