SNS Encryption Disabled
sns-encryption-disabled
What this rule checks
Detects SNS topics without encryption.
How to fix it
- 1Enable server-side encryption with KMS
- 2Use customer managed keys for additional control
import * as sns from 'aws-cdk-lib/aws-sns';
// inside your Stack
new sns.Topic(this, 'Topic');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::TopicIntentional? 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 scanCDK Insights runs this and 118+ other rules locally against your synthesised CDK app โ free, no account, your code never leaves your machine.