Description
Set encryption_type = "KMS" on aws_kinesis_stream to encrypt new records at rest. Choose the AWS managed Kinesis key or a customer managed key required by your organization.
Potential impact
Previously unencrypted records stay that way until their retention period ends. Check how long older records will remain and who can read them.
Remediation
- Set
kms_key_idto the selected key. Check producer and consumer key permissions to avoid interrupting writes or reads. Configure stream access and TLS separately. - Once the stream returns to
ACTIVE, allow up to five seconds for encryption to take effect. Check forEncryptionType: KMSon a newPutRecordresponse and confirm a consumer can read the record.
Examples
Before
hcl
resource "aws_kinesis_stream" "event_stream" {
name = "terraform-kinesis-test"
shard_count = 1
retention_period = 48
encryption_type = "NONE"
}
retention_period = 48 keeps records for 48 hours. With NONE, Kinesis adds no server-side encryption to new records.
After
hcl
resource "aws_kinesis_stream" "event_stream" {
name = "terraform-kinesis-test"
shard_count = 1
retention_period = 48
encryption_type = "KMS"
kms_key_id = "alias/aws/kinesis"
}
alias/aws/kinesis selects the AWS managed key. The stream retains records for the same 48 hours.