This CloudFormation template creates an S3 bucket and configures it with a CloudTrail trail to capture management events. It also sets up a bucket policy to allow CloudTrail to write logs to the bucket.

CloudFormation Template