Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appsync: Add support for custom domains #18040

Closed
2 tasks
alextriaca opened this issue Dec 15, 2021 · 4 comments · Fixed by #19368
Closed
2 tasks

Appsync: Add support for custom domains #18040

alextriaca opened this issue Dec 15, 2021 · 4 comments · Fixed by #19368
Labels
@aws-cdk/aws-appsync Related to AWS AppSync effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1

Comments

@alextriaca
Copy link

alextriaca commented Dec 15, 2021

Description

Appsync has recently added support for custom domains. The cloudformation for this can be found here (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-domainname.html)

Use Case

Currently Appsync assigns a random URL when creating the API. If for some reason the API is ever deleted this URL is lost and a new and random URL is assigned. This means that you always have to consider updating those components that are dependent on the API as you cannot rely on the URL remaining the same. This change will remove that dependancy and allow users to create a custom URL that doesn't change even if the underlying API is rebuilt.

Proposed Solution

API Gateway already supports this and so a similar implementation would seem sensible. Something like:

domain_name = "test.my_domain.com"

certificate = Certificate(
    self,
    "certificate",
    domain_name=domain_name,
    subject_alternative_names=[domain_name],
    validation_method=ValidationMethod.DNS,
)

domain_name_options = DomainNameOptions(
    certificate=certificate, domain_name=domain_name
)

api = aws_appsync.GraphqlApi(
    self,
    "my_api",
    name="my_api",
    schema=aws_appsync.Schema.from_asset("resources/schema.graphql"),
    domain_name=domain_name_options,
)

Other information

No response

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@alextriaca alextriaca added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 15, 2021
@github-actions github-actions bot added the @aws-cdk/aws-appsync Related to AWS AppSync label Dec 15, 2021
@otaviomacedo otaviomacedo added effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Dec 15, 2021
@otaviomacedo otaviomacedo removed their assignment Dec 15, 2021
@joekendal
Copy link

+1

@sammy2077
Copy link

sammy2077 commented Mar 8, 2022

Currently doing it this way via CDK (v2) - Typescript

        // create appsync domain
        const appsyncDomain = new CfnDomainName(this, 'AppsyncDomainName', {
            certificateArn: 'your arn',
            domainName: 'api.example.com',
            description: 'Domain name for AppSync Api',
        })

       // associate domain
        new CfnDomainNameApiAssociation(this, 'AppsyncDomainNameApiAssociation', {
            apiId: this.api.attrApiId,
            domainName: appsyncDomain.attrDomainName,
        });


   
        const hostedZoneId = 'ZONE ID HERE'
       const zoneName = 'example.com'

       // hosten zone for adding appsync domain
        const zone = HostedZone.fromHostedZoneAttributes(this, `HostedZone`, {
            hostedZoneId,
            zoneName,
        });

         // create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
        new CnameRecord(this, `CnameApiRecord`, {
            recordName: 'api',
            zone,
            domainName: appsyncDomain.attrAppSyncDomainName
        });

@daveharig
Copy link

+1

@kaizencc kaizencc added p1 and removed p2 labels Mar 15, 2022
@mergify mergify bot closed this as completed in #19368 Mar 18, 2022
mergify bot pushed a commit that referenced this issue Mar 18, 2022
fixes #18040

This adds support for custom domains with AppSync.
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-appsync Related to AWS AppSync effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants