Display only the resources created when acquiring AWS resources with Boto3

Premise

When retrieving AWS resources with Boto3, some resources may include resources that you do not remember creating. These are probably created automatically by AWS or provided by default. In my case, when I tried to get the snapshot list, there was a resource I had never seen or made on the AWS console. The following is the source.

client = self.session.client('ec2')
snapshots = client.describe_snapshots()

Workaround

To display ** only those created by yourself **, specify `` `OwnerIds```.

View the resources you created

client = self.session.client('ec2')
snapshots = client.describe_snapshots(OwnerIds=['self'])

Specify user ID

client = self.session.client('ec2')
snapshots = client.describe_snapshots(OwnerIds=['xxxxxxxxxxxx'])

Recommended Posts

Display only the resources created when acquiring AWS resources with Boto3
Manage AWS nicely with the Python library Boto
Display only the lower half (upper half) with seaborn pair plot
Get AWS account ID with boto3
Behavior when returning in the with block
Display Python 3 in the browser with MAMP
EXE the application created with PyQt5 with PyInstaller
[AWS] Link Lambda and S3 with boto3
Display markers above the border with matplotlib
When changing the table name with flask_migrate
How to display in the entire window when setting the background image with tkinter
Boto3 (manipulate AWS resources with Python library) API that is often used privately