{"id":2427,"date":"2024-01-12T15:33:18","date_gmt":"2024-01-12T15:33:18","guid":{"rendered":"https:\/\/www.maghilda.com\/staging\/9669\/?p=2427"},"modified":"2024-01-12T16:40:41","modified_gmt":"2024-01-12T16:40:41","slug":"howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down","status":"publish","type":"post","link":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/","title":{"rendered":"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down"},"content":{"rendered":"\n<p>This post is on how to create a CloudTrail Trail with S3 and CloudWatch in CloudFormation.<\/p>\n\n\n\n<p>In my <a href=\"https:\/\/www.maghilda.com\/staging\/9669\/8-tips-for-aws-cloudtrail-for-security-monitoring-and-best-practices\/\">previous article<\/a>, I had provided 8 tips on how to configure CloudTrail for secure logging and auditing via the AWS management console. In this post, I have covered the same secure options using the much preferred and popular Infrastructure as Code using Cloud Formation.<\/p>\n\n\n\n<p>This template covers the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"padding-right:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)\">\n<li>Create a CloudTrail Trail to log management events for all accounts under AWS Organization<\/li>\n\n\n\n<li>Create an encrypted S3 bucket associated with the trail<\/li>\n\n\n\n<li>Create CloudWatch logs and role associated with the trail<\/li>\n\n\n\n<li>Create CMK keys (SSE-KMS) for S3 and CloudTrail<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>AWSTemplateFormatVersion: 2010-09-09\nDescription: test createtrail function \n\nParameters:\n  CloudTrailName:\n    Type: String\n    Default: 'management-events-maghilda'\n  CloudTrailBucketName:\n    Type: String\n    Default: 'cloudtrail-maghilda'\n  CloudTrailBucketPrefix:\n    Type: String\n    Default: 'maghildaevents'\n  OrganizationRoot:\n    Type: String \n    Default: 'o-2rty7as5fl'\n\nResources:\n  # Create a new log group\n  LogGroup: \n    Type: AWS::Logs::LogGroup\n    Properties:\n      RetentionInDays: 365 # optional\n  #Create a new bucket with all the secure options and encryption\n  CloudTrailBucket: \n    Type: AWS::S3::Bucket\n    DeletionPolicy: Retain  #delete manually after the delete stack command  \n    Properties:\n      BucketName: !Ref CloudTrailBucketName\n      AccessControl: Private\n      PublicAccessBlockConfiguration:\n        BlockPublicAcls: true\n        IgnorePublicAcls: true\n        BlockPublicPolicy: true\n        RestrictPublicBuckets: true\n      ObjectLockEnabled: true\n      ObjectLockConfiguration:\n        ObjectLockEnabled: 'Enabled'\n        Rule:\n          DefaultRetention:\n            Mode: GOVERNANCE\n            Days: 90\n      BucketEncryption:\n        ServerSideEncryptionConfiguration:\n        - ServerSideEncryptionByDefault:\n            KMSMasterKeyID: !Sub 'arn:aws:kms:${AWS::Region}:${AWS::AccountId}:${CloudTrailKeyS3Alias}'\n            SSEAlgorithm: 'aws:kms'\n    DependsOn:\n      - CloudTrailKeyS3\n      - CloudTrailKeyS3Alias\n  #Create a bucket policy\n  CloudTrailBucketPolicy:\n    DependsOn:\n        - CloudTrailBucket\n    Type: AWS::S3::BucketPolicy\n    Properties:\n      Bucket: !Ref CloudTrailBucket\n      PolicyDocument:\n        Version: \"2012-10-17\"\n        Statement:\n          - Sid: AWSCloudTrailAclCheck\n            Effect: Allow\n            Principal:\n              Service: 'cloudtrail.amazonaws.com'\n            Action: 's3:GetBucketAcl'\n            Resource: !Sub 'arn:aws:s3:::${CloudTrailBucket}'\n          - Sid: AWSCloudTrailWrite\n            Effect: Allow\n            Principal:\n              Service: 'cloudtrail.amazonaws.com'\n            Action: 's3:PutObject'\n            Resource: !Sub 'arn:aws:s3:::${CloudTrailBucket}\/${CloudTrailBucketPrefix}\/AWSLogs\/${AWS::AccountId}\/*'\n            Condition:\n              StringEquals:\n                's3:x-amz-acl': 'bucket-owner-full-control'        \n                'aws:SourceArn': !Sub 'arn:aws:cloudtrail:${AWS::Region}:${AWS::AccountId}:trail\/${CloudTrailName}'\n          - Sid: AWSCloudTrailWriteOrg\n            Effect: Allow\n            Principal:\n              Service: 'cloudtrail.amazonaws.com'\n            Action: 's3:PutObject'\n            Resource: !Sub 'arn:aws:s3:::${CloudTrailBucket}\/${CloudTrailBucketPrefix}\/AWSLogs\/${OrganizationRoot}\/*' #log for all accounts in the org\n            Condition:\n              StringEquals:\n                's3:x-amz-acl': 'bucket-owner-full-control'        \n                'aws:SourceArn': !Sub 'arn:aws:cloudtrail:${AWS::Region}:${AWS::AccountId}:trail\/${CloudTrailName}'\n  # Create a role for CloudWatch logs\n  CloudTrailLogsRole: \n    Type: AWS::IAM::Role\n    Properties:\n      AssumeRolePolicyDocument:\n        Version: '2012-10-17'\n        Statement:\n        - Action: sts:AssumeRole\n          Effect: Allow\n          Principal:\n            Service: cloudtrail.amazonaws.com\n  # Define a policy for the role      \n  CloudTrailLogsPolicy: \n    Type: AWS::IAM::Policy\n    Properties:\n      PolicyDocument:\n        Statement:\n        - Action:\n          - logs:PutLogEvents\n          - logs:CreateLogStream\n          Effect: Allow\n          Resource: !GetAtt LogGroup.Arn\n        Version: '2012-10-17'\n      PolicyName: DefaultPolicy\n      Roles:\n      - Ref: CloudTrailLogsRole\n  #Create a new trail with secure options and KMS encryption\n  CloudTrail: \n    Type: AWS::CloudTrail::Trail\n    Properties:\n      TrailName: !Ref CloudTrailName\n      CloudWatchLogsLogGroupArn: !GetAtt LogGroup.Arn\n      CloudWatchLogsRoleArn: !GetAtt CloudTrailLogsRole.Arn\n      EnableLogFileValidation: true\n      IncludeGlobalServiceEvents: true\n      S3BucketName: !Ref CloudTrailBucket\n      S3KeyPrefix: !Ref CloudTrailBucketPrefix\n      IsLogging: true\n      IsMultiRegionTrail: true\n      IsOrganizationTrail: true\n      KMSKeyId: !GetAtt CloudTrailKey.Arn\n    DependsOn:\n    - CloudTrailLogsPolicy\n    - CloudTrailLogsRole\n    - CloudTrailBucket\n    - CloudTrailBucketPolicy\n    - CloudTrailKey\n  #Create a new CMK for the trail\n  CloudTrailKey:\n    Type: AWS::KMS::Key\n    Properties:\n      KeyPolicy:\n        Version: 2012-10-17\n        Id: key-cloudtrail\n        Statement:\n          - Sid: Enable IAM User Permissions\n            Effect: Allow\n            Principal:\n              AWS: \n                - !Sub 'arn:aws:iam::${AWS::AccountId}:root'\n                - !Sub 'arn:aws:sts::${AWS::AccountId}:assumed-role\/AWSReservedSSO_AdministratorAccess_234hdfj4857555\/maghilda_user'\n            Action: 'kms:*'\n            Resource: '*'\n          - Sid: Allow CloudTrail to encrypt logs\n            Effect: Allow\n            Principal:\n              Service:\n                - cloudtrail.amazonaws.com\n            Action: 'kms:GenerateDataKey*'\n            Resource: '*'\n            Condition:\n              StringLike:\n                'kms:EncryptionContext:aws:cloudtrail:arn': !Sub 'arn:aws:cloudtrail:*:${AWS::AccountId}:trail\/*'\n                'aws:SourceArn': !Sub 'arn:aws:cloudtrail:${AWS::Region}:${AWS::AccountId}:trail\/${CloudTrailName}'\n          - Sid: Allow CloudTrail to describe key\n            Effect: Allow\n            Principal:\n              Service:\n                - cloudtrail.amazonaws.com\n            Action: 'kms:DescribeKey'\n            Resource: '*'\n          - Sid: Allow principals in the account to decrypt log files\n            Effect: Allow\n            Principal:\n              AWS: '*'\n            Action:\n              - 'kms:Decrypt'\n              - 'kms:ReEncryptFrom'\n            Resource: '*'\n            Condition:\n              StringEquals:\n                'kms:CallerAccount': !Sub '${AWS::AccountId}'\n              StringLike:\n                'kms:EncryptionContext:aws:cloudtrail:arn': !Sub 'arn:aws:cloudtrail:*:${AWS::AccountId}:trail\/*'\n          - Sid: Allow alias creation during setup\n            Effect: Allow\n            Principal:\n              AWS: '*'\n            Action: 'kms:CreateAlias'\n            Resource: '*'\n            Condition:\n              StringEquals:\n                'kms:ViaService': ec2.us-east-1.amazonaws.com\n                'kms:CallerAccount': !Sub '${AWS::AccountId}'\n          - Sid: Enable cross account log decryption\n            Effect: Allow\n            Principal:\n              AWS: '*'\n            Action:\n              - 'kms:Decrypt'\n              - 'kms:ReEncryptFrom'\n            Resource: '*'\n            Condition:\n              StringEquals:\n                'kms:CallerAccount': !Sub '${AWS::AccountId}'\n              StringLike:\n                'kms:EncryptionContext:aws:cloudtrail:arn': !Sub 'arn:aws:cloudtrail:*:${AWS::AccountId}:trail\/*'\n  #Create an alias for the CloudTrail key\n  CloudTrailKeyAlias:\n    Type: AWS::KMS::Alias\n    Properties:\n      AliasName: alias\/cloudtrail\n      TargetKeyId:\n        Ref: CloudTrailKey\n  #Create a new CMK for S3 bucket \n  CloudTrailKeyS3:\n    Type: AWS::KMS::Key\n    Properties:\n      KeyPolicy:\n        Version: 2012-10-17\n        Id: key-cloudtrails3\n        Statement:\n          - Sid: Enable IAM User Permissions\n            Effect: Allow\n            Principal:\n              AWS: \n                - !Sub 'arn:aws:iam::${AWS::AccountId}:root'\n                - !Sub 'arn:aws:sts::${AWS::AccountId}:assumed-role\/AWSReservedSSO_AdministratorAccess_234hdfj4857555\/maghilda_user'\n            Action: 'kms:*'\n            Resource: '*'\n          - Sid: Allow VPC Flow Logs to use the key\n            Effect: Allow\n            Principal:\n              Service:\n                - delivery.logs.amazonaws.com\n            Action: 'kms:GenerateDataKey*'\n            Resource: '*'\n  #Create an alias for the s3 bucket key\n  CloudTrailKeyS3Alias:\n    Type: AWS::KMS::Alias\n    Properties:\n      AliasName: alias\/cloudtrails3\n      TargetKeyId:\n        Ref: CloudTrailKeyS3\n\nOutputs:\n  CloudTrailLogsRoleArn:\n    Value: !GetAtt CloudTrailLogsRole.Arn\n\n  LogGroupArn:\n    Value: !GetAtt LogGroup.Arn<\/code><\/pre>\n\n\n\n<p>Save the file as createtrail-template.yml. Please note that I am using service linked role for IAM Identity Center with the name prefix AWSReservedSSO_<\/p>\n\n\n\n<p>Create the above stack via the CLI<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation create-stack --stack-name testcreatetrail --template-body file:\/\/createtrail-template.yml --capabilities CAPABILITY_IAM<\/code><\/pre>\n\n\n\n<p>This stack will take a few minutes to create. Run the following command to check the status<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation describe-stacks --stack-name testcreatetrail<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Clean up resources<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>#delete stack\naws cloudformation delete-stack --stack-name testcreatetrail<\/code><\/pre>\n\n\n\n<p>Since CloudFormation cannot delete a non-empty S3 bucket, you have to manually empty and delete the bucket<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#empty\naws s3 rm  s3:\/\/cloudtrail-maghilda \u2014recursive\n\n#delete\naws s3api delete-bucket --bucket cloudtrail-maghilda<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">References<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.aws.amazon.com\/awscloudtrail\/latest\/userguide\/create-s3-bucket-policy-for-cloudtrail.html\">https:\/\/docs.aws.amazon.com\/awscloudtrail\/latest\/userguide\/create-s3-bucket-policy-for-cloudtrail.html<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/awscloudtrail\/latest\/userguide\/cloudtrail-set-bucket-policy-for-multiple-accounts.html\">https:\/\/docs.aws.amazon.com\/awscloudtrail\/latest\/userguide\/cloudtrail-set-bucket-policy-for-multiple-accounts.html<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/widdix\/aws-cf-templates\/blob\/master\/security\/cloudtrail.yaml\">https:\/\/github.com\/widdix\/aws-cf-templates\/blob\/master\/security\/cloudtrail.yaml<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/getcft\/aws-cloudtrail-cf-template\/blob\/master\/cloudtrail-cf-template.yml\">https:\/\/github.com\/getcft\/aws-cloudtrail-cf-template\/blob\/master\/cloudtrail-cf-template.yml<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/IAM\/latest\/UserGuide\/reference_policies_elements_principal.html\">https:\/\/docs.aws.amazon.com\/IAM\/latest\/UserGuide\/reference_policies_elements_principal.html<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/pseudo-parameter-reference.html\">https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/pseudo-parameter-reference.html<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/singlesignon\/latest\/userguide\/using-service-linked-roles.html\">https:\/\/docs.aws.amazon.com\/singlesignon\/latest\/userguide\/using-service-linked-roles.html<\/a><\/li>\n<\/ul>\n\n\n\n<p>Hope you find this useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is on how to create a CloudTrail Trail with S3 and CloudWatch in CloudFormation. In my previous article, I had provided 8 tips on how to configure CloudTrail for secure logging and auditing via the AWS management console. In this post, I have covered the same secure options using the much preferred and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[12,41,54,55,57,25],"tags":[43,53,56],"class_list":["post-2427","post","type-post","status-publish","format-standard","hentry","category-aws-tutorial","category-cloudformation","category-cloudtrail","category-cloudwatch","category-kms","category-s3","tag-cloudformation","tag-cloudtrail","tag-cloudwatch"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down - maghilda<\/title>\n<meta name=\"description\" content=\"HOWTO Build CloudTrail Trail with CloudFormation Template for easy builds and tear down\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down - maghilda\" \/>\n<meta property=\"og:description\" content=\"HOWTO Build CloudTrail Trail with CloudFormation Template for easy builds and tear down\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/\" \/>\n<meta property=\"og:site_name\" content=\"maghilda\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-12T15:33:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-12T16:40:41+00:00\" \/>\n<meta name=\"author\" content=\"vibs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"vibs\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/\"},\"author\":{\"name\":\"vibs\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/person\\\/21009c5e4f1817ea18c81d5004bcec1e\"},\"headline\":\"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down\",\"datePublished\":\"2024-01-12T15:33:18+00:00\",\"dateModified\":\"2024-01-12T16:40:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/\"},\"wordCount\":266,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\"},\"keywords\":[\"cloudformation\",\"CloudTrail\",\"CloudWatch\"],\"articleSection\":[\"AWS Tutorial\",\"CloudFormation\",\"CloudTrail\",\"CloudWatch\",\"KMS\",\"S3\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/\",\"name\":\"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down - maghilda\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#website\"},\"datePublished\":\"2024-01-12T15:33:18+00:00\",\"dateModified\":\"2024-01-12T16:40:41+00:00\",\"description\":\"HOWTO Build CloudTrail Trail with CloudFormation Template for easy builds and tear down\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#website\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\",\"name\":\"maghilda.com\",\"description\":\"Technology blog focused on cloud computing, emerging technologies, software development and security.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\",\"name\":\"maghilda.com\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-logo_red.png\",\"contentUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-logo_red.png\",\"width\":512,\"height\":512,\"caption\":\"maghilda.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/person\\\/21009c5e4f1817ea18c81d5004bcec1e\",\"name\":\"vibs\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"caption\":\"vibs\"},\"sameAs\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\"],\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/author\\\/obliczte\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down - maghilda","description":"HOWTO Build CloudTrail Trail with CloudFormation Template for easy builds and tear down","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/","og_locale":"en_US","og_type":"article","og_title":"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down - maghilda","og_description":"HOWTO Build CloudTrail Trail with CloudFormation Template for easy builds and tear down","og_url":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/","og_site_name":"maghilda","article_published_time":"2024-01-12T15:33:18+00:00","article_modified_time":"2024-01-12T16:40:41+00:00","author":"vibs","twitter_card":"summary_large_image","twitter_misc":{"Written by":"vibs","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/#article","isPartOf":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/"},"author":{"name":"vibs","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/person\/21009c5e4f1817ea18c81d5004bcec1e"},"headline":"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down","datePublished":"2024-01-12T15:33:18+00:00","dateModified":"2024-01-12T16:40:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/"},"wordCount":266,"commentCount":0,"publisher":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization"},"keywords":["cloudformation","CloudTrail","CloudWatch"],"articleSection":["AWS Tutorial","CloudFormation","CloudTrail","CloudWatch","KMS","S3"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/","url":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/","name":"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down - maghilda","isPartOf":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#website"},"datePublished":"2024-01-12T15:33:18+00:00","dateModified":"2024-01-12T16:40:41+00:00","description":"HOWTO Build CloudTrail Trail with CloudFormation Template for easy builds and tear down","breadcrumb":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.maghilda.com\/staging\/9669\/"},{"@type":"ListItem","position":2,"name":"HOWTO: Build CloudTrail Trail with CloudFormation Template for easy builds and tear down"}]},{"@type":"WebSite","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#website","url":"https:\/\/www.maghilda.com\/staging\/9669\/","name":"maghilda.com","description":"Technology blog focused on cloud computing, emerging technologies, software development and security.","publisher":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.maghilda.com\/staging\/9669\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization","name":"maghilda.com","url":"https:\/\/www.maghilda.com\/staging\/9669\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/logo\/image\/","url":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2023\/12\/cropped-logo_red.png","contentUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2023\/12\/cropped-logo_red.png","width":512,"height":512,"caption":"maghilda.com"},"image":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/person\/21009c5e4f1817ea18c81d5004bcec1e","name":"vibs","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","caption":"vibs"},"sameAs":["https:\/\/www.maghilda.com\/staging\/9669"],"url":"https:\/\/www.maghilda.com\/staging\/9669\/author\/obliczte\/"}]}},"_links":{"self":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/comments?post=2427"}],"version-history":[{"count":4,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2427\/revisions"}],"predecessor-version":[{"id":2444,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2427\/revisions\/2444"}],"wp:attachment":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/media?parent=2427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/categories?post=2427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/tags?post=2427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}