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
Create CloudFront distribution OR get the bucket ARN #3
Comments
@cdelgadob Sounds like a great idea. I'm a bit busy right now so I've paused active development on many of my projects for the next month or two. The best way to have this happen would be to give this a shot yourself and then submit a PR. Feel free to let me know if you have any questions. |
I'm not sure if creating a CF distribution on S3-deploy is a good idea. Maybe it's better create a bucket and a distribution via cloudformation template as part of Creating an invalidation for a preexisting CF distribution on the other hand would be a very good thing to do, right after S3 upload… |
Agree with @constb that an automated CF invalidation feature would be really handy! Should this be put into a new issue or is it relevant enough to this one? |
@lrholmes, I think that probably makes sense as a separate issue. Any interest in implementing this? |
@linusmarco great, just made one here: #40. I am just getting started with Serverless, so don't have a great amount of knowledge yet and wouldn't know exactly where to start, but I'm eager to learn more so I might have a go at it when I find some time over the weekend. If you could comment any pointers on the new issue that would be great! |
@cdelgadob Since you requested the feature I've assigned it to you to follow up with the relevant folks on #40 and work with @lrholmes who seems to have started to work on this. Let us know if you have any questions! |
Hi, I'm trying to setup Serverless to deploy my client stack which includes a S3 static site, a CloudFront Distribution, and Route 53 records for custom domain name for the CFD. It made sense using the s3 plugin since I could setup my 'stack' without the CI/CD portion that finch has added, but now on finch i dont get the separate stack initialization piece since the s3 bucket is not in the resource section. Is there any intent on implementing such a feature? I may need to duplicate the work that finch is doing and only use it for the CI/CD portion it provides so that sls gets the resource ref to the s3 bucket when creating my CFD. TLDR: |
Is anyone still working on this? Also, would it be worth trying to integrate this with an existing cloudfront serverless plugin, like https://github.com/Droplr/serverless-api-cloudfront? I imagine that placing lambda-powered api endpoints and a s3 site behind a single cloudfront distribution to be a common use case. I imagine that the first missing integration piece is getting the bucket arn as an output? |
@kyledgreen sorry about the delay here. The use case makes sense to me. I'm not opposed to having something like that added. Seems like you could specify that no files be uploaded and then add a config value to have a function run to output all that metadata. The outputting to the CI/CD solutions would probably be the most tricky. It might end up being easier to use CloudFormation in the serverless.yml file to do what you describe because you can actually get outputs from that that can work into a CI/CD flow a little easier. @sprockow I don't think anyone is working on this feature at the moment as I haven't heard anything from the requester. If you're interested in implementing it, it's yours! |
Just saw this. Yeah, I think I'll take a look this weekend. |
@sprockow are you still interested in this? |
@fernando-mc - it's been a really long time since I've looked at this project. I am interested, and I do have more bandwidth now than last year, so I will commit to at least unearthing my notes from October. @superandrew213 - Fullstack-serverless does set up an cloudfront cdn and s3 bucket pair, but it lacked some of the additional s3 specific features that this plugin provided, which is why I looked at finch initially for a project. |
So, a couple questions about approach... The most flexible way of achieving the ability to create a cloudfront distribution for this bucket, would be to give users the ability to opt out of having the plugin create the bucket for us, and instead leverage cloudformation via the serverless.yml 's "Resources" section. This way, a user can set up the bucket, and cdn exactly how they want via Cloudformation, but still use this plugin's features to upload content to that target bucket. Perhaps this "opt out" behavior would be controlled by a parameter such as "manageResources: false"? In order to not break existing behavior, manageResources would default to true. However, this would require that the user first deploy all of the resources via "serverless deploy", before running "serverless client deploy". Some helpful warnings could be added to the cli the bucket does not exist. (for example |
I can put together a PR with the above + an example of how a serverless project could use this new behavior. |
#75 - Here's my first draft PR. Let me know if you think this is an acceptable strategy, and I can put some effort into refining it and adding some readme docs. |
Here's an example on how I would use severless-finch with this sort of flag: https://github.com/sprockow/serverless-finch-example |
It would be nice to be able to choose how to serve the content, either via S3 with Static Web Hosting (as it is now), or via Cloudfront distribution.
If this is too much, it would be a good start to be able to retrieve the bucket ARN, so one could do the CloudFront provisioning via extra CloudFormation code.
Is there a way to achieve this?
Thanks!
The text was updated successfully, but these errors were encountered: