Create a CloudTrail trail that logs API activity to an S3 bucket, look up recent events, and clean up.
https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-tutorial.html
- ID: cloudtrail/getting-started
- Phase: create
- Complexity: beginner
- Core actions: cloudtrail:CreateTrail, cloudtrail:StartLogging, cloudtrail:LookupEvents
- Creates an S3 bucket for trail logs
- Sets the bucket policy to allow CloudTrail writes
- Creates a trail pointing to the bucket
- Starts logging
- Looks up recent API events
- Describes the trail configuration
bash aws-cloudtrail-gs.shTo auto-run with cleanup:
echo 'y' | bash aws-cloudtrail-gs.sh- CloudTrail trail
- S3 bucket (with CloudTrail bucket policy)
- Run: ~10 seconds
S3 storage only. CloudTrail delivers management event logs to S3 at no charge for the first trail. S3 storage costs apply for the log files.