Skip to content

(aws-elasticsearch): imported Domain's domainEndpoint is the full URL, not the Endpoint #18017

@joel-aws

Description

@joel-aws

What is the problem?

For ES Domains imported using fromDomainEndpoint, the domainEndpoint attribute is meant to return something like: search-mystack-elasti-1ab2cdefghij-ab1c2deckoyb3hofw7wpqa3cm.us-west-1.es.amazonaws.com. Instead, it returned that, but prepended by https://.

I think this happens because fromDomainEndpoint requires a valid URL, not a raw endpoint.

Reproduction Steps

from monocdk import aws_elasticsearch as es, Construct

class ElasticSearch(Construct):
    def __init__(self, scope: Construct):
        super().__init__(scope, id, **kwargs)
        
        domain = "https://search-mystack-elasti-1ab2cdefghij-ab1c2deckoyb3hofw7wpqa3cm.us-west-1.es.amazonaws.com"
        
        # The below would return: `jsii.errors.JSIIError: Invalid URL`
        # domain = "search-mystack-elasti-1ab2cdefghij-ab1c2deckoyb3hofw7wpqa3cm.us-west-1.es.amazonaws.com"
        
        es_domain = es.Domain.from_domain_endpoint(self, "imported-es-domain", domain)
        
        print(es_domain.domain_endpoint)
        
        # > https://search-mystack-elasti-1ab2cdefghij-ab1c2deckoyb3hofw7wpqa3cm.us-west-1.es.amazonaws.com

What did you expect to happen?

The domainEndpoint attribute to return the endpoint not as a URL.

What actually happened?

See: "what is the problem"

CDK CLI Version

1.135.0

Framework Version

No response

Node.js Version

v16.3.0

OS

Mac

Language

Python

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-elasticsearchRelated to Amazon Elasticsearch ServicebugThis issue is a bug.effort/smallSmall work item – less than a day of effortgood first issueRelated to contributions. See CONTRIBUTING.mdp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions