To make deployments more robust, the QuickStart can deploy a lambda function with AWS CodeDeploy. This enables traffic to shift in increments to the new version, and to run smoke-tests before and after traffic-shifting to validate the new version. AWS CodeDeploy stops a deployment if a cloudwatch alarm is trigger or a smoke-test fails and automatically rolls back the deployment: CodeDeploy shifts all traffic to the old version.
Tested:
I verified 3 deploys:
preHook fails => deploy rolled back
preHook succeeds and postHook fails => deploy rolled back
preHook and postHook succeed => deploy succeeds
verified warmup:
verified that preHook and postHook are not kept warm
Not tested:
I did not test with CloudWatch alarms, since I don't have any set up.
I did not create an SNS topic and post deploy results to the topic.
Configured 1 lambda function in 1 service with the serverless-canary-deployment plugin.
service: app-api
function: create.js
added the validation functions (as a sample): preCreate and postCreate in hooks.js
Learning
I learned about QuickStart and AWS CodeDeploy by reading and experimenting. Here is a doc of the big picture.
Assorted Notes/Considerations
This code is not meant to be merged, since it only configures CodeDeploy on 1 function. The goal would be to apply this plugin to all functions for each service with functions.
This code is so you review the idea of using AWS CodeDeploy.
Pull Request Creator Checklist
[ ] This PR has an associated issue or issues.
[ ] The associated issue(s) are linked above.
[ ] This PR meets all acceptance criteria for those issues.
[ ] This PR and linked issue(s) are adequately documented
[ ] This PR and linked issues(s) are a complete description of the changeset; an individual or team should be able to understand the issue(s) and changes by reading through this PR and it's links, with no further interaction.
[ ] Someone has been assigned this PR.
[ ] At least one person has been marked as reviewer on this PR.
Pull Request Reviewer/Assignee Checklist
[ ] This PR has an associated issue or issues.
[ ] The associated issue(s) are linked above.
[ ] This PR meets all acceptance criteria for those issues.
[ ] This PR and linked issue(s) are adequately documented
[ ] This PR and linked issues(s) are a complete description of the changeset; an individual or team should be able to understand the issue(s) and changes by reading through this PR and it's links, with no further interaction.
Purpose
To make deployments more robust, the QuickStart can deploy a lambda function with AWS CodeDeploy. This enables traffic to shift in increments to the new version, and to run smoke-tests before and after traffic-shifting to validate the new version. AWS CodeDeploy stops a deployment if a cloudwatch alarm is trigger or a smoke-test fails and automatically rolls back the deployment: CodeDeploy shifts all traffic to the old version.
Tested: I verified 3 deploys: preHook fails => deploy rolled back preHook succeeds and postHook fails => deploy rolled back preHook and postHook succeed => deploy succeeds
verified warmup: verified that preHook and postHook are not kept warm
Not tested: I did not test with CloudWatch alarms, since I don't have any set up. I did not create an SNS topic and post deploy results to the topic.
Linked Issues to Close
https://jiraent.cms.gov/browse/CMCSMACD-592
Approach
Configured 1 lambda function in 1 service with the serverless-canary-deployment plugin. service: app-api function: create.js added the validation functions (as a sample): preCreate and postCreate in hooks.js
Learning
I learned about QuickStart and AWS CodeDeploy by reading and experimenting. Here is a doc of the big picture.
Assorted Notes/Considerations
This code is not meant to be merged, since it only configures CodeDeploy on 1 function. The goal would be to apply this plugin to all functions for each service with functions. This code is so you review the idea of using AWS CodeDeploy.
Pull Request Creator Checklist
Pull Request Reviewer/Assignee Checklist