SAM supports a nice feature to safely deploy new version of a lambda function including traffic shifting and automatic rollback functionality.
Adding support for this feature, including all the pre/post hook lambda functions, alerts, deployment variants, in the outputted SAM definition file, would be a good step forward to make it more useful in production environment in my opinion.
I already added this functionalily in a very simple variant in one of my side project and it would be a pleasure to support here to add this to chalice!
Proposal
I would suggest to add a new (stage dependent) config parameter in .chalice/config.json:
{
"stages": {
"staging": {
"deployment_preference": {
"type": "Linear10PercentEvery1Minute",
"auto_publish_alias": "live"
}
}
}
}
For instance, check here for an example SAM file including pre/post hooks and alarms that need to be generated out of the config above. Since the alarms could be static at first as in the example (error rate of new and old lambda function) but could be more complex in future.
Thus, the example above should extend the SAM lambda definition with:
"Type": "AWS::Serverless::Function",
"Properties": {
...
"AutoPublishAlias": "live",
"DeploymentPreference": {
"Type": "Linear10PercentEvery1Minute"
}
}
It would be nice to also have the possibility of a lambda implementation and definion within chalice for the hooks. But I don't know how complex this is.
I already started a possible implementation of this (without alarms and hooks at the moment).
Marking as feature request, I think it would be a very useful!
I already start to implement this functionality in chalice and I finished a "light" version of this without any alarms and pre/post hooks. Should I already make a PR to discuss about it?
Adding alarms could be static for the first shot, but adding pre and post hook lambdas is more difficult.
Do you have any suggestion how to implement this? Can there be multiple lambdas be implemented in one chalice package which I can then use as pre/post hook?
@gallmerci would it be possible to write a proposal first before sending a PR? As stated in the README we try to get a proposal done prior to sending PR's. It ends up being a great way to discuss the plan before diving too much into the code (but it does not hurt to have a light POC to support the proposal). Here are examples of proposals that we have done. The proposal does not need to be long. It really only needs to sketch out the interface and address potential future additions if needed. Feel free to reuse this issue for the proposal as well.
@kyleknap Ok, I edited the initial post of this issue to include the proposal.
Awesome. Thanks! @jamesls @stealthycoin and I will take a look at this and get back to you
Was this feature implemented?
It's been a while and I never got feedback on the proposal. I am not using AWS at the moment anymore, but if this feature is still existing, I would be still interested in integrating it into chalice!
Are there any plans to implement this feature?
Most helpful comment
Marking as feature request, I think it would be a very useful!