Skip to main content
HIGHEC2Security

EBS Volume Unencrypted

ebs-volume-unencrypted

What this rule checks

Detects EBS volumes without encryption.

How to fix it

  1. 1Enable EBS encryption by default in account settings
  2. 2Use KMS customer managed keys for additional control
FlaggedEncrypted is false, so the check flags the volume. (It also defaults to gp2, which the same ruleId flags as a cost item โ€” the conflation.)
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,
});
Fixedencrypted: true removes the encryption finding and volumeType gp3 removes the gp2 cost finding, so the ebs-volume-unencrypted ruleId produces nothing.
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::Volume

Compliance frameworks

SOC2HIPAAPCI-DSSCISNIST

AWS documentation

Read the AWS guidance

Intentional? 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 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 EC2 rules