Description
DynamoDB encrypts every table. Keep the default AWS owned key if it meets your requirements. An AWS managed key gives you visibility into key use in your account. A customer-managed key lets you control its policy and lifecycle.
Potential impact
Disabling a customer-managed key or removing required permissions can make the table or its backups inaccessible.
Remediation
For a customer-managed key, specify SSEEnabled: true, SSEType: KMS and the approved KMSMasterKeyId. Review key permissions and rotation separately from table access. After applying the change, verify the table's active key and test reads. Keep the old key available for any backups that still rely on it.
Examples
Both templates configure the same table. Review the change set before updating it.
AWS owned key
AWSTemplateFormatVersion: "2010-09-09"
Description: Sample CloudFormation template for DynamoDB with AWS-Owned CMK
Resources:
DynamoDBOnDemandTable2:
Type: AWS::DynamoDB::Table
Properties:
TableName: dynamodb-kms-0
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
KeySchema:
- AttributeName: pk
KeyType: HASH
BillingMode: PAY_PER_REQUEST
SSESpecification:
SSEEnabled: false
SSEEnabled: false selects the AWS owned key.
Customer managed key
AWSTemplateFormatVersion: "2010-09-09"
Description: Sample CloudFormation template for DynamoDB with customer managed CMK
Resources:
dynamodbKMSKey:
Type: AWS::KMS::Key
Properties:
Description: An example CMK
DynamoDBOnDemandTable2:
Type: AWS::DynamoDB::Table
Properties:
TableName: dynamodb-kms-0
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
KeySchema:
- AttributeName: pk
KeyType: HASH
BillingMode: PAY_PER_REQUEST
SSESpecification:
KMSMasterKeyId: !Ref dynamodbKMSKey
SSEEnabled: true
SSEType: KMS
The template creates dynamodbKMSKey and assigns it to the table. It uses the default key policy. Check that the deployment identity and table users have the access they need.