Our function deployed without any hassle, but how do we ensure that whole system is behaving correctly? To ensure everything is working fine, we can provide CodeDeploy with a list of variables to track during the deployment process, then cancel it, and shift all the traffic to the old version if the ALARM is triggered. With serverless, we can set the alarm using another plugin. Let's have a look at how to do this:
- Update the serverless.yml to set the alarm, as shown in the following code:
service: my-canary-deploymentprovider: name: aws runtime: nodejs6.10plugins: - serverless-plugin-aws-alerts - serverless-plugin-canary-deploymentscustom: alerts: dashboards: truefunctions: hello: handler: handler.hello ...