I have a case where I need to add IAM users
dynamically and send their credentials to their emails so that they can login to the AWS account
and do some operations like creating vpcs
, ec2 instances
, s3 buckets
, deleting resources
etc.
I also need to check what are the events that they have done in the AWS account
after logging in using the IAM username
.
I'm able to create IAM users
dynamically and send the credentials to user's emails.
I'm stuck at creating a cloudtrail
for each user separately. The basic idea is to have a separate cloudtrail
for each user whose events will be logged to it and stored in an S3 bucket
which has access permission for only specific username.
I have gone through boto3 cloudtrail
's create_trail() documentation. But didn't find an option where we can specify the user's name for which the cloudtrail should log the events.
Something like user1_trail, user2_trail, user3_trail which will be recording the events from user1, user2, user3 accordingly and will be storing in an S3 bucket
with names like user1_trails_file, user2_trails_file, user3_trails_file.
I was able to filter the cloudtrail
events based on user name in Cloudtrail section in AWS console
.
Is there any way to log the events for each user separately in different cloudtrails
?