Skip to content

Instantly share code, notes, and snippets.

@rarous
Created July 6, 2020 12:38
Show Gist options
  • Save rarous/96d9615c7de128203948767f4a95bbd0 to your computer and use it in GitHub Desktop.
Save rarous/96d9615c7de128203948767f4a95bbd0 to your computer and use it in GitHub Desktop.
const apiCertificate = getCertificate(this.domainName);
this.apiDistribution = new aws.apigateway.DomainName(name, {
domainName: this.domainName,
endpointConfiguration: { types: "EDGE" },
securityPolicy: "TLS_1_2",
certificateArn: apiCertificate.apply(x => x.arn)
});
const hostedZone = getHostedZone(this.domainName);
this.dnsRecord = new aws.route53.Record(name, {
name: this.domainName,
zoneId: hostedZone.apply(x => x.zoneId),
type: "A",
aliases: [
{
evaluateTargetHealth: true,
name: this.apiDistribution.cloudfrontDomainName,
zoneId: this.apiDistribution.cloudfrontZoneId
}
]
});
this.mapping = new aws.apigateway.BasePathMapping(name, {
restApi: this.gateway.restAPI,
stageName: this.gateway.stage.stageName,
domainName: this.apiDistribution.domainName,
basePath: this.basePath
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment