Python AWS CDK: Creating a Trail in CloudTrail
CloudTrail is a very useful tool in AWS especially for more sensitive environments where logging is essential. AWS CDK is a great tool that lets you create your stack by writing actual code instead of writing YAML or JSON files. What happens when you combined the two? Well, right now CDK's CloudTrail support is in developer preview so accomplishing some of the things you might want gets a little tricky. Let's run through a few things and see what CDK supports and where you have to fall back to the Cfn* functions. aws_cdk.aws_cloudtrail.Trail The basic construct for creating a Trail in CloudTrail is using the Trail construct. This has some basic support for creating a trail. Here is an example of creating a basic Trail using CDK: from aws_cdk import core, aws_cloudtrail ... trail = aws_cloudtrail.Trail( self, "MyTrail", management_events=aws_cloudtrail.ReadWriteType.ALL ) In the above example, we let CDK do a lot of the m