Route53: HostedZone.fromHostedZoneId() throws an error for cdk synth
See original GitHub issue-
I’m submitting a …
- 🪲 bug report
- 🚀 feature request
- 📚 construct library gap
- ☎️ security issue or vulnerability => Please see policy
- ❓ support request => Please see note at the top of this template.
-
What is the current behavior? If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce
Example code:
const domainZone = route53.HostedZone.fromHostedZoneId(this, 'domain-zone', hostedZoneId);
cdk synth
throws an error:
HostedZone.fromHostedZoneId doesn't support "zoneName"
- What is the expected behavior (or behavior of feature suggested)?
fromHostedZoneId()
should return a valid IHostedZone
object.
- What is the motivation / use case for changing the behavior or adding this feature?
HostedZone
is needed, for instance, for LoadBalancedFargateServiceProps
(for the domainZone
property).
-
Please tell us about your environment:
- CDK CLI Version: 1.4.0 (build 175471f)
- Module Version: 1.4.0
- OS: OSX Mojave
- Language: TypeScript
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:17
- Comments:11 (4 by maintainers)
Top Results From Across the Web
class HostedZone (construct) · AWS CDK
Imports a hosted zone from another stack. static fromHostedZoneId(scope, id, hostedZoneId), Import a Route 53 hosted zone defined either outside the CDK, or...
Read more >@aws-cdk/aws-route53 | Yarn - Package Manager
To add a public hosted zone: new route53.PublicHostedZone(this, 'HostedZone', { zoneName: 'fully.qualified.domain.com' ...
Read more >AWS CDK, creating an alias record for an existing hosted ...
I tested with AWS CDK version 1.5.0 (build c020efa) and 1.6.0 (build 3a0cde0). I tried finding the zone like so: zone = route53.HostedZone...
Read more >awslabs/aws-cdk - Gitter
Can someone please look and tell me what I am doing wrong. getting this error, init() takes 3 positional arguments but 4 were...
Read more >CDKでFargateを作成する - Zenn
AWS CDKアプリには、cdk synthする時に外部問い合わせを必要とするコードを ... fromLookup()などの呼び出しで参照できます。 ... Error: HostedZone.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@realharry for Hosted Zones there are 3 methods that accomplish very similar, but slightly different goals.
fromHostedZoneId(...)
andfromHostedZoneName(...)
will create a mock object with just the ZoneId or the ZoneName field present. These are useful if you need to supply a HostedZone object but you know that the resource that is accepting the HostedZone only needs access to one of those variables. This is done without having make an API call so it can be done entirely locally.The third method is
fromAttributes(...)
that will take the attributes and perform an API call to determine which exact HostedZone is deployed and updates its behavior accordingly.The first two methods create use different Classes of IHostedZone that throw an error if you use the wrong parameter (e.g. calling
getName()
when you usedfromHostedZoneId()
)I just fell into the same trap two years after this problem was first reported. It would be nice if the docs were updated so everybody didn’t have to get the error, search for it on google, and read a bunch of threads to find the explanation of this wacky function.