DynamoDB table should be encrypted with AWS KMS¶
Ensure that encryption is enabled for your AWS DynamoDB tables. Because sensitive data can exist at rest in these tables, enable encryption at rest to help protect that data.
How to fix¶
Resource aws_dynamodb_table must exist.
Implementation options¶
Choose the option that matches how you manage Terraform. All options satisfy this control.
Option 1: Compliance.tf module (recommended)¶
Use the compliance.tf registry module to get this control enforced by default. This control is mapped to the frameworks shown in the tabs above. To begin, see get started with compliance.tf.
module "dynamodb_table" {
source = "cfrpart11.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "cisacyberessentials.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "eugmpannex11.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "gdpr.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "hipaa.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "hipaasecurity2003.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "nist800171.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "nist80053rev4.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "nist80053.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "nistcsfv11.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "nydfs23.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "pcidssv321.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "pcidss.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
module "dynamodb_table" {
source = "rbicybersecurity.compliance.tf/terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
Option 2: Open source module (terraform-aws-modules)¶
If you use terraform-aws-modules/dynamodb-table/aws, configure the required module inputs to satisfy this control. You can later migrate to the compliance.tf module with minimal changes because it is compatible by design.
module "dynamodb_table" {
source = "terraform-aws-modules/dynamodb-table/aws"
version = ">=5.0.0"
attributes = [
{
name = "id"
type = "S"
}
]
hash_key = "id"
name = "abc123"
server_side_encryption_enabled = true
server_side_encryption_kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
Option 3: Terraform AWS provider resources¶
If you manage resources directly, configure the relevant Terraform AWS provider resources to meet this control. See docs for the resources involved: aws_dynamodb_table.
resource "aws_dynamodb_table" "this" {
attribute {
name = "id"
type = "S"
}
billing_mode = "PAY_PER_REQUEST"
hash_key = "id"
name = "pofix-example-table"
server_side_encryption {
enabled = true
kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
}
}
Which option should I choose?
- Compliance.tf module (recommended): controls enforced by default and mapped to frameworks.
- Open source module (
terraform-aws-modules): compatible by design with compliance.tf. Same variable names for an easy, low-change migration path when you are ready. - Terraform AWS provider resources: manage Terraform resources directly.
Tool mappings¶
Use these identifiers to cross-reference this control across tools, reports, and evidence.
Compliance.tf (CTF) Control:
dynamodb_table_encrypted_with_kmsAWS Config Managed Rule:
DYNAMODB_TABLE_ENCRYPTED_KMSCheckov Check:
CKV_AWS_119Powerpipe Control:
aws_compliance.control.dynamodb_table_encrypted_with_kms