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

Custom Route53 records in CloudFormation stack #399

Open
aehlke opened this Issue Oct 16, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@aehlke
Contributor

aehlke commented Oct 16, 2016

Since Zappa already relies on CloudFormation, it would be wonderful if we could specify a hostname to use for a particular environment. CloudFormation works great with Route53 - AFAIK it won't overwrite an existing DNS record if one already existed, and it cleans up if you delete the stack of course.

We typically use CloudFormation for everything but as-is, I'd have to make a 2nd CloudFormation stack outside of Zappa automation just for the Route53 entry, or through other means like manually in the AWS console.

Any interest in this?

@Miserlou

This comment has been minimized.

Show comment
Hide comment
@Miserlou

Miserlou Oct 17, 2016

Owner

This is interesting, I'd certainly be open to taking in a good PR with this.

Can you describe the interface you'd use for something like this?

Owner

Miserlou commented Oct 17, 2016

This is interesting, I'd certainly be open to taking in a good PR with this.

Can you describe the interface you'd use for something like this?

@aehlke

This comment has been minimized.

Show comment
Hide comment
@aehlke

aehlke Oct 18, 2016

Contributor

I'm not sure since I've only spent an hour or two with Zappa so far. Would it make sense in the JSON configuration as another parameter?

Contributor

aehlke commented Oct 18, 2016

I'm not sure since I've only spent an hour or two with Zappa so far. Would it make sense in the JSON configuration as another parameter?

@Miserlou

This comment has been minimized.

Show comment
Hide comment
@Miserlou

Miserlou Oct 18, 2016

Owner

Typically yes. Just describe a little bit about how you'd like to interact with something like that?

Owner

Miserlou commented Oct 18, 2016

Typically yes. Just describe a little bit about how you'd like to interact with something like that?

@aehlke

This comment has been minimized.

Show comment
Hide comment
@aehlke

aehlke Oct 18, 2016

Contributor

Ah I see - good question! Typically we prefer setting DNS entries via Troposphere. So it'd be an even more natural fit for us if we could extend the CloudFormation template itself rather than through an abstraction of it like the JSON configuration - that could cover wider use cases. But being able to set a hostname is probably a common use case (most people are probably just used to doing this by hand through the AWS console? - and possibly don't take automation to the degree we do).

Another current pain point is that it doesn't seem easy to script Zappa yet (so far as I've discovered, so I'm likely missing some things) - I plan to file another ticket about deployment automation, but the relevant part here is that if I wanted to set the Route53 record myself through out-of-band automation (e.g. as an awscli or Ansible playbook that runs alongside Zappa), I don't see a great way to extract the hostname that Zappa generated to use as a CNAME. I could try to pattern-match it from Zappa CLI output, or I could try to get a reference to the CloudFormation stack and get it from there.

For that latter point, I could see a couple nice ways to get that hostname programmatically - either have a way to get Zappa to use machine-readable output (undecided on best interface for this); and/or use CloudFormation's value outputs so that other stacks can import those relevant values into their stacks.

Contributor

aehlke commented Oct 18, 2016

Ah I see - good question! Typically we prefer setting DNS entries via Troposphere. So it'd be an even more natural fit for us if we could extend the CloudFormation template itself rather than through an abstraction of it like the JSON configuration - that could cover wider use cases. But being able to set a hostname is probably a common use case (most people are probably just used to doing this by hand through the AWS console? - and possibly don't take automation to the degree we do).

Another current pain point is that it doesn't seem easy to script Zappa yet (so far as I've discovered, so I'm likely missing some things) - I plan to file another ticket about deployment automation, but the relevant part here is that if I wanted to set the Route53 record myself through out-of-band automation (e.g. as an awscli or Ansible playbook that runs alongside Zappa), I don't see a great way to extract the hostname that Zappa generated to use as a CNAME. I could try to pattern-match it from Zappa CLI output, or I could try to get a reference to the CloudFormation stack and get it from there.

For that latter point, I could see a couple nice ways to get that hostname programmatically - either have a way to get Zappa to use machine-readable output (undecided on best interface for this); and/or use CloudFormation's value outputs so that other stacks can import those relevant values into their stacks.

@AusIV

This comment has been minimized.

Show comment
Hide comment
@AusIV

AusIV Nov 26, 2016

@Miserlou - As a more general solution to this problem, do you see any issue with adding a callback between the calls to create_stack_template and update_stack?

If we had a callback there similar to the 'settings', 'zip', and 'post' callbacks, we could write our own extensions to extend the stack however we like. This could be to point Route53 records at the ApiGateway, or massage the stack in other ways.

AusIV commented Nov 26, 2016

@Miserlou - As a more general solution to this problem, do you see any issue with adding a callback between the calls to create_stack_template and update_stack?

If we had a callback there similar to the 'settings', 'zip', and 'post' callbacks, we could write our own extensions to extend the stack however we like. This could be to point Route53 records at the ApiGateway, or massage the stack in other ways.

AusIV added a commit to AusIV/Zappa that referenced this issue Nov 28, 2016

Add a "stack" callback
This adds a callback, like the settings, zip, and post callbacks, which
runs between setting up the CloudFormation stack and deploying it. This
can be used to enable projects to extend the stack, as proposed
[here](Miserlou#399). This could allow
automated provisioning of Route53 entries, or anything else that can
be provisioned with CloudFormation templates that should be deployed
along side a Zappa application.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment