Other Articles

CloudWatch Log Group – Enable KMS Encryption

Secure Configuration Checks > AWS

This check ensures that every Amazon CloudWatch log group is encrypted with an AWS KMS key. Logs often hold sensitive data, so you should control who can read them.

Check Details

  • Resource: CloudWatch Log Group
  • Check: Enable log group KMS encryption (KmsEncryptionEnabled)
  • Risk: Log data cannot be protected with your own key and key policy

Remediation via AWS Console

  1. Open the Amazon CloudWatch console.

    Amazon CloudWatch Console
  2. Navigate to Logs > Log Management and select the affected log group.

  3. Check the KMS key ID in the log group details to verify whether a KMS key is associated.

  4. For new log groups, click Create log group, provide a name, select the required KMS key, and create the log group.

    Create CloudWatch Log Group

Note: AWS does not support associating a KMS key with an existing log group through the console. Use the AWS CLI to associate a key with an existing log group.

Remediation via AWS CLI

  1. Log in to the AWS Management Console and click the CloudShell icon (>_) in the top-right corner.

    AWS CloudShell
  2. List the log groups that have no KMS key:

    aws logs describe-log-groups \
    --query 'logGroups[?!kmsKeyId].logGroupName' \
    --output table
    

    The command covers one region. Add --region <region> to check another.

  3. If you have no suitable key, create one with a policy that lets CloudWatch Logs use it:

    cat > key-policy.json <<EOF
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "EnableIAMPermissions",
          "Effect": "Allow",
          "Principal": {"AWS": "arn:aws:iam::<account-id>:root"},
          "Action": "kms:*",
          "Resource": "*"
        },
        {
          "Sid": "AllowCloudWatchLogs",
          "Effect": "Allow",
          "Principal": {"Service": "logs.<region>.amazonaws.com"},
          "Action": [
            "kms:Encrypt*", "kms:Decrypt*", "kms:ReEncrypt*",
            "kms:GenerateDataKey*", "kms:Describe*"
          ],
          "Resource": "*",
          "Condition": {"ArnLike": {"kms:EncryptionContext:aws:logs:arn":
            "arn:aws:logs:<region>:<account-id>:log-group:*"}}
        }
      ]
    }
    EOF
    
    aws kms create-key \
    --policy file://key-policy.json \
    --description "CloudWatch Logs encryption" \
    --query 'KeyMetadata.Arn' \
    --output text
    
    
  4. Associate the key with the log group:

    aws logs associate-kms-key \
    --log-group-name <log-group-name> \
    --kms-key-id <kms-key-arn>
    
  5. Verify that the key is associated:

    aws logs describe-log-groups \
    --log-group-name-prefix <log-group-name> \
    --query 'logGroups[*].[logGroupName,kmsKeyId]' \
    --output table
    

Replace <log-group-name> with the log group name, for example /aws/lambda/my-function. Replace <kms-key-arn> with the key ARN, <region> with the region and <account-id> with your account ID. Repeat steps 4 and 5 for each log group.

Updated on 04 November, 2026