question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(elasticsearch): Elasticsearch must be authorised to describeSubnets

See original GitHub issue

Received response status [FAILED] from custom resource. Message returned: Unauthorized Operation: Elasticsearch must be authorised to describeSubnets (RequestId: f49d7ea9-6d61-4951-98fc-eeda71bb2451)

Reproduction Steps

const { Domain, ElasticsearchVersion, TLSSecurityPolicy } = require('@aws-cdk/aws-elasticsearch');
const { Role, PolicyStatement, Effect, AnyPrincipal, ArnPrincipal } = require('@aws-cdk/aws-iam');

const esDomain = new Domain(this, 'MyElasticsearchDomain', {
      version: ElasticsearchVersion.V7_10,
      domainName: domainName,
      vpc: vpc, 
      ebs: {
          enabled: true,
          volumeSize: elasticsearchEbsVolume,
      },
      capacity: {
          dataNodeInstanceType: instanceType,
          dataNodes: 2,
      },
      cognitoKibanaAuth: {
          enabled: true,
          identityPoolId: cognitoIdentityPoolId,
          role: Role.fromRoleArn(this, 'CognitoRoleArn', cognitoRoleArn),
          userPoolId: cognitoUserPoolId,
      },
      enforceHttps: true,
      tlsSecurityPolicy: TLSSecurityPolicy.TLS_1_2,
      advancedOptions: {
          'rest.action.multi.allow_explicit_index': 'true',
          'override_main_response_version': 'true',
      },
      accessPolicies: [
          new PolicyStatement({
              effect: Effect.ALLOW,
              actions: ['es:*'],
              principals: [
                  new AnyPrincipal(), // remove this in prod
                  new ArnPrincipal(`arn:aws:sts::${env.account}:assumed-role/${cognitoIdentityPoolAuthRole}/CognitoIdentityCredentials`),
              ],
              resources: [`arn:aws:es:${env.region}:${env.account}:domain/${domainName}/*`],
          })
      ],
      zoneAwareness: {
          enabled: true,
          availabilityZoneCount: 2, // default is 2
      }
});

What did you expect to happen?

Elasticsearch domain to be created.

What actually happened?

Elasticsearch domain was created but there’s no access policy.

Environment

  • CDK CLI Version : 1.122.0
  • Framework Version: 1.122.0
  • Node.js Version: v14.17.6
  • OS : Ubuntu 20.04
  • Language (Version): JavaScript

Other

Similar issue in stackoverflow


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
miklinsoncommented, Sep 16, 2021

@prashanttct07 confirmed. I’ve successfully created an Elasticsearch domain without any issues. Can you please share a link / reference saying the issue was with the Service Linked Role (SLR) and the confirmation that it has been fixed and deployed. Thanks!

1reaction
prashanttct07commented, Sep 15, 2021

There was an issue with Service Linked Role (SLR), which has been fixed and deployed. Please check now and you should not be getting any such error while creating the domain.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws_elasticsearch_domain failed with ValidationException ...
aws_elasticsearch_domain.logs: Error creating ElasticSearch domain: ... Operation: Elasticsearch must be authorised to describeSubnets ...
Read more >
CDK ElasticSearch: Setting AccessPolicies property causes ...
Message returned: Unauthorized Operation: Elasticsearch must be authorised to describeSubnets. But when I remove the AccessPolicies property ...
Read more >
Troubleshooting Amazon OpenSearch Service
This topic describes how to identify and solve common Amazon OpenSearch Service issues. Consult the information in this section before contacting AWS ...
Read more >
User authorization | Elasticsearch Guide [8.5] | Elastic
A resource to which access is restricted. Indices, aliases, documents, fields, users, and the Elasticsearch cluster itself are all examples of secured objects....
Read more >
Stream Data to ElasticSearch - QLDB Guide
Another common use case is to support rich text search and downstream analytics such as aggregation or metrics across records. For this, I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found