-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Deploy code for a single function without deploying the whole stack? #125
Comments
From our (arguably anecdotal) experience, we've had zero issues updating lambdas outside of SAM. The issues can come if you replace a lambda (actually delete the lambda an APIGW is pointing to). |
@brunomorency You'd be ok with updating the lambda directly since you're not modifying the infrastructure, just the application code that the lambda runs. We're working through this problem right now, by looking into running a separate pipeline for updating our API + Lambdas only. |
Why do you want to work around CloudFormation? Is it the cost of running I have heard this sentiment in many places that updating Lambda is easier than updating via CloudFormation. Want to dissect to the bottom of the issue here to drive some fixes on our end. |
@sanathkr I want to work around CloudFormation because One option would be to figure out a local setup to run the SAM app during development and deploy the stack to AWS only when done but I found it very cumbersome to replicate everything locally and prefer my dev setup to be in AWS. I ended up writing my own deployment script and since you said this is a sentiment you heard in many places, I just published it as a package if other people would like to use it: https://www.npmjs.com/package/sampique |
Okay, there are two parts to this:
I like the |
From experience, deploys often took multiple minutes. Changing the polling down from 30 seconds to 5 seconds would shave off a few seconds but the impact would be marginal at best, unfortunately. If that helps, my stack currently has 9 dynamodb tables (declared as |
I think slow deployments are also affected by the fact that they update all of function resources every time, even if there wasn't any code change in any of them. Support for native versioning based on code hash could help with this. |
updating all functions is a concern if you use the |
Agreed. I ended up calculating the hash explicitly and passing it to my templates. |
Closing this as there is nothing actionable |
@dinvlad could you elaborate more your solution? |
@rizidoro here's a script I used for deployment: https://github.com/cumulous/backend/blob/master/scripts/package.sh |
@brunomorency out of genuine curiosity, why did you not simply choose to use Serverless Framework? Because SAM is AWS ecosystem? |
@alexdilley SAM is already a layer on to p of CLoudFormation, I really didn't want to add yet another layer on top of everything. Especially one that is outside AWS ecosystem and will always attempt to find a common denominator with other platforms. |
After finding this issue, I ended up writing a small script to deploy individual functions bypassing CloudFormation. In medium-sized stacks, I'm getting 20x faster deployments. Hope it helps! https://dev.to/spalladino/speed-up-your-aws-sam-development-by-deploying-individual-functions-d74 FWIW, it'd be great to have this feature natively as part of the SAM CLI. |
* feat: SAM support for /tmp config (#87) * Add EphemeralStorage field Add EphemeralStorage as a new option when creating SAM templates. Add functionality to transform SAM templates with EphemeralStorage to Cloudformation templates. Add /translate tests for new field * Add EphemeralStorage to global configs * Add EphemeralStorage to global configs * Add testing for functions with intrinsic refs, add EphemeralStorage to versions Co-authored-by: Kevin Weng <kwweng@amazon.com> * chore: add integration test for /tmp (#101) * Add integration test for /tmp Also edit basic_function_event_destinations template file to avoid deprecated runtime error * Add integration test for /tmp Also edit basic_function_event_destinations template file to avoid deprecated runtime error * Revert changes to template runtime and use getters in test_function_with_ephemeral_storage. Delete duplicated test * Revert runtime changes Co-authored-by: Kevin Weng <kwweng@amazon.com> Co-authored-by: Kevin Weng <42563047+slowpokesnail@users.noreply.github.com> Co-authored-by: Kevin Weng <kwweng@amazon.com>
What would be the best way to update the code of a single function without having to package and deploy the whole stack (which is getting quite slow as the app grows)? Basically, do the equivalent of this AWS Deploy Function of Serverless framework.
I was thinking about using the update-function-code of the lambda cli but not sure what the impact will be on the stack if it start updating some of its resources outside of the normal package->deploy process
The text was updated successfully, but these errors were encountered: