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()
To display ** only those created by yourself **, specify `` `OwnerIds```.
client = self.session.client('ec2')
snapshots = client.describe_snapshots(OwnerIds=['self'])
client = self.session.client('ec2')
snapshots = client.describe_snapshots(OwnerIds=['xxxxxxxxxxxx'])
Recommended Posts