aws / aws/aws-cdk

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

Open
#13,380 8 comments 4 reactions 0 assignees View on GitHub
@aws-cdk/aws-elasticsearch bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
71

Description

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
```ts
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: Bug Report

Contributor guide

Open the contributing guide

Research direction

Start with the Domain.fromDomainEndpoint entry point and reproduce the mismatch using the TypeScript snippet and reported environment. Trace how the supplied endpoint becomes domainArn, then compare the result with the expected ARN; done means the imported domain returns the ARN for the existing ElasticSearch instance.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, elasticsearch, typescript
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.