More Info:
Amazon DynamoDB tables should be using AWS-managed Customer Master Keys (CMKs) instead of AWS-owned CMKs for Server-Side Encryption (SSE), in order to meet strict encryption compliance and regulatory requirements. DynamoDB supports to switch from AWS-owned CMKs to customer-managed CMKs managed using Amazon Key Management Service (KMS), without any code to encrypt the data.Risk Level
HighAddress
SecurityCompliance Standards
SOC2, GDPR, HIPAA, NIST, ISO27001Remediation
How to reconfigure existing DynamoDB tables to use AWS-managed CMKs for Server-Side Encryption?Using AWS Console
- Open the AWS Management Console and navigate to the DynamoDB service.
- Select the desired DynamoDB table that you want to reconfigure. (In the Cloudanix Console, navigate to “Misconfig” page and look for Affected Assets for “AWS DynamoDB Tables Should Use KMS CMKs for Encryption” Policy.)
- Click on the “Manage DynamoDB” button or access the table configuration settings.
- In the table configuration settings, locate the “Encryption” section.
- Check if the table is already encrypted. If it is not, proceed to the next step.
- Click on the “Edit” button or the appropriate option to modify the encryption settings.
- In the encryption settings, choose the option to enable encryption and select “AWS managed key” as the encryption type.
- From the drop-down menu, select the AWS-managed CMK that you want to use for server-side encryption.
- Review any additional encryption-related settings, such as the type of encryption algorithm.
- Save the changes to apply the new encryption configuration to the DynamoDB table.
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are step‑by‑step console instructions to ensure DynamoDB tables use a customer‑managed KMS key (CMK) instead of the default AWS owned key.
These steps will remediate the finding by ensuring DynamoDB tables use a KMS CMK for encryption at rest.
1. Create (or Identify) a KMS CMK
- Sign in to the AWS Management Console.
- Go to AWS Key Management Service (KMS):
- In the search bar, type KMS and open Key Management Service.
- In the left pane, choose Customer managed keys.
- Click Create key.
- Configure the key:
- Key type: Symmetric.
- Key usage: Encrypt and decrypt.
- Click Next.
- Set Alias (e.g.,
alias/dynamodb-table-kms-key), optional description. - Configure Key administrators and Key users:
- Make sure the IAM roles/users that manage/operate DynamoDB have permission to use this key.
- Finish the wizard:
- Review and click Finish (or Create key).
2. Update an Existing DynamoDB Table to Use the CMK
- Go to the DynamoDB console.
- In the left pane, click Tables.
- Click on the table you want to remediate.
- In the table’s page, choose the Additional settings / Encryption tab (exact label may vary slightly).
- Under Encryption at rest:
- If it shows AWS owned CMK, click Edit.
- Select Customer managed key.
- In the dropdown, choose your CMK (e.g.,
alias/dynamodb-table-kms-key). - Click Save changes / Update.
3. Ensure New Tables Use CMKs by Default
There’s no single global default per service via console, so enforce this via process or templates:-
When creating any new table in the DynamoDB console:
- Click Create table.
- In the Table settings / Additional settings section, find Encryption at rest.
- Choose Customer managed key.
- Select the CMK you created.
- Complete table creation.
-
Optionally, enforce via:
- Standard CloudFormation/Terraform templates that specify
SSESpecificationwith a KMS key. - IAM policies that restrict use of AWS owned keys for DynamoDB (advanced/optional).
- Standard CloudFormation/Terraform templates that specify
These steps will remediate the finding by ensuring DynamoDB tables use a KMS CMK for encryption at rest.
Using CLI
Using CLI
Below are the CLI steps to ensure a DynamoDB table uses a customer-managed KMS key (CMK) for encryption.
Note the You can also reuse an existing CMK or alias, e.g.
You should see something like:
1. Identify the table and region
Decide which table(s) to fix and the AWS Region (e.g.,us-east-1).2. Create (or choose) a KMS CMK
2.1 Create a new CMK (if you don’t already have one)
KeyId in the output.Optionally, give it an alias:alias/dynamodb-cmk.3. Update the DynamoDB table to use the CMK
Useupdate-table and specify server-side encryption with KMS and your CMK (either KeyId or alias):4. Verify encryption settings
Status:ENABLEDSSEType:KMSKMSMasterKeyArn: your CMK ARN
Using Python
Using Python
Below is a practical, step‑by‑step approach using Python (boto3) to ensure DynamoDB tables are encrypted with a customer-managed KMS key (CMK).
Also ensure your IAM principal (user/role running the script) has
If you share any specific error you hit while running this, I can adjust the code or permissions for your case.
1. Prerequisites
- Python 3.x
boto3installed:- IAM permissions for:
dynamodb:DescribeTable,dynamodb:UpdateTablekms:DescribeKey
- A KMS CMK ARN you want to use (or create one in KMS console and copy its ARN).
2. Understand What You Need to Change
You want each DynamoDB table to have:SSEEnabled = TrueSSEType = "KMS"KMSMasterKeyId = "<your-cmk-arn>"
UpdateTable and the SSESpecification parameter.3. Python: Update a Single Table to Use CMK
4. Python: Bulk Remediation for All Tables in a Region
5. KMS Key Policy Considerations
Ensure the CMK key policy allows DynamoDB to use it. A minimal example statement (add to CMK key policy):kms:DescribeKey and, if needed, kms:ListAliases.If you share any specific error you hit while running this, I can adjust the code or permissions for your case.
Using Terraform
Using Terraform
server_side_encryption to use a CMK is an in-place update for existing DynamoDB tables and does not force replacement.To verify, terraform plan should show an in-place update (~) on the aws_dynamodb_table resource adding/updating the server_side_encryption block with enabled = true and kms_key_arn = arn:aws:kms:....
