Managing the deployment of code to multiple AWS Lambda functions and updating your API Gateway methods can be manual and time consuming.
In this session, we will show you how to build a deployment pipeline to AWS Lambda using AWS CodePipeline, a continuous delivery service based on Amazon’s internal release automation tooling. We will discuss how to use versioning, which enables you to better manage the different variations of your Lambda functions and API Gateway methods in your development workflow (e.g., 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.
AWS DevDay San Francisco, June 21, 2016.
Presenter: Andrew Baird, Solutions Architecture
Continuous Delivery Overview
Source Build Test Production
Our Application – A Serverless Website
Overview of building this application:
Continuous Delivery pipeline to automate deployment and
release of new Lambda function code to non-Production
Continuous delivery service for fast and
reliable application updates
Model and visualize your software
Builds, tests, and deploys your code
every time there is a code change
Integrates with 3rd party tools and AWS
AWS CodePipeline Benefits
Rapid delivery Get started fast
Configurable workflow Easy to integrate
Things to be Aware of
• 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
Amazon API Gateway
• Stage variable changes do
NOT require an API
deployment. Saving a
stage variable change
takes effect immediately.
• Job will hang until timeout,
unless your Actions make
Success/Failure API call.
• Transitions between
stages are Enabled OR
Disabled. No concept
today of manually
permitting one job to
• Many capabilities via
CLI/API not yet visible in
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.
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
Don’t rely on $LATEST for Lambda functions in a testing/production
environment – take control of testing/blessing versions and aliases.