# aws-ec2-unencrypted-ebs-volume

Rule `sonarjs/aws-ec2-unencrypted-ebs-volume`. EBS volumes should be encrypted

- Source: sonarjs
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1172 by reach, #473 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/aws-ec2-unencrypted-ebs-volume` | yes | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-6275/) |

## Code examples

### Correct: the rule accepts this

```js
import { Size } from 'aws-cdk-lib';
import { Volume } from 'aws-cdk-lib/aws-ec2';

new Volume(this, 'encrypted-explicit', {
      availabilityZone: 'eu-west-1a',
      size: Size.gibibytes(1),
      encrypted: true
    });
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "sonarjs/aws-ec2-unencrypted-ebs-volume": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [sonarjs/aws-ec2-rds-dms-public](https://lintradar.dev/rules/sonarjs/aws-ec2-rds-dms-public.md): Public network access to cloud resources should be disabled
- [sonarjs/aws-efs-unencrypted](https://lintradar.dev/rules/sonarjs/aws-efs-unencrypted.md): Amazon EFS file systems should be encrypted
- [sonarjs/aws-apigateway-public-api](https://lintradar.dev/rules/sonarjs/aws-apigateway-public-api.md): AWS API Gateway should require authentication
- [sonarjs/aws-iam-all-privileges](https://lintradar.dev/rules/sonarjs/aws-iam-all-privileges.md): Policies should not grant all privileges
- [sonarjs/avoid-mutating-nested-properties-of-shallow-clones](https://lintradar.dev/rules/sonarjs/avoid-mutating-nested-properties-of-shallow-clones.md): Nested properties of Lodash and Underscore.js clone results should not be mutated
- [sonarjs/aws-iam-privilege-escalation](https://lintradar.dev/rules/sonarjs/aws-iam-privilege-escalation.md): AWS IAM policies should limit the scope of permissions given

---

Web page: https://lintradar.dev/rules/sonarjs/aws-ec2-unencrypted-ebs-volume. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
