(elasticsearch): Elasticsearch must be authorised to describeSubnets
See original GitHub issueReceived 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:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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!
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.