Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reusing Hosted Zone #51

Open
DeltaScratchpad opened this issue Jun 13, 2022 · 2 comments
Open

Reusing Hosted Zone #51

DeltaScratchpad opened this issue Jun 13, 2022 · 2 comments

Comments

@DeltaScratchpad
Copy link

DeltaScratchpad commented Jun 13, 2022

Hello,
Can you advise on how the hosted zone could be reused for multiple instances (i.e. define in a outer stack and share to multiple sub-stacks) or how an existing HZ should be used in it's place (via lookup).

I would like to run multiple servers and would like to avoid paying HZ fees for every instance, when it may be possible to have them all under different sub-sub domains under a common HZ.

Thank you for any guidance you can give

@doctorray117
Copy link
Owner

At first glance, I think you could accomplish this in cdk/lib/domain-stack.ts by commenting out the subdomainHostedZone creation (line 71-78, line 82-89) and swapping out the further references to subdomainHostedZone with rootHostedZone (line 81, 106, 110, 154). It's unclear to me exactly if the cloudwatch policy would apply correctly (line 81) with the rootHostedZone, but it probably would.

@ryansonshine would this be the right approach for running multiple stacks without multiple hosted subzones?

@ryansonshine
Copy link
Collaborator

At first glance it looks like you might be able to get away with doing a lookup instead of creating new by changing this to something like:

    const subdomainHostedZone = route53.HostedZone.fromHostedZoneId(
      this,
      'SubdomainHostedZone',
      '<your hosted zone id here>'
    );

I ended up taking an entirely different approach for handling multi-instance in the library I'm working on that resulted in shuffling quite a bit around so I'm not sure if @DeltaScratchpad will run into any issues but its worth a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants