Skip to main content
HIGHSNSSecurity

SNS Encryption Disabled

sns-encryption-disabled

What this rule checks

Detects SNS topics without encryption.

How to fix it

  1. 1Enable server-side encryption with KMS
  2. 2Use customer managed keys for additional control
FlaggedA Topic created with no `masterKey` synthesizes an AWS::SNS::Topic without a `KmsMasterKeyId`, so messages are not encrypted at rest. The check flags any SNS topic missing `KmsMasterKeyId` (HIGH, Security).
import * as sns from 'aws-cdk-lib/aws-sns';

// inside your Stack
new sns.Topic(this, 'Topic');
FixedPassing a `masterKey` sets `KmsMasterKeyId` on the topic, enabling KMS server-side encryption. With the key present the rule does not fire.
import * as sns from 'aws-cdk-lib/aws-sns';
import * as kms from 'aws-cdk-lib/aws-kms';

// inside your Stack
const key = new kms.Key(this, 'TopicKey');
new sns.Topic(this, 'Topic', { masterKey: key });

CDK Insights pinpoints the exact file and line in your CDK source for every finding, so you can jump straight to the fix.

Affected resource types

AWS::SNS::Topic

Compliance frameworks

SOC2HIPAAPCI-DSSNIST

AWS documentation

Read the AWS guidance

Intentional? Suppress this finding

Sometimes a flag is deliberate โ€” a genuinely public endpoint, say. You can dismiss sns-encryption-disabled and the reason is kept in the report, not silently hidden.

In .cdk-insights.json:

{
  "ignoreRules": [
    { "id": "sns-encryption-disabled", "reason": "Why this is intentional" }
  ]
}

Or inline in your CDK code:

Validations.of(scope).acknowledge({
  id: 'cdk-insights::sns-encryption-disabled',
  reason: 'Why this is intentional',
});

Use the rule ID sns-encryption-disabled shown above โ€” not the CDK-* ID from SARIF / GitHub code scanning. To dismiss every finding on one construct instead, use ignorePaths. Suppression docs โ†’

Catch this in your stack

$ npx cdk-insights scan

CDK Insights runs this and 118+ other rules locally against your synthesised CDK app โ€” free, no account, your code never leaves your machine.

More SNS rules