Skip to content

Instantly share code, notes, and snippets.

@linjungz
Last active August 6, 2019 05:54
Show Gist options
  • Save linjungz/1e59d84aefbef4e9c56587dc402f6e45 to your computer and use it in GitHub Desktop.
Save linjungz/1e59d84aefbef4e9c56587dc402f6e45 to your computer and use it in GitHub Desktop.
Filter EBS volumes by tag
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