Skip to content

Appsync: Add support for custom domains #18040

@alextriaca

Description

@alextriaca

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-appsyncRelated to AWS AppSynceffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions