How to deploy a production ready serverless application
Level: 300
To get the most out of the agility afforded by serverless, it is essential to build CI/CD pipelines that help teams iterate on code and quickly release features.
Serverless and distributed systems in production cannot be done any other way than with a good and efficient CI/CD pipeline.
In this talk, I demonstrate how you can use infrastructure-as-code (IaC) models to build effective CI/CD release workflows to manage serverless deployments on AWS, using tools like AWS CodeBuild, AWS CodePipeline, and AWS CodeDeploy.
Specifically, we focus on how to automate safer deployments that can be monitored and rolled back automatically.
I will do demos where I deploy Lambdas with Code* suite and show examples with complex systems.
84. HelloFunction:
Type: 'AWS::Serverless::Function’
Properties:
Handler: handler.hello
Runtime: nodejs12.x
CodeUri: ./hello
AutoPublishAlias: live
DeploymentPreference:
Type: Linear10PercentEvery10Minutes
Alarms:
- !Ref AliasErrorMetricGreaterThanZeroAlarm
- !Ref LatestVersionErrorMetricGreaterThanZeroAlarm
Hooks:
PreTraffic: !Ref PreTrafficLambdaFunction
PostTraffic: !Ref PostTrafficLambdaFunction
Testing using safe deployments
Instructs AWS SAM to publish a new
version of the function for each new
deployment and link it to the live alias
86. HelloFunction:
Type: 'AWS::Serverless::Function’
Properties:
Handler: handler.hello
Runtime: nodejs12.x
CodeUri: ./hello
AutoPublishAlias: live
DeploymentPreference:
Type: Linear10PercentEvery10Minutes
Alarms:
- !Ref AliasErrorMetricGreaterThanZeroAlarm
- !Ref LatestVersionErrorMetricGreaterThanZeroAlarm
Hooks:
PreTraffic: !Ref PreTrafficLambdaFunction
PostTraffic: !Ref PostTrafficLambdaFunction
Testing using safe deployments
A list of alarms that you want to monitor
You can specify a maximum of 10 alarms
87. HelloFunction:
Type: 'AWS::Serverless::Function’
Properties:
Handler: handler.hello
Runtime: nodejs12.x
CodeUri: ./hello
AutoPublishAlias: live
DeploymentPreference:
Type: Linear10PercentEvery10Minutes
Alarms:
- !Ref AliasErrorMetricGreaterThanZeroAlarm
- !Ref LatestVersionErrorMetricGreaterThanZeroAlarm
Hooks:
PreTraffic: !Ref PreTrafficLambdaFunction
PostTraffic: !Ref PostTrafficLambdaFunction
Testing using safe deployments
Validation Lambda functions that are run
before & after traffic shifting