Managing the deployment of code to multiple AWS Lambda functions and updating your API Gateway methods can be manual and time consuming.
In this webinar, we will show you how to build a deployment pipeline to AWS Lambda using AWS CodePipeline. We will discuss how to use versioning, allowing you to better manage the different variations of your Lambda function and API Gateway methods in your development workflow, such as development, staging, and production. We will walk through how to automate the entire release process of your application from development to staging and finally to production, performing automated integration tests at each stage.
Learning Objectives:
Understand the basics of AWS CodePipeline
Learn how to version AWS Lambda functions and API Gateway methods
Build a deployment pipeline to AWS Lambda
8. Our Application – A Serverless Website
AWS Lambda
Functions
web browser
Amazon S3
Dynamic Content
Amazon API
Gateway
Amazon
DynamoDB
Overview of building this application:
http://bit.ly/1MJb0O2
Static Content
13. Continuous delivery service for fast and
reliable application updates
Model and visualize your software
release process
Builds, tests, and deploys your code
every time there is a code change
Integrates with 3rd party tools and AWS
AWS CodePipeline
23. Our Pipeline
• Built code package lands in S3.
• Lambda Functions all the way down.
• Publish new Function version
• Integration Test
• Release function to environment
• Rollback if necessary
29. Function Aliases
• Assigned to function versions
• Can be reassigned
• Decouple clients from versioning
• Think of changing an alias as the
“Release” step, can enable Blue-Green
deployments.
38. Things to be Aware of
AWS Lambda
• Different aliases assigned
to same version share
containers. Function code
should be alias-aware.
• New version means new
containers, remember to
pre-warm if needed.
• Lambda source code must
change for new version to
be published.
Amazon API Gateway
• Stage variable changes do
NOT require an API
deployment. Saving a
stage variable change
takes effect immediately.
AWS CodePipeline
• Job will hang until timeout,
unless your Actions make
the proper
Success/Failure API call.
• Transitions between
stages are Enabled OR
Disabled. No concept
today of manually
permitting one job to
proceed.
• Many capabilities via
CLI/API not yet visible in
the console.
40. Tips & Tricks
CodePipeline Success/Failure Callback
Implement failure first - Think “Test Driven Development”
Fan-out testing – have a single Lambda “test suite” function that
invokes several test-case functions.
Continuation Tokens – use to extend Lambda-based actions
beyond 5 minutes.
API Versioning – don’t couple your Lambda function versions to
API versions (i.e. api.example.com/v1/prod). Would be disruptive
to your clients and discourage rapid Lambda function changes.
41. Tips & Tricks Contd.
Baby Steps toward CD – Use scheduled Lambda function to
enable/disable stage transition nightly.
Surround with CloudFormation
AWS CodePipline + AWS Lambda + Amazon API Gateway are all
supported now!
Don’t rely on $LATEST for Lambda functions in a testing/production
environment – take control of testing/blessing versions and aliases.