© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Dirk Fröhner, Solutions Architect, Amazon Web Services
Impress Your Friends with Your
First Serverless Application
@dirk_f5r
froehner@amazon.de@
Modern Application Web Day
2018-10-25
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. https://secure.flickr.com/photos/mgifford/4525333972
Why are we
here today?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Intro to serverless
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is serverless computing?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is serverless computing?
“Build and run applications without
thinking about servers”
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is serverless computing?
“Build and run applications without
thinking about servers”
“Pay per request, not for idle”
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let’s take a look at the evolution of computing
Physical servers
in data centers
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let’s take a look at the evolution of computing
Physical servers
in data centers
Virtual servers
in data centers
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Let’s take a look at the evolution of computing
Physical servers
in data centers
Virtual servers
in data centers
Virtual servers
in the cloud
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What serverless means
Scales with usageNo servers to provision or manage
High availability built-in Never pay for idle
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Orchestration and State Management
Building blocks for serverless applications
AWS Lambda
Amazon DynamoDB
Amazon SNS
Amazon API Gateway Amazon SQS Amazon Kinesis
Amazon S3
API Proxy and GraphQL Messaging and Queues Analytics
Monitoring and Debugging
Compute Storage Database
AWS X-RayAWS Step Functions Amazon Cognito
User Management and IdP
AWS AppSync Amazon Athena
AWS Lambda@Edge
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Orchestration and State Management
Building blocks for serverless applications
AWS Lambda
Amazon DynamoDB
Amazon SNS
Amazon API Gateway Amazon SQS Amazon Kinesis
Amazon S3
API Proxy and GraphQL Messaging and Queues Analytics
Monitoring and Debugging
Compute Storage Database
AWS X-RayAWS Step Functions Amazon Cognito
User Management and IdP
AWS AppSync Amazon Athena
AWS Lambda@Edge
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Orchestration and State Management
Building blocks for serverless applications
AWS Lambda
Amazon DynamoDB
Amazon SNS
Amazon API Gateway Amazon SQS Amazon Kinesis
Amazon S3
API Proxy and GraphQL Messaging and Queues Analytics
Monitoring and Debugging
Compute Storage Database
AWS X-RayAWS Step Functions Amazon Cognito
User Management and IdP
AWS AppSync Amazon Athena
AWS Lambda@Edge
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Orchestration and State Management
Building blocks for serverless applications
AWS Lambda
Amazon DynamoDB
Amazon SNS
Amazon API Gateway Amazon SQS Amazon Kinesis
Amazon S3
API Proxy and GraphQL Messaging and Queues Analytics
Monitoring and Debugging
Compute Storage Database
AWS X-RayAWS Step Functions Amazon Cognito
User Management and IdP
AWS AppSync Amazon Athena
AWS Lambda@Edge
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Bringing all that together…
S3
CloudFront
Static
Content
Content
Delivery
API
Layer
Application
Layer
Persistency
Layer
API
Gateway
DynamoDBAWS
Lambda
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Getting hands-on
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
https://github.com/aws-samples/
aws-serverless-workshops
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CodeStar
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CodeStar
 Start developing on AWS in minutes
 Manage software delivery in one place
 Work across your team securely
 Choose from a variety of project templates
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CodeCommit
 Fully managed
 Secure
 High availability
 Collaborate on code
 Faster deployment lifecycle
 Use your existing tools
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CodeBuild
 Fully managed build service
 Continuous scaling
 Pay as you go
 Extensible
 Enables continuous integration and delivery
 Secure
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CodePipeline
 Rapid delivery
 Configurable workflow
 Get started fast
 Easy to integrate
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Cloud9
 Code with just a browser
 Code together in real time
 Build serverless applications with ease
 Direct terminal access to AWS
 Start new projects quickly
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM – Serverless
Application Model
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Serverless Application Model (SAM)
 CloudFormation extension optimized
for serverless
 New serverless resource types:
functions, APIs, and tables
 Supports anything CloudFormation
supports
 Open specification (Apache 2.0)
github.com/awslabs
serverless-application-model
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM template
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/todo_list.zip
Handler: index.gethtml
Runtime: nodejs4.3
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
ListTable:
Type: AWS::Serverless::SimpleTable
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM template
Tells CloudFormation this is a SAM
template it needs to “transform”
Creates a Lambda function with the
referenced managed IAM policy,
runtime, code at the referenced zip
location, and handler as defined.
Also creates an API Gateway and
takes care of all
mapping/permissions necessary
Creates a DynamoDB table with 5
Read & Write units
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/todo_list.zip
Handler: index.gethtml
Runtime: nodejs4.3
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
ListTable:
Type: AWS::Serverless::SimpleTable
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM CLI – Local API Gateway / Lambda
 CLI tool for local testing of
serverless apps
 Works with Lambda functions and
“proxy-style” APIs
 Response object and function logs
available on your local machine
 Supports all native runtimesgithub.com/awslabs
aws-sam-local
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM CLI – Local API Gateway / Lambda
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS X-Ray
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Orchestration and State Management
Building blocks for serverless applications
AWS Lambda
Amazon DynamoDB
Amazon SNS
Amazon API Gateway Amazon SQS Amazon Kinesis
Amazon S3
API Proxy and GraphQL Messaging and Queues Analytics
Monitoring and Debugging
Compute Storage Database
AWS X-RayAWS Step Functions Amazon Cognito
User Management and IdP
AWS AppSync Amazon Athena
AWS Lambda@Edge
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS X-Ray
 Review request behavior
 Discover application issues
 Improve application performance
 Ready to use with AWS
 Designed for a variety of applications
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How do I get more visibility of my App?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How do I get more visibility of my App?
const AWSXRay = require('aws-xray-sdk-core');
# Wraps AWS SDK and trace subsequent AWS Services
const AWS = AWSXRay.captureAWS(require('aws-sdk'));
const dynamoDb = new AWS.DynamoDB.DocumentClient();
const sqs = new AWS.SQS();
# Wraps HTTP calls made
const https = AWSXRay.captureHTTPs(require('https'));
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Resources
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Landing pages
 aws.amazon.com/serverless
 github.com/awslabs/serverless-application-model
 github.com/awslabs/aws-sam-cli
 github.com/aws-samples/aws-serverless-workshops
 aws.amazon.com/<service-name>
 aws.amazon.com/<service-name>/faq
 aws.amazon.com/<service-name>/pricing
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Whitepapers
Serverless Architectures
with AWS Lambda
November 2017
bit.ly/2zVvp0w
Optimizing Enterprise
Economics with
Serverless
Architectures
October 2017
bit.ly/2hQdy44
Serverless Applications
Lens
November 2017
bit.ly/
serverless_lens
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Recorded serverless breakout sessions
re:Invent 2017 –
Serverless breakout sessions
bit.ly/serverless_playlist17
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you
dirk.froehner@amazon.de

Modern Applications Web Day | Impress Your Friends with Your First Serverless Application

  • 1.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Dirk Fröhner, Solutions Architect, Amazon Web Services Impress Your Friends with Your First Serverless Application @dirk_f5r froehner@amazon.de@ Modern Application Web Day 2018-10-25
  • 2.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. https://secure.flickr.com/photos/mgifford/4525333972 Why are we here today?
  • 3.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Intro to serverless
  • 4.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. What is serverless computing?
  • 5.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. What is serverless computing? “Build and run applications without thinking about servers”
  • 6.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. What is serverless computing? “Build and run applications without thinking about servers” “Pay per request, not for idle”
  • 7.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Let’s take a look at the evolution of computing Physical servers in data centers
  • 8.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Let’s take a look at the evolution of computing Physical servers in data centers Virtual servers in data centers
  • 9.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Let’s take a look at the evolution of computing Physical servers in data centers Virtual servers in data centers Virtual servers in the cloud
  • 10.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved.
  • 11.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. What serverless means Scales with usageNo servers to provision or manage High availability built-in Never pay for idle
  • 12.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved.
  • 13.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Orchestration and State Management Building blocks for serverless applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 API Proxy and GraphQL Messaging and Queues Analytics Monitoring and Debugging Compute Storage Database AWS X-RayAWS Step Functions Amazon Cognito User Management and IdP AWS AppSync Amazon Athena AWS Lambda@Edge
  • 14.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Orchestration and State Management Building blocks for serverless applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 API Proxy and GraphQL Messaging and Queues Analytics Monitoring and Debugging Compute Storage Database AWS X-RayAWS Step Functions Amazon Cognito User Management and IdP AWS AppSync Amazon Athena AWS Lambda@Edge
  • 15.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Orchestration and State Management Building blocks for serverless applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 API Proxy and GraphQL Messaging and Queues Analytics Monitoring and Debugging Compute Storage Database AWS X-RayAWS Step Functions Amazon Cognito User Management and IdP AWS AppSync Amazon Athena AWS Lambda@Edge
  • 16.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Orchestration and State Management Building blocks for serverless applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 API Proxy and GraphQL Messaging and Queues Analytics Monitoring and Debugging Compute Storage Database AWS X-RayAWS Step Functions Amazon Cognito User Management and IdP AWS AppSync Amazon Athena AWS Lambda@Edge
  • 17.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Bringing all that together… S3 CloudFront Static Content Content Delivery API Layer Application Layer Persistency Layer API Gateway DynamoDBAWS Lambda
  • 18.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Getting hands-on
  • 19.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. https://github.com/aws-samples/ aws-serverless-workshops
  • 20.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CodeStar
  • 21.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. AWS CodeStar  Start developing on AWS in minutes  Manage software delivery in one place  Work across your team securely  Choose from a variety of project templates
  • 22.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. AWS CodeCommit  Fully managed  Secure  High availability  Collaborate on code  Faster deployment lifecycle  Use your existing tools
  • 23.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. AWS CodeBuild  Fully managed build service  Continuous scaling  Pay as you go  Extensible  Enables continuous integration and delivery  Secure
  • 24.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. AWS CodePipeline  Rapid delivery  Configurable workflow  Get started fast  Easy to integrate
  • 25.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. AWS Cloud9  Code with just a browser  Code together in real time  Build serverless applications with ease  Direct terminal access to AWS  Start new projects quickly
  • 26.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM – Serverless Application Model
  • 27.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. AWS Serverless Application Model (SAM)  CloudFormation extension optimized for serverless  New serverless resource types: functions, APIs, and tables  Supports anything CloudFormation supports  Open specification (Apache 2.0) github.com/awslabs serverless-application-model
  • 28.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. SAM template AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://sam-demo-bucket/todo_list.zip Handler: index.gethtml Runtime: nodejs4.3 Policies: AmazonDynamoDBReadOnlyAccess Events: GetHtml: Type: Api Properties: Path: /{proxy+} Method: ANY ListTable: Type: AWS::Serverless::SimpleTable
  • 29.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. SAM template Tells CloudFormation this is a SAM template it needs to “transform” Creates a Lambda function with the referenced managed IAM policy, runtime, code at the referenced zip location, and handler as defined. Also creates an API Gateway and takes care of all mapping/permissions necessary Creates a DynamoDB table with 5 Read & Write units AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Resources: GetHtmlFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://sam-demo-bucket/todo_list.zip Handler: index.gethtml Runtime: nodejs4.3 Policies: AmazonDynamoDBReadOnlyAccess Events: GetHtml: Type: Api Properties: Path: /{proxy+} Method: ANY ListTable: Type: AWS::Serverless::SimpleTable
  • 30.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. SAM CLI – Local API Gateway / Lambda  CLI tool for local testing of serverless apps  Works with Lambda functions and “proxy-style” APIs  Response object and function logs available on your local machine  Supports all native runtimesgithub.com/awslabs aws-sam-local
  • 31.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. SAM CLI – Local API Gateway / Lambda https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html
  • 32.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved.
  • 33.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS X-Ray
  • 34.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Orchestration and State Management Building blocks for serverless applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 API Proxy and GraphQL Messaging and Queues Analytics Monitoring and Debugging Compute Storage Database AWS X-RayAWS Step Functions Amazon Cognito User Management and IdP AWS AppSync Amazon Athena AWS Lambda@Edge
  • 35.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. AWS X-Ray  Review request behavior  Discover application issues  Improve application performance  Ready to use with AWS  Designed for a variety of applications
  • 36.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. How do I get more visibility of my App?
  • 37.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. How do I get more visibility of my App? const AWSXRay = require('aws-xray-sdk-core'); # Wraps AWS SDK and trace subsequent AWS Services const AWS = AWSXRay.captureAWS(require('aws-sdk')); const dynamoDb = new AWS.DynamoDB.DocumentClient(); const sqs = new AWS.SQS(); # Wraps HTTP calls made const https = AWSXRay.captureHTTPs(require('https'));
  • 38.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Resources
  • 39.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Landing pages  aws.amazon.com/serverless  github.com/awslabs/serverless-application-model  github.com/awslabs/aws-sam-cli  github.com/aws-samples/aws-serverless-workshops  aws.amazon.com/<service-name>  aws.amazon.com/<service-name>/faq  aws.amazon.com/<service-name>/pricing
  • 40.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Whitepapers Serverless Architectures with AWS Lambda November 2017 bit.ly/2zVvp0w Optimizing Enterprise Economics with Serverless Architectures October 2017 bit.ly/2hQdy44 Serverless Applications Lens November 2017 bit.ly/ serverless_lens
  • 41.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Recorded serverless breakout sessions re:Invent 2017 – Serverless breakout sessions bit.ly/serverless_playlist17
  • 42.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you dirk.froehner@amazon.de