Skip to content

DomainName

Source: src/AWS/ApiGatewayV2/DomainName.ts

An API Gateway v2 custom domain name.

Requires a validated ACM certificate in the same region. Point DNS (a Route 53 alias or CNAME) at the returned ApiGatewayDomainName target and map APIs onto the domain with ApiMapping.

const domain = yield* ApiGatewayV2.DomainName("Domain", {
domainName: "api.example.com",
domainNameConfigurations: [{
CertificateArn: certificate.certificateArn,
EndpointType: "REGIONAL",
SecurityPolicy: "TLS_1_2",
}],
});
yield* ApiGatewayV2.ApiMapping("Mapping", {
api,
domainName: domain.domainName,
stage: stage.stageName,
});