Skip to main content
MEDIUMOpenSearchSecurity

OpenSearch Access Control Weak

opensearch-access-control-weak

What this rule checks

Detects OpenSearch domains without fine-grained access control or VPC placement.

How to fix it

  1. 1Enable AdvancedSecurityOptions
  2. 2Configure VPCOptions to deploy the domain inside a VPC
FlaggedThe domain has neither AdvancedSecurityOptions (fine-grained access control) nor VPCOptions, so it lacks document/field-level security and network isolation. CDK Insights flags AWS::OpenSearchService::Domain resources without fine-grained access control or VPC placement.
import { CfnDomain } from 'aws-cdk-lib/aws-opensearchservice';

new CfnDomain(this, 'SearchDomain', {
  engineVersion: 'OpenSearch_2.11',
  clusterConfig: {
    instanceType: 'r6g.large.search',
    instanceCount: 2,
  },
});
FixedThe domain now enables advancedSecurityOptions with an IAM master user and is placed inside a VPC via vpcOptions (with encryption at rest, node-to-node encryption and enforced HTTPS, which FGAC requires). With both FGAC and VPC placement present the finding clears.
import { CfnDomain } from 'aws-cdk-lib/aws-opensearchservice';

new CfnDomain(this, 'SearchDomain', {
  engineVersion: 'OpenSearch_2.11',
  clusterConfig: {
    instanceType: 'r6g.large.search',
    instanceCount: 2,
  },
  vpcOptions: {
    subnetIds: ['subnet-0abc123'],
    securityGroupIds: ['sg-0def456'],
  },
  encryptionAtRestOptions: { enabled: true },
  nodeToNodeEncryptionOptions: { enabled: true },
  domainEndpointOptions: { enforceHttps: true },
  advancedSecurityOptions: {
    enabled: true,
    internalUserDatabaseEnabled: false,
    masterUserOptions: {
      masterUserArn: 'arn:aws:iam::111122223333:role/OpenSearchAdmin',
    },
  },
});

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::OpenSearchService::DomainAWS::Elasticsearch::Domain

Compliance frameworks

SOC2HIPAAPCI-DSSNIST

AWS documentation

Read the AWS guidance

Intentional? Suppress this finding

Sometimes a flag is deliberate โ€” a genuinely public endpoint, say. You can dismiss opensearch-access-control-weak and the reason is kept in the report, not silently hidden.

In .cdk-insights.json:

{
  "ignoreRules": [
    { "id": "opensearch-access-control-weak", "reason": "Why this is intentional" }
  ]
}

Or inline in your CDK code:

Validations.of(scope).acknowledge({
  id: 'cdk-insights::opensearch-access-control-weak',
  reason: 'Why this is intentional',
});

Use the rule ID opensearch-access-control-weak 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 OpenSearch rules