Ashishkumar Pandey
05/25/2021, 8:07 AMAshishkumar Pandey
05/25/2021, 9:17 AMAshishkumar Pandey
05/25/2021, 10:16 AMconst hostedZone = HostedZone.fromLookup(this, 'HostedZone', { domainName: '<http://xyz.com|xyz.com>' });
the above code internally uses the fromHostedZoneAttributes
method and uses DUMMY
as the hostedZoneId
as per the source code
and it’s output would be -
Stack dev-pm-admin-admin-api-stack
Status: deployed
Outputs:
hostedZoneId: Z000799029M39ZYI1LILZ
hostedZoneNS:
hostedZoneName: <http://xyz.com|xyz.com>
Here the zone id is the route 53 default zone id. This default zone is not shown via the route53 cli’s list-hosted-zones command.
So, in case of a custom hosted zone, you will need to lookup only by zoneId or both zoneId and zoneName. The lookup by zoneId doesn’t return zoneName and so my suggestion would be lookup by both zoneId and zoneName. Like this -
const hostedZone = HostedZone.fromHostedZoneAttributes(this, 'HostedZone', {
hostedZoneId: 'xxxxxxx',
zoneName: '<http://xyz.com|xyz.com>',
});
You can then pass this hostedZone variable as the hostedZone prop for the Api construct.Ashishkumar Pandey
05/25/2021, 10:35 AMFrank
Frank
Frank
Frank
Ashishkumar Pandey
05/25/2021, 8:05 PMFrank
Z000799029M39ZYI1LILZ
above is a default zone on the AWS side, and isn’t listed in your Route 53 account?Ashishkumar Pandey
05/26/2021, 4:54 AMAshishkumar Pandey
05/26/2021, 4:55 AMAshishkumar Pandey
05/26/2021, 4:56 AM