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.

(aws-elasticsearch): `Domain.fromDomainEndpoint` returning incorrect ARN

See original GitHub issue

When using the Domain.fromDomainEndpoint function to retrieve an ES Instance and reference in the rest of the Stack, it returns an incorrect ARN. When I output the ARN, it gives the following results:

ACTUAL ARN -> arn:aws:es:[region]:[accountId]:domain/infrast-elasti-...
OUTPUTTED  -> arn:aws:es:[region]:[accountId]:domain/search-infrast-elasti-...

Reproduction Steps

  • Have an existing ElasticSearch Service Instance running
  • Import it from the CDK
const esDomain = Domain.fromDomainEndpoint(
  this,
  `${id}ESDomain`,
  'https://search-infrast-elasti-....[region].es.amazonaws.com/'
);

new CfnOutput(this, `ElasticSearchArn`, {
  value: esDomain.domainArn,
  exportName: `ElasticSearchArn`,
});
  • Compare the actual ARN and the ARN returned

What did you expect to happen?

The provided ARN should be the correct ARN

What actually happened?

The provided ARN was incorrect

Environment

  • CDK CLI Version : 1.91.0
  • Framework Version: 1.91.0
  • Node.js Version: 12.20.1
  • OS : Ubuntu 20
  • Language (Version): TypeScript (3.9.7)

Other


This is 🐛 Bug Report

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
iliapolocommented, Mar 8, 2021

@justindra Thanks for reporting this.

Looks like we neglected to consider the search- prefix.

Note to self: Given that users can also specify custom endpoints, this makes me think we shouldn’t try to deduce the ARN from the endpoint, and instead just provide a Domain.fromDomainArn function and thats it.

1reaction
neovasilicommented, Apr 7, 2022

Found the same issue in @aws-cdk/aws-opensearchservice using the fromDomainEndpoint method (cdk v1.50.0).

May I suggest to add a method fromDomainName and deprecate the other one? since looks like ARN is composed by appending domain name at the end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Amazon OpenSearch Service
The OpenSearch Dashboards endpoint doesn't support signed requests. If the access control policy for your domain only grants access to certain IAM users...
Read more >
AWS::Elasticsearch::Domain - AWS CloudFormation
This returned value is the same as the one returned by AWS::Elasticsearch::Domain.DomainArn . DomainArn. The Amazon Resource Name (ARN) of the domain, such...
Read more >
Resolve manual snapshot error in Amazon OpenSearch Service
To successfully migrate data from a manual snapshot in OpenSearch Service, perform the following steps: 1. Choose an Amazon Simple Storage ...
Read more >
Amazon Cognito authentication issues with OpenSearch ...
Make sure to add the Amazon Cognito authenticated role in the domain access ... login page but can't log in, then Amazon Cognito...
Read more >
describe-elasticsearch-domain - AWS Documentation
Returns domain configuration information about the specified Elasticsearch domain, including the domain ID, domain endpoint, and domain ARN.
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