Ensure CloudTrail logs are encrypted at rest using KMS CMKs

AWS CloudTrail is a web service that records AWS API calls for an account and makes those logs available to users and resources in accordance with IAM policies. AWS Key Management Service (KMS) is a managed service that helps create and control the encryption keys used to encrypt account data, and uses Hardware Security Modules (HSMs) to protect the security of encryption keys. CloudTrail logs can be configured to leverage server side encryption (SSE) and KMS customer created master keys (CMK) to further protect CloudTrail logs. It is recommended that CloudTrail be configured to use SSE-KMS.

Risk Level: Low
Cloud Entity: CloudTrail
CloudGuard Rule ID: D9.AWS.LOG.06
Category: Management Tools


CloudTrail should have kmsKeyId


From Portal

  1. Sign in to the AWS Management Console and navigate to CloudTrail.
  2. In the left navigation, select Trails.
  3. Click on a Trail you want to update.
  4. Under General details, click Edit.
  5. Under log file SSE-KMS encryption, select Enabled.
  6. In Customer managed AWS KMS key, either use a new or existing key.
  7. Enter the AWS KMS alias and click Save changes.

From TF

resource "aws_cloudtrail" "test" {
	name                          = "example1"
	s3_bucket_name                = "example2"
	+ kms_key_id                    = "CMK_KEY_ID"

Note: kms_key_id field (includes the KMS key ARN) is used to encrypt the logs delivered by CloudTrail.

From Command Line

  1. Use below put-key-policy command to provide the necessary permissions through updating the KMS key policy.
aws kms put-key-policy --key-id KMS_KEY --policy CLOUDTRAIL_KMS_KEY_POLICY
  1. Use below command to update the trail configuration with the KMS key ID.
aws cloudtrail update-trail --name TRAIL_NAME --kms-id KMS_KEY


  1. https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html
  2. https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html
  3. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudtrail
  4. https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudtrail/update-trail.html
  5. https://awscli.amazonaws.com/v2/documentation/api/latest/reference/kms/put-key-policy.html


AWS CloudTrail is a service that enables governance, compliance, operational auditing, and risk auditing of your AWS account. With CloudTrail, you can log, continuously monitor, and retain account activity related to actions across your AWS infrastructure. CloudTrail provides event history of your AWS account activity, including actions taken through the AWS Management Console, AWS SDKs, command line tools, and other AWS services. This event history simplifies security analysis, resource change tracking, and troubleshooting.

Compliance Frameworks

  • AWS CCPA Framework
  • AWS CIS Foundations v. 1.1.0
  • AWS CIS Foundations v. 1.2.0
  • AWS CIS Foundations v. 1.3.0
  • AWS CIS Foundations v. 1.4.0
  • AWS CIS Foundations v. 1.5.0
  • AWS CSA CCM v.3.0.1
  • AWS CloudGuard Best Practices
  • AWS CloudGuard SOC2 based on AICPA TSC 2017
  • AWS CloudGuard Well Architected Framework
  • AWS GDPR Readiness
  • AWS HITRUST v11.0.0
  • AWS ISO 27001:2013
  • AWS ITSG-33
  • AWS LGPD regulation
  • AWS MAS TRM Framework
  • AWS MITRE ATT&CK Framework v10
  • AWS MITRE ATT&CK Framework v11.3
  • AWS NIST 800-171
  • AWS NIST 800-53 Rev 4
  • AWS NIST 800-53 Rev 5
  • AWS NIST CSF v1.1
  • AWS PCI-DSS 3.2
  • AWS PCI-DSS 4.0