Globals, Safe Lambda Deployments, Lambda Versions & Aliases, Local Lambda execution 🐿
What's New?
In the last few months, we moved out of our cozy offices into a ice cave somewhere in Alaska to cut out from the noise and focus on one thing - innovate and deliver some awesome SAM features for you. If this Github page was quiet for a while, this is the reason. To break the silence, here are some amazing features we have just launched:
Safe Lambda Deployments
SAM integrates with AWS CodeDepoy to provide safe, gradual, traffic-shifting deployments for your Lambda functions. You can stop worrying and start pushing code to production with confidence!
MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
...
DeploymentPreference:
Type: Canary10Percent10Minutes
Read more about Safe Lambda Deployments here
Lambda Versions & Aliases
SAM provides a dead simple way to publish new versions on every code push and use an Alias to point to the latest version. Just add the following property to Serverless::Function resource:
AutoPublishAlias: live
The above property will create a new Alias called live
, point all your event sources to the Alias, automatically publish a new Lambda Version every time you push new code, and point the Alias to the latest version. This can be used stand alone but the real power comes when you combine it with DeploymentPreference
to do gradual shifting of traffic from your old version to new version, monitoring Alarms, and trigger rollbacks if something goes wrong.
Read more about AutoPublishAlias here
Globals
You can now define all common properties of Serverless Function in one place and let every function inherit it. You can even override some properties or add additional values at the specific function level. The following example enables safe deployments for all your functions and environment variables that are shared with all the functions!
Globals:
Function:
Runtime: nodejs6.10
Timeout: 60
Environment:
Variables:
DbConnection: mysql://somewhere
AutoPublishAlias: live
DeploymentPreference:
Type: Canary10Percent10Minutes
Resources:
MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Environment:
Variables:
TableName: mytable
Read more about Globals here
SAM Local CLI
Run Lambda functions locally on your computer by starting with a simple SAM template. This is launched couple of months back but still worth mentioning because it makes your life so much easier.
Installation:
npm install -g aws-sam-local
Checkout https://github.com/awslabs/aws-sam-local for how to use it.
More to come
Actually, this is just a start. We have a lot more features (spoiler alert: API Gateway logging, CORS, more..) coming out real soon
👩💻👨💻 => 🐿