管理程式對aws lambda持續交付

Post on 16-Apr-2017

277 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

AWS Cloud Kata for Start-Ups and Developers

Taipei

Managing the Continuous Delivery of Codes to AWS Lambda

Pahud Hsieh

AWS Cloud Kata for Start-Ups and Developers

What is AWS Lambda?

Challenges in serverless development

Environment pinning with API Gateway and Lambda

Continuous delivery in different scenarios

Best practices in security and development

Demo

Agenda

AWS Cloud Kata for Start-Ups and Developers

A bit about me

• IT Pro and developer for the past 16 years

• Chief Architect from miiiCasa Inc. • Experienced in Serverless and ECS

across multiple AWS regions • AWS all-5 certificates holder

AWS Cloud Kata for Start-Ups and Developers

What is Lambda, actually?

What is Lambda

AWS Cloud Kata for Start-Ups and Developers

homegrown variant of Linux container

with high speed of work routing and placement

What is Lambda

AWS Cloud Kata for Start-Ups and Developers

single/multiple instancesmonolithic applications

What is Lambda

AWS Cloud Kata for Start-Ups and Developers

https://twitter.com/adrianco/status/736553530689998848

What is Lambda

AWS Cloud Kata for Start-Ups and Developers

API

FunctionAPI

Function

API

Function

API

Function

API

Function

API

Function

API

Function

[micro] Application design in the cloud

AWS Cloud Kata for Start-Ups and Developers

• Startup and termination • Freeze and thaw cycle

Cold Start Terminate Freeze

Thaw

Handler

Understanding Container Reuse

AWS Cloud Kata for Start-Ups and Developers

Challenges in Serverless Development

Challenges

AWS Cloud Kata for Start-Ups and Developers

Local development and testing?

Securing your credentials?

Performance tuning and optimization?

Continuous delivery?

Language constraints?

Challenges

AWS Cloud Kata for Start-Ups and Developers

Continuous Delivery

Continuous Delivery

AWS Cloud Kata for Start-Ups and Developers

local dev/test

end-to-end test

update alias

Fail

publish

Serverless Development Pipelines

Log and Monitor

SlackAnalytics

AWS Cloud Kata for Start-Ups and Developers

Environment Pinning with API Gateway and Lambda

Continuous Delivery

AWS Cloud Kata for Start-Ups and Developers

AWS Lambda CD Relevant Features

AWS Cloud Kata for Start-Ups and Developers

Function Versions

• Immutable versions of functions • Per version configuration • Per version cloudwatch metrics • Cloudwatch Logs with version

attribute • Export/Download the codes

AWS Cloud Kata for Start-Ups and Developers

Update Function Code

• update function with local zip bundle • always update $LATEST version of

your lambda function

AWS Cloud Kata for Start-Ups and Developers

Publish Version

• Publishes a version of your function from the current snapshot of $LATEST.

AWS Cloud Kata for Start-Ups and Developers

Publish Version

• update the function version to which the alias points.

AWS Cloud Kata for Start-Ups and Developers

Update Alias

$LATEST(95) STABLE TESTING

94 V

93 V

92

AWS Cloud Kata for Start-Ups and Developers

Update Alias

$LATEST(95) STABLE TESTING

94 V V

93

92

AWS Cloud Kata for Start-Ups and Developers

API Gateway CD Relevant Features

AWS Cloud Kata for Start-Ups and Developers

API Stages

AWS Cloud Kata for Start-Ups and Developers

API Gateway stage variables

AWS Cloud Kata for Start-Ups and Developers

API Gateway stage variables

AWS Cloud Kata for Start-Ups and Developers

Access stage variables in Lambda

AWS Cloud Kata for Start-Ups and Developers

Environment Pinning Table

API Gateway Lambda Custom Domain

/prod/Resources ReosurceManager:stable https://api.example.com

/dev/Resources ReosurceManager:$LATEST https://dev.example.com

/qa/Resources ReosurceManager:qa https://qa.example.com

AWS Cloud Kata for Start-Ups and Developers

Continuous Delivery Scenarios

AWS Cloud Kata for Start-Ups and Developers

AWS CodeCommit and CodePipeline with Lambda

3rd Party Integrations

Continuous Delivery Scenarios

AWS Cloud Kata for Start-Ups and Developers

source

S3/Github

publish-to-Dev

test-Dev

release-Dev

AWS Pipeline Integration

PubNewVersion

TestNewVersion

RelNewVersion

AddItem

UpdateFunctionCode

AddItemTest

AddItemApiTest

InvokeInvoke

InvokeInvoke

Invoke

Invoke

Invoke

AWS Cloud Kata for Start-Ups and Developers

source

Local Laptop

3rd party integration

AddItem

UpdateFunctionCode

AddItemApiTest

Invoke

InvokeInvoke

Runscope end-to-end testcallback

AWS Cloud Kata for Start-Ups and Developers

Best Practices

AWS Cloud Kata for Start-Ups and Developers

Securing your credentials

Leverage the nature of container reuse

Prewarm your Lambda functions

Best Practices

AWS Cloud Kata for Start-Ups and Developers

NEVER hardcode your credentials

AWS Cloud Kata for Start-Ups and Developers

Use CredentialProviderChain in AWS-SDK

https://gist.github.com/pahud/836481ae759147d3f493d3ead1f5406a

AWS Cloud Kata for Start-Ups and Developers

Define in API Gateway stage variables

Encrypt and save in AWS KMS

Save in S3 with Server-Side Encryption

For 3rd Party API Credentials

AWS Cloud Kata for Start-Ups and Developers

Leverage Container Reuse

AWS Cloud Kata for Start-Ups and Developers

• Startup and termination • Freeze and thaw cycle

Cold Start Terminate Freeze

Thaw

Handler

Understanding Container Reuse

AWS Cloud Kata for Start-Ups and Developers

Show me the Codes!

AWS Cloud Kata for Start-Ups and Developers

AWS Cloud Kata for Start-Ups and Developers

AWS Cloud Kata for Start-Ups and Developers

Cloudwatch Events Integration

AWS Cloud Kata for Start-Ups and Developers

CloudWatch Events scheduled invocation

AWS Cloud Kata for Start-Ups and Developers

chalice - python serverless microframework by AWS

claudiajs - Deploy Node.js microservices to AWS easily

serverless - Serverless Framework

apex - Build, deploy, and manage AWS Lambda functions with ease (with Go support!)

lambCI - Serverless continuous integration

Resources and Takeaways

AWS Cloud Kata for Start-Ups and Developers

Demo

AWS Cloud Kata for Start-Ups and Developers

What’s next?A Hands-on Workshop on AWS Infrastructure Services

Date: Sep 29, 2016

AWS 10-Minute Tutorials “Hello, World!” technical documents to help you get hands-on with AWS.

AWS Cloud Kata for Start-Ups and Developers

Thank You!

@pahudnet

top related