nailing serverless application development€¦ · test locally test on dev cluster commit to repo...

Post on 24-Jun-2020

0 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Sanath Kumar Ramesh Software Engineer, AWS Serverless

Nailing Serverless Application Development

☁ 🔨

@sanathkr_ @sanathkr

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

About Me

•  Obsessed about serverless developer tools since 2016 •  Built SAM, open sourced SAM implementation, and built SAM CLI •  Open source enthusiast •  Previously:

•  Full stack developer at startups •  Windows Kernel Engineer at Microsoft •  Designed multicore processors at grad school

•  To-be dad 👨‍👦

Sanath Kumar Ramesh, Software Engineer, AWS Serverless

@sanathkr_

@sanathkr

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

No servers to provision or manage

Scales with usage

Never pay for idle Availability and fault tolerance built in

Serverless means…

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Common Serverless use cases

Web Applications •  Static

websites

•  Complex web apps

•  Packages for Flask and Express

Data Processing

•  Real time

•  MapReduce

•  Batch

Chatbots •  Powering

chatbot logic

Backends •  Apps &

services

•  Mobile

•  IoT

</> </>

Amazon Alexa

•  Powering voice-enabled apps

•  Alexa Skills Kit

IT Automation

•  Policy engines

•  Extending AWS services

•  Infrastructure management

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

SERVICES (ANYTHING)

Changes in data state

Requests to endpoints

Changes in resource state

EVENT SOURCE FUNCTION

Node.js Python Java C# Go

Serverless applications

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

The broader community has also evolved

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Nailing Application Development

Source: https://gph.is/2xMjVvf

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Building Web Applications

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Deploy to Prod

Building Serverless Applications

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Development workflow

is no different #ServerlessIsEasy

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

Deploy to Prod

Application Code

Infrastructure

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

MEAN Stack (Mongo Express Node Angular)

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Node: aws-serverless-express

Java: aws-serverless-java-container Python/Flask: Chalice Python/Django: Zappa

Building a web app..

Non-Serverless Serverless

Deploy to Prod

Application Code

MEAN stack + Compatibility Converter

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Non-Serverless Serverless

MEAN Stack (Mongo Express Node Angular)

MEAN stack + New programming

model

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Deploy to Prod

Application Code

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

MEAN Stack (Mongo Express Node Angular)

Develop Build Test Locally

Test on dev cluster

Commit to Repo

exports.handler = function(event, context) { // Function Handler response = app.run(event) callback(null, response) }

Building a web app..

Non-Serverless Serverless

Deploy to Prod

Application Code

MEAN stack + New programming

model

Immutable code Stateless

Event-driven

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Focus on the business logic, use tools to help with serverless

#ServerlessIsEasy

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Terraform

AWS CloudFormation

Terraform

AWS CloudFormation

AWS SAM Serverless Framework

Apex Sparta

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

Deploy to Prod

Infrastructure

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Meet SAM!

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

From: https://github.com/awslabs/aws-serverless-samfarm/blob/master/api/saml.yaml

<-THIS BECOMES THIS->

AWS SAM Template

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Open Source SAM Toolset

SAM Implementation github.com/awslabs/serverless-application-model

SAM CLI github.com/awslabs/aws-sam-cli

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Serverless specific tool will help, but not a necessity

#ServerlessIsEasy

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Code +

Manifest +

Build Tool =

Deployment Bundle

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

Code +

Manifest +

Build Tool with Serverless Build Plugins

= Deployment Bundle (.zip file)

Deploy to Prod

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Code +

Manifest +

Build Tool =

Deployment Bundle

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

pom.xml

Deploy to Prod

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Your build tool might already support serverless

#ServerlessIsEasy

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Manually Run Application Locally

Unit Tests

Integration Tests

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

Manually Run Application Locally

Unit Tests

Integration Tests

Deploy to Prod

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Manually Run Application Locally

Tools: Node Webserver, Nginx,

Apache Webserver etc

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

Manually Run Application Locally

with simulated cloud resources

Tools: SAM CLI, serverless-offline,

LocalStack

Deploy to Prod

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Local testing is possible, a serverless tool just makes it

easier #ServerlessIsEasy

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Create a dev cluster (usually one per team on

separate account)

Run Integration Tests

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

Create a dev stack (one per developer on

separate account)

Run Integration Tests

Deploy to Prod

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Deploy to Prod

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

Build ↓

Package ↓

Run Tests ↓

Beta, Gamma, Prod

Jenkins, AWS CodePipeline, AWS CodeBuild, CircleCI, etc

Deploy to Prod

$ sam deploy

Build ↓

Package ↓

Run Tests ↓

Beta, Gamma, Prod

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Non-Serverless Serverless

Canary or Blue/Green Deployments

Canary or Blue/Green Deployments

Deploy to Prod

sam.yaml

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Develop Build Test Locally

Test on dev cluster

Commit to Repo

Building a web app..

Deploy to Prod

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Your existing tools work just fine

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

If you can build software,

you can build on serverless

#ServerlessIsEasy

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Thank You 👨‍💻 Questions?

@sanathkr_

@sanathkr

sanathkr@amazon.com

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Serverless Application

LogicasConfigura.on(StepFunc.ons,APIGWetc)

Sta.cConfigura.on(S3,SQS,IAM)

Code(Java,Python,JSetc)

top related