2

I'm trying to get the User Owner of any particular AWS resource, be it instance, volume, security group etc..

I searched but could not find any helpful information apart from this Link, This is what I found closer [The answer suggests we can get the user who created an instance] to what I'm looking for but still couldn't use it as the code mentioned is not complete.

If I consider the code from above mentioned post's answer, the following line

ct_conn = sess.client(service_name='cloudtrail',region_name='us-east-1')

is mentioned without defining the "sess".

Community
  • 1
  • 1
karthik v
  • 1,104
  • 1
  • 14
  • 22
  • Why not just use AWS CLI, it is inherently faster than anything in Python. You could also put it in your code by using shell out. Something along the lines of this would work: `aws ec2 describe-instances --instance-ids instance-id`, edit: and the output is in JSON – gold_cy Mar 22 '17 at 11:14
  • I don't get it, how do I get user information from `aws ec2 describe-instances --instance-ids instance-id` – karthik v Mar 22 '17 at 11:36
  • Just replace `instance-id` with whatever the id is, should be something like `i-bunch_of_numbers_letters` and it will return you all the information about that instance in a JSON format – gold_cy Mar 22 '17 at 12:04
  • @DmitryPolonskiy : Please use common sense. Service can be brought up and terminate without a trace, what make you think describe-* will keep this info? Cloudtrails is mean for log all this activities. – mootmoot Mar 22 '17 at 12:29

1 Answers1

1

AWS will not records any AWS user activities info unless you setup Cloudtrail and send those info to S3 repository.

mootmoot
  • 12,845
  • 5
  • 47
  • 44