EBS Volume Unencrypted
ebs-volume-unencrypted
What this rule checks
Detects EBS volumes without encryption.
How to fix it
- 1Enable EBS encryption by default in account settings
- 2Use KMS customer managed keys for additional control
import { Size } from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
// Unencrypted EBS volume.
new ec2.Volume(this, 'Volume', {
availabilityZone: 'eu-west-2a',
size: Size.gibibytes(50),
encrypted: false,
});import { Size } from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
// Encrypted at rest and gp3 (better price/performance than gp2).
new ec2.Volume(this, 'Volume', {
availabilityZone: 'eu-west-2a',
size: Size.gibibytes(50),
encrypted: true,
volumeType: ec2.EbsDeviceVolumeType.GP3,
});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::EC2::VolumeIntentional? Suppress this finding
Sometimes a flag is deliberate โ a genuinely public endpoint, say. You can dismiss ebs-volume-unencrypted and the reason is kept in the report, not silently hidden.
In .cdk-insights.json:
{
"ignoreRules": [
{ "id": "ebs-volume-unencrypted", "reason": "Why this is intentional" }
]
}Or inline in your CDK code:
Validations.of(scope).acknowledge({
id: 'cdk-insights::ebs-volume-unencrypted',
reason: 'Why this is intentional',
});Use the rule ID ebs-volume-unencrypted 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.