# aws-opensearchservice-domain

Rule `sonarjs/aws-opensearchservice-domain`. OpenSearch domains should have encryption at rest enabled

- 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: #1177 by reach, #478 by growth

## Linters

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

## Code examples

### Correct: the rule accepts this

```js
import { aws_opensearchservice as opensearchservice } from 'aws-cdk-lib';

const exampleDomain = new opensearchservice.Domain(this, 'ExampleDomain', {
  version: EngineVersion.OPENSEARCH_1_3,
  encryptionAtRest: {
    enabled: true,
  },
});
```

```js
import { aws_opensearchservice as opensearchservice } from 'aws-cdk-lib';

const exampleCfnDomain = new opensearchservice.CfnDomain(this, 'ExampleCfnDomain', {
  engineVersion: 'OpenSearch_1.3',
  encryptionAtRestOptions: {
    enabled: true,
  },
});
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "sonarjs/aws-opensearchservice-domain": "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-iam-public-access](https://lintradar.dev/rules/sonarjs/aws-iam-public-access.md): AWS resource-based policies should not grant public access
- [sonarjs/aws-rds-unencrypted-databases](https://lintradar.dev/rules/sonarjs/aws-rds-unencrypted-databases.md): Amazon RDS resources should be encrypted at rest
- [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
- [sonarjs/aws-restricted-ip-admin-access](https://lintradar.dev/rules/sonarjs/aws-restricted-ip-admin-access.md): Administration services access should be restricted to specific IP addresses
- [sonarjs/aws-iam-all-privileges](https://lintradar.dev/rules/sonarjs/aws-iam-all-privileges.md): Policies should not grant all privileges
- [sonarjs/aws-s3-bucket-granted-access](https://lintradar.dev/rules/sonarjs/aws-s3-bucket-granted-access.md): S3 buckets should not grant access to all users or authenticated users

---

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