Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
serverless-plugin-canary-deployments
Advanced tools
A Serverless plugin to implement canary deployment of Lambda functions
A Serverless plugin to implement canary deployments of Lambda functions, making use of the traffic shifting feature in combination with AWS CodeDeploy
npm i --save-dev serverless-plugin-canary-deployments
To enable gradual deployments for Lambda functions, your serverless.yml
should look like this:
service: canary-deployments
provider:
name: aws
runtime: nodejs6.10
iamRoleStatements:
- Effect: Allow
Action:
- codedeploy:*
Resource:
- "*"
plugins:
- serverless-plugin-canary-deployments
functions:
hello:
handler: handler.hello
events:
- http: GET hello
deploymentSettings:
type: Linear10PercentEvery1Minute
alias: Live
preTrafficHook: preHook
postTrafficHook: postHook
alarms:
- FooAlarm # When a string is provided, it expects the alarm Logical ID
- name: BarAlarm # When an object is provided, it expects the alarm name in the name property
preHook:
handler: hooks.pre
postHook:
handler: hooks.post
You can see a working example in the example folder.
type
: (required) defines how the traffic will be shifted between Lambda function versions. It must be one of the following:
Canary10Percent5Minutes
: shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed five minutes later.Canary10Percent10Minutes
: shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 10 minutes later.Canary10Percent15Minutes
: shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 15 minutes later.Canary10Percent30Minutes
: shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 30 minutes later.Linear10PercentEvery1Minute
: shifts 10 percent of traffic every minute until all traffic is shifted.Linear10PercentEvery2Minutes
: shifts 10 percent of traffic every two minutes until all traffic is shifted.Linear10PercentEvery3Minutes
: shifts 10 percent of traffic every three minutes until all traffic is shifted.Linear10PercentEvery10Minutes
: shifts 10 percent of traffic every 10 minutes until all traffic is shifted.AllAtOnce
: shifts all the traffic to the new version, useful when you only need to execute the validation hooks.alias
: (required) name that will be used to create the Lambda function alias.preTrafficHook
: (optional) validation Lambda function that runs before traffic shifting. It must use the CodeDeploy SDK to notify about this step's success or failure (more info here).postTrafficHook
: (optional) validation Lambda function that runs after traffic shifting. It must use the CodeDeploy SDK to notify about this step's success or failure (more info here)alarms
: (optional) list of CloudWatch alarms. If any of them is triggered during the deployment, the associated Lambda function will automatically roll back to the previous version.triggerConfigurations
: (optional) list of CodeDeploy Triggers. See more details in the CodeDeploy TriggerConfiguration Documentation, or this CodeDeploy notifications guide for example usesYou can set default values for all functions in a top-level custom deploymentSettings section. E.g.:
custom:
deploymentSettings:
codeDeployRole: some_arn_value
codeDeployRolePermissionsBoundary: some_arn_value
stages:
- dev
- prod
functions:
...
Some values are only available as top-level configurations. They are:
codeDeployRole
: (optional) an ARN specifying an existing IAM role for CodeDeploy. If absent, one will be created for you. See the codeDeploy policy for an example of what is needed.codeDeployRolePermissionsBoundary
: (optional) an ARN specifying an existing IAM permissions boundary, this permission boundary is set on the code deploy that is being created when codeDeployRole is not defined.stages
: (optional) list of stages where you want to deploy your functions gradually. If not present, it assumes that are all of them.The plugin relies on the AWS Lambda traffic shifting feature to balance traffic between versions and AWS CodeDeploy to automatically update its weight. It modifies the CloudFormation
template generated by Serverless, so that:
For now, the plugin only works with Lambda functions invoked by
More events will be added soon.
ISC © David García
FAQs
A Serverless plugin to implement canary deployment of Lambda functions
We found that serverless-plugin-canary-deployments demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.