Skip to content

Instantly share code, notes, and snippets.

@sudharsans
sudharsans / ListInstanceOwner.py
Created February 16, 2018 16:47
list of all EC2 instances created by IAM user
import boto3
ec2 = boto3.client('ec2')
cloudtrail = boto3.client('cloudtrail')
def get_user(instanceid):
response = cloudtrail.lookup_events (
LookupAttributes=[
{
'AttributeKey': 'ResourceName',
module ToDo
class List
include Enumerable
def initialize
@items = []
end
def each(&block)
@items.each(&block)