When you put a custom domain to the Api construct ...
# help
g
When you put a custom domain to the Api construct does it automatically creates an A Record? This code below throws an error Tried to create resource record set but it already exists.
const api = new Api(this, "Api", {
customDomain: {
domainName: domainName,
hostedZone: hostedZone,
certificate: cert,
path: 'v1'
},
routes: {
"GET /": "src/lambda.handler"
}
});
new route53.ARecord(this, "ApiARecord", {
zone: hostedZone,
recordName: domainName,
target: route53.RecordTarget.fromAlias(
new route53Targets.ApiGatewayv2DomainProperties(
api.apiGatewayDomain!.regionalDomainName,
api.apiGatewayDomain!.regionalHostedZoneId
)
),
});
t
Yeah you don't need to create it yourself
g
Is it included in the docs? I think it is good to add.
f
@Gerald ah yeah.. just updated the doc mentioning an A record is automatically created in the hosted zone.