Enabling CloudTrail using CloudFormation

We will create a new script in our EffectiveDevOpsTemplates repository and call it cloudtrail-cf-template.py.

We will start with our script with our usual boilerplate:

"""Generating CloudFormation template.""" 
from troposphere import Join 
from troposphere import ( 
from troposphere.s3 import Bucket 
from troposphere.s3 import BucketPolicy 
from troposphere.cloudtrail import Trail
t = Template() 
t.add_description("Effective DevOps in AWS: Turn on CloudTrail and log to S3") 

Out of the box, CloudTrail will retain 7 days' worth  of activity. In order to keep the data for longer, we will configure the service to log any activity to S3. In order to do that, we will first create an S3 bucket. ...

Get Effective DevOps with AWS now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.