SlideShare a Scribd company logo
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Eric Johnson
Sr. Developer Advocate – Serverless
@edjgeek
Meet AWS SAM
The Serverless Application Model
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Who am I?
• Eric Johnson - @edjgeek
• Sr. Developer Advocate – Serverless, AWS
• Serverless / Tooling / Automation Geek
• Software Architect / Solutions Architect
• Husband
• Father
• Music lover
• Pizza / Diet Dr. Pepper fanatic
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Howdy SAM
S
A
M
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Howdy SAM
Serverless
Application
Model
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM comes in two parts
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM templates
SAM comes in 2 parts
SAM CLI
Using shorthand syntax
to express resources
and event source
mappings, it provides
infrastructure as code
(IaC) for serverless
applications.
Provides tooling for
local development,
debugging, build,
packaging, and
deployment for
serverless applications
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM templates
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM templates
• Can mix in other non-SAM CloudFormation resources in
the same template
• i.e. Amazon S3, Amazon Kinesis, AWS Step Functions
• Supports use of Parameters, Mappings, Outputs, etc
• Supports Intrinsic Functions
• ie: Ref, Sub, Join, Select, Split
• Can use ImportValue
• (exceptions for RestApiId, Policies, StageName attributes)
• YAML or JSON
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM templates
Just 20 lines to create:
• Lambda function
• IAM role
• API Gateway
• DynamoDB table
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Cloud
SAM templates
Amazon API Gateway
Lambda function
Table Role
===
To become
this
Allowing
this
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTab
le
AWS::Serverless::LayerVersion
AWS::Serverless::Applicatio
n
AWS::Serverless::StateMac
hine
SAM Version 2016-10-31
7
serverles
s specific
resource
types
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources - Function
AWS Lambda
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources – Function build options
Option 1: Set “BuildMethod” to a
supported runtime or leave
blank to use the default build
system.
Option 2: Set “BuildMethod” to
makefile to use a MakeFile
directed build.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources – Policies
https://slip.link/sam-policies
70+Managed templates with
more being added.
Best Practice: start here
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources – Policies
Permissions to
be applied
Resources they
are applied to
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources – Policies
Attach the template to the
Lambda function
Dynamically pass in resource
information
Can be used with Functions and StateMachines
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources - API
Amazon API Gateway
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources - HttpApi
Amazon API Gateway
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources - SimpleTable
Amazon DynamoDB
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources - SimpleTable
Amazon DynamoDB
Creates a DynamoDB table with:
• Primary key id
• Dynamic capacity
• AWS managed encryption
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources – SimpleTable
Amazon DynamoDB
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources - LayerVersion
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources – LayerVersion build options
Option 1: Set “BuildMethod” to a
supported runtime or leave
blank to use the default build
system.
Option 2: Set “BuildMethod” to
makefile to use a MakeFile
directed build.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources - Application
AWS Serverless Application Repository
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM serverless resources - StateMachine
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::HttpApi
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
AWS::Serverless::StateMachine
AWS Step Functions
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Standard CloudFormation resources
Reminder:
Standard CloudFormation resources
work in SAM.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda function event sources
14Function Event
source types
supported in SAM
• S3
• SNS
• Kinesis
• DynamoDB
• SQS
• Api
• HttpApi
• Schedule
• CloudWatchEvent
• CloudWatchLogs
• IoTRule
• AlexaSkill
• Cognito
• EventBridgeRule
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Other services that integrate with Lambda
• Elastic Load Balancing (Application Load Balancer)
• Amazon Lex
• AmazonCloudFront (Lambda@Edge)
• Amazon Simple Email Service
• AWS CloudFormation
• AWS CodeCommit
• AWS Config
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using events with a Lambda function
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM Globals
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM Globals
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM Globals
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM Globals
Globals help you make your SAM
templates even smaller by
enabling you to re-use attributes
throughout.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Metadata – Serverless Application Repository
Publish an application to the
Serverless Application
Repository
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM CLI
Command line interface
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM Command Line Interface (CLI)
CLI tool for local development, debugging, testing, deploying, and
monitoring of serverless applications
SupportsAPI Gateway “proxy-style” and Lambda service API testing
Response object and function logs available on your local machine
Uses open source docker-lambda images to mimic Lambda’s execution
environment such as timeout, memory limits, runtimes
Can tail production logs from CloudWatch logs
Can help you build in native dependencies
https://aws.amazon.com/serverless/sam
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM init
• Creates a new serverless application
• Options
• Runtime: nodejs, dotnet, go, python, java, ruby
• Dependency manager: (Ex: Maven or Gradle)
• Output directory: path to application
• Name: Application name
• Location: location of custom template
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM init
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM init
Creates a serverless application
based on user input
• Select an AWS managed
template or a custom template of
your own
• Select runtime
• Select dependency manager
• Name application
Results
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM build
• Generates deployment artifacts targeting Lambda's
execution environment
• Options
• Use container to compile for native dependencies on Lambda
execution environment
• Utilizes native build tools like Dotnet, Go, and Maven for
compiling
• Allows for file omission in final artifacts
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM build
Results
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM package
• Packages a SAM application
• Copies the artifacts to an S3 bucket
• Outputs a YAML file with update CodeUri addresses
• Options
• Specify input template
• Specify S3 bucket
• Specify output template
• Now built in to SAM deploy, but still available for CI/CD
pipelines
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM package
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM deploy
• Deploys or updates serverless application on AWS
Cloud
• Deploys and manages S3 bucket for deployment
artifacts
• Saves deploy options to a config file
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM deploy --guided
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM deploy --guided
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM deploy - changeset
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM deploy – execute changeset
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM deploy - outputs
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM deploy
Results
Serverless application
• One lambda function
• One API Gateway
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM local
• Provides local development tools for serverless
applications.
• Depends on a docker container
• Options:
• Generate-event
• Start-API
• Start-Lambda
• Invoke Lambda
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM local generate-event
Generates a JSON object
representing the output from the
given service and type.
Current available event types:
alexa-skills-kit
alexa-smart-home
apigateway
batch
cloudformation
cloudfront
cloudwatch
codecommit
codepipeline
cognito
config
connect
dynamodb
kinesis
lex
rekognition
s3
sagemaker
ses
sns
sqs
stepfunctions
*Abbreviated for display
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM local start-api
$ curl http://127.0.0.1:3000/hello
SAM fetches proper
docker container if it
does not exist.
Lambda function
invoked locally via
local API Gateway
emulator.
REST client call
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Some helpful options for SAM local start-api
• --env-vars
• --debug-port
• --debug-path
• --debug-args
• --log-file
• --static-directory
• --docker-network
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM local start-lambda
$ aws lambda invoke --function-name "HelloWorldFunction" --endpoint-url
"http://127.0.0.1:3001" --no-verify-ssl out.txt
AWS CLI used to
invoke
Lambda function
invoked locally via
Lambda API
emulator
SAM fetches proper
docker container if it
does not exist.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Some helpful options for SAM local start-lambda
• --debug-port
• --debug-path
• --debug-args
• --log-file
• --static-directory
• --env-vars
• --docker-network
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM local invoke lambda
Directly invokes Lambda as if
through Lambda API
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Some helpful options for SAM local invoke
• [function name]
• --event
• --env-vars
• --debug-port
• --debug-path
• --debug-args
• --log-file
• --static-directory
• --docker-network
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM local is “build” aware
sam-app
├── .aws-sam
│ └── build
│ ├── HelloWorldFunction
│ │ ├── app.js
│ │ ├── node_modules
│ │ └── package.json
│ └── template.yaml
├── .gitignore
├── README.md
├── events
│ └── event.json
├── hello-world
│ ├── .npmignore
│ ├── app.js
│ ├── package.json
│ └── tests
│ └── unit
│ └── test-handler.js
└── template.yaml
Which manifest?
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM logs
AWS Cloud
Amazon CloudWatch
User
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Some helpful options for SAM logs
• --filter: simple keywords or CloudWatch supported
pattern
• --start-time: relative values or timestamps
• --end-time: relative values or timestamps
• --tail: continuously fetches logs
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Debugging locally with SAM CLI
http://bit.ly/sam-debug
NODE Example
1. In your IDE create a debug
configuration
2. Add a breakpoint in your code
3. Invoke the Lambda using start-api,
start-lambda, or invoke lambda
4. Attach the debugger
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Debugging locally with SAM CLI
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
#SessionsWithSAM
slip.link/sws
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
@edjgeek Image Source: Image by Gerd Altmann from Pixabay

More Related Content

What's hot

Serverless for Developers
Serverless for DevelopersServerless for Developers
Serverless for Developers
Sébastien ☁ Stormacq
 
Running Containers in a Hybrid Environment
Running Containers in a Hybrid EnvironmentRunning Containers in a Hybrid Environment
Running Containers in a Hybrid Environment
Amazon Web Services
 
CI/CD for AWS Lambda Projects - IsraelCloud Meetup
CI/CD for AWS Lambda Projects - IsraelCloud MeetupCI/CD for AWS Lambda Projects - IsraelCloud Meetup
CI/CD for AWS Lambda Projects - IsraelCloud Meetup
Boaz Ziniman
 
All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]
Cloud Elements
 
Integrate Your Favourite Microsoft DevOps Tools with AWS - AWS Summit Sydney
Integrate Your Favourite Microsoft DevOps Tools with AWS - AWS Summit SydneyIntegrate Your Favourite Microsoft DevOps Tools with AWS - AWS Summit Sydney
Integrate Your Favourite Microsoft DevOps Tools with AWS - AWS Summit Sydney
Amazon Web Services
 
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
AWS Germany
 
Simplify front end apps.pdf
Simplify front end apps.pdfSimplify front end apps.pdf
Simplify front end apps.pdf
Amazon Web Services
 
Deep-Dive-with-Cloud-Monitoring-with-Amazon-EKS-and-Prometheus
Deep-Dive-with-Cloud-Monitoring-with-Amazon-EKS-and-PrometheusDeep-Dive-with-Cloud-Monitoring-with-Amazon-EKS-and-Prometheus
Deep-Dive-with-Cloud-Monitoring-with-Amazon-EKS-and-Prometheus
Amazon Web Services
 
Build a Serverless Backend for Requesting a Ride
Build a Serverless Backend for Requesting a RideBuild a Serverless Backend for Requesting a Ride
Build a Serverless Backend for Requesting a Ride
Amazon Web Services
 
Ci/CD for AWS Lambda Projects - JLM CTO Club
Ci/CD for AWS Lambda Projects - JLM CTO ClubCi/CD for AWS Lambda Projects - JLM CTO Club
Ci/CD for AWS Lambda Projects - JLM CTO Club
Boaz Ziniman
 
Continuous Delivery on AWS with Zero Downtime
Continuous Delivery on AWS with Zero DowntimeContinuous Delivery on AWS with Zero Downtime
Continuous Delivery on AWS with Zero Downtime
Casey Lee
 
Building a Serverless AI Powered Twitter Bot: Collision 2018
Building a Serverless AI Powered Twitter Bot: Collision 2018Building a Serverless AI Powered Twitter Bot: Collision 2018
Building a Serverless AI Powered Twitter Bot: Collision 2018
Amazon Web Services
 
Introduction to Mobile Development with AWS
Introduction to Mobile Development with AWSIntroduction to Mobile Development with AWS
Introduction to Mobile Development with AWS
Amazon Web Services
 
Build a Web Authentication System with a Custom UI
Build a Web Authentication System with a Custom UIBuild a Web Authentication System with a Custom UI
Build a Web Authentication System with a Custom UI
Amazon Web Services
 
Invite Your Prospects With an Engaging Email Campaign
Invite Your Prospects With an Engaging Email CampaignInvite Your Prospects With an Engaging Email Campaign
Invite Your Prospects With an Engaging Email Campaign
Amazon Web Services
 
AWS Webinar Series - Developing and Implementing APIs at Scale
AWS Webinar Series - Developing and Implementing APIs at ScaleAWS Webinar Series - Developing and Implementing APIs at Scale
AWS Webinar Series - Developing and Implementing APIs at Scale
Amazon Web Services
 
Operationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Operationalize Your AWS Infrastructure Into All Phases of Software LifecycleOperationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Operationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Amazon Web Services
 
Python Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - AppenginePython Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - Appengine
Python Ireland
 
AEM 6.0 - Author UI Customization & Features
AEM 6.0 - Author UI Customization & FeaturesAEM 6.0 - Author UI Customization & Features
AEM 6.0 - Author UI Customization & Features
Abhinit Bhatnagar
 
Introduction to AWS Amplify CLI
Introduction to AWS Amplify CLIIntroduction to AWS Amplify CLI
Introduction to AWS Amplify CLI
Amazon Web Services
 

What's hot (20)

Serverless for Developers
Serverless for DevelopersServerless for Developers
Serverless for Developers
 
Running Containers in a Hybrid Environment
Running Containers in a Hybrid EnvironmentRunning Containers in a Hybrid Environment
Running Containers in a Hybrid Environment
 
CI/CD for AWS Lambda Projects - IsraelCloud Meetup
CI/CD for AWS Lambda Projects - IsraelCloud MeetupCI/CD for AWS Lambda Projects - IsraelCloud Meetup
CI/CD for AWS Lambda Projects - IsraelCloud Meetup
 
All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]
 
Integrate Your Favourite Microsoft DevOps Tools with AWS - AWS Summit Sydney
Integrate Your Favourite Microsoft DevOps Tools with AWS - AWS Summit SydneyIntegrate Your Favourite Microsoft DevOps Tools with AWS - AWS Summit Sydney
Integrate Your Favourite Microsoft DevOps Tools with AWS - AWS Summit Sydney
 
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
 
Simplify front end apps.pdf
Simplify front end apps.pdfSimplify front end apps.pdf
Simplify front end apps.pdf
 
Deep-Dive-with-Cloud-Monitoring-with-Amazon-EKS-and-Prometheus
Deep-Dive-with-Cloud-Monitoring-with-Amazon-EKS-and-PrometheusDeep-Dive-with-Cloud-Monitoring-with-Amazon-EKS-and-Prometheus
Deep-Dive-with-Cloud-Monitoring-with-Amazon-EKS-and-Prometheus
 
Build a Serverless Backend for Requesting a Ride
Build a Serverless Backend for Requesting a RideBuild a Serverless Backend for Requesting a Ride
Build a Serverless Backend for Requesting a Ride
 
Ci/CD for AWS Lambda Projects - JLM CTO Club
Ci/CD for AWS Lambda Projects - JLM CTO ClubCi/CD for AWS Lambda Projects - JLM CTO Club
Ci/CD for AWS Lambda Projects - JLM CTO Club
 
Continuous Delivery on AWS with Zero Downtime
Continuous Delivery on AWS with Zero DowntimeContinuous Delivery on AWS with Zero Downtime
Continuous Delivery on AWS with Zero Downtime
 
Building a Serverless AI Powered Twitter Bot: Collision 2018
Building a Serverless AI Powered Twitter Bot: Collision 2018Building a Serverless AI Powered Twitter Bot: Collision 2018
Building a Serverless AI Powered Twitter Bot: Collision 2018
 
Introduction to Mobile Development with AWS
Introduction to Mobile Development with AWSIntroduction to Mobile Development with AWS
Introduction to Mobile Development with AWS
 
Build a Web Authentication System with a Custom UI
Build a Web Authentication System with a Custom UIBuild a Web Authentication System with a Custom UI
Build a Web Authentication System with a Custom UI
 
Invite Your Prospects With an Engaging Email Campaign
Invite Your Prospects With an Engaging Email CampaignInvite Your Prospects With an Engaging Email Campaign
Invite Your Prospects With an Engaging Email Campaign
 
AWS Webinar Series - Developing and Implementing APIs at Scale
AWS Webinar Series - Developing and Implementing APIs at ScaleAWS Webinar Series - Developing and Implementing APIs at Scale
AWS Webinar Series - Developing and Implementing APIs at Scale
 
Operationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Operationalize Your AWS Infrastructure Into All Phases of Software LifecycleOperationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
Operationalize Your AWS Infrastructure Into All Phases of Software Lifecycle
 
Python Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - AppenginePython Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - Appengine
 
AEM 6.0 - Author UI Customization & Features
AEM 6.0 - Author UI Customization & FeaturesAEM 6.0 - Author UI Customization & Features
AEM 6.0 - Author UI Customization & Features
 
Introduction to AWS Amplify CLI
Introduction to AWS Amplify CLIIntroduction to AWS Amplify CLI
Introduction to AWS Amplify CLI
 

Similar to Meet AWS SAM

Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Amazon Web Services
 
Serverless Functions Deep Dive
Serverless Functions Deep DiveServerless Functions Deep Dive
Serverless Functions Deep Dive
Amazon Web Services
 
Serverless Application Debugging and Delivery Best Practices (DEV307-R1) - AW...
Serverless Application Debugging and Delivery Best Practices (DEV307-R1) - AW...Serverless Application Debugging and Delivery Best Practices (DEV307-R1) - AW...
Serverless Application Debugging and Delivery Best Practices (DEV307-R1) - AW...
Amazon Web Services
 
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
 Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019 Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
AWS Summits
 
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
 Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019 Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
Amazon Web Services
 
.NET on AWS
.NET on AWS.NET on AWS
.NET on AWS
Amazon Web Services
 
Authoring and Deploying Serverless Applications with AWS SAM - SRV311 - re:In...
Authoring and Deploying Serverless Applications with AWS SAM - SRV311 - re:In...Authoring and Deploying Serverless Applications with AWS SAM - SRV311 - re:In...
Authoring and Deploying Serverless Applications with AWS SAM - SRV311 - re:In...
Amazon Web Services
 
AWS Summit Singapore 2019 | Microsoft DevOps on AWS
AWS Summit Singapore 2019 | Microsoft DevOps on AWSAWS Summit Singapore 2019 | Microsoft DevOps on AWS
AWS Summit Singapore 2019 | Microsoft DevOps on AWS
AWS Summits
 
The serverless LAMP stack
The serverless LAMP stackThe serverless LAMP stack
The serverless LAMP stack
⛷️ Ben Smith
 
Serverless functions deep dive
Serverless functions deep diveServerless functions deep dive
Serverless functions deep dive
Amazon Web Services
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
AWS Summits
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Amazon Web Services
 
Serverless-AWS SAM CLI Session: Developer Meet Up
Serverless-AWS SAM CLI Session: Developer Meet UpServerless-AWS SAM CLI Session: Developer Meet Up
Serverless-AWS SAM CLI Session: Developer Meet Up
Amazon Web Services
 
Developing Serverless Application on AWS
Developing Serverless Application on AWSDeveloping Serverless Application on AWS
Developing Serverless Application on AWS
Amazon Web Services
 
AWS Serverless Development
AWS Serverless DevelopmentAWS Serverless Development
AWS Serverless Development
Amazon Web Services
 
Building CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless ApplicationsBuilding CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless Applications
Amazon Web Services
 
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
Amazon Web Services
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Amazon Web Services
 
Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018
AWS Germany
 
AWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as Code
AWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as CodeAWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as Code
AWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as Code
Cobus Bernard
 

Similar to Meet AWS SAM (20)

Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
Unlocking Agility with the AWS Serverless Application Model (SAM) - AWS Summi...
 
Serverless Functions Deep Dive
Serverless Functions Deep DiveServerless Functions Deep Dive
Serverless Functions Deep Dive
 
Serverless Application Debugging and Delivery Best Practices (DEV307-R1) - AW...
Serverless Application Debugging and Delivery Best Practices (DEV307-R1) - AW...Serverless Application Debugging and Delivery Best Practices (DEV307-R1) - AW...
Serverless Application Debugging and Delivery Best Practices (DEV307-R1) - AW...
 
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
 Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019 Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
 
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
 Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019 Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
 
.NET on AWS
.NET on AWS.NET on AWS
.NET on AWS
 
Authoring and Deploying Serverless Applications with AWS SAM - SRV311 - re:In...
Authoring and Deploying Serverless Applications with AWS SAM - SRV311 - re:In...Authoring and Deploying Serverless Applications with AWS SAM - SRV311 - re:In...
Authoring and Deploying Serverless Applications with AWS SAM - SRV311 - re:In...
 
AWS Summit Singapore 2019 | Microsoft DevOps on AWS
AWS Summit Singapore 2019 | Microsoft DevOps on AWSAWS Summit Singapore 2019 | Microsoft DevOps on AWS
AWS Summit Singapore 2019 | Microsoft DevOps on AWS
 
The serverless LAMP stack
The serverless LAMP stackThe serverless LAMP stack
The serverless LAMP stack
 
Serverless functions deep dive
Serverless functions deep diveServerless functions deep dive
Serverless functions deep dive
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
 
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
Building a fully serverless application on AWS | AWS Summit Tel Aviv 2019
 
Serverless-AWS SAM CLI Session: Developer Meet Up
Serverless-AWS SAM CLI Session: Developer Meet UpServerless-AWS SAM CLI Session: Developer Meet Up
Serverless-AWS SAM CLI Session: Developer Meet Up
 
Developing Serverless Application on AWS
Developing Serverless Application on AWSDeveloping Serverless Application on AWS
Developing Serverless Application on AWS
 
AWS Serverless Development
AWS Serverless DevelopmentAWS Serverless Development
AWS Serverless Development
 
Building CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless ApplicationsBuilding CI-CD Pipelines for Serverless Applications
Building CI-CD Pipelines for Serverless Applications
 
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
 
Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018Serverless Developer Experience I AWS Dev Day 2018
Serverless Developer Experience I AWS Dev Day 2018
 
AWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as Code
AWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as CodeAWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as Code
AWS SSA Webinar 28 - Getting Started with AWS - Infrastructure as Code
 

Recently uploaded

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 

Recently uploaded (20)

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 

Meet AWS SAM

  • 1. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Eric Johnson Sr. Developer Advocate – Serverless @edjgeek Meet AWS SAM The Serverless Application Model
  • 2. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Who am I? • Eric Johnson - @edjgeek • Sr. Developer Advocate – Serverless, AWS • Serverless / Tooling / Automation Geek • Software Architect / Solutions Architect • Husband • Father • Music lover • Pizza / Diet Dr. Pepper fanatic
  • 3. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Howdy SAM S A M
  • 4. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Howdy SAM Serverless Application Model
  • 5. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM comes in two parts
  • 6. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM templates SAM comes in 2 parts SAM CLI Using shorthand syntax to express resources and event source mappings, it provides infrastructure as code (IaC) for serverless applications. Provides tooling for local development, debugging, build, packaging, and deployment for serverless applications
  • 7. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM templates
  • 8. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM templates • Can mix in other non-SAM CloudFormation resources in the same template • i.e. Amazon S3, Amazon Kinesis, AWS Step Functions • Supports use of Parameters, Mappings, Outputs, etc • Supports Intrinsic Functions • ie: Ref, Sub, Join, Select, Split • Can use ImportValue • (exceptions for RestApiId, Policies, StageName attributes) • YAML or JSON
  • 9. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM templates Just 20 lines to create: • Lambda function • IAM role • API Gateway • DynamoDB table
  • 10. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Cloud SAM templates Amazon API Gateway Lambda function Table Role === To become this Allowing this
  • 11. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTab le AWS::Serverless::LayerVersion AWS::Serverless::Applicatio n AWS::Serverless::StateMac hine SAM Version 2016-10-31 7 serverles s specific resource types
  • 12. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources - Function AWS Lambda AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine
  • 13. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources – Function build options Option 1: Set “BuildMethod” to a supported runtime or leave blank to use the default build system. Option 2: Set “BuildMethod” to makefile to use a MakeFile directed build.
  • 14. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources – Policies https://slip.link/sam-policies 70+Managed templates with more being added. Best Practice: start here
  • 15. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources – Policies Permissions to be applied Resources they are applied to
  • 16. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources – Policies Attach the template to the Lambda function Dynamically pass in resource information Can be used with Functions and StateMachines
  • 17. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources - API Amazon API Gateway AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine
  • 18. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources - HttpApi Amazon API Gateway AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine
  • 19. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources - SimpleTable Amazon DynamoDB AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine
  • 20. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources - SimpleTable Amazon DynamoDB Creates a DynamoDB table with: • Primary key id • Dynamic capacity • AWS managed encryption AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine
  • 21. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources – SimpleTable Amazon DynamoDB AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine
  • 22. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources - LayerVersion AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine
  • 23. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources – LayerVersion build options Option 1: Set “BuildMethod” to a supported runtime or leave blank to use the default build system. Option 2: Set “BuildMethod” to makefile to use a MakeFile directed build.
  • 24. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources - Application AWS Serverless Application Repository AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine
  • 25. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM serverless resources - StateMachine AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::HttpApi AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application AWS::Serverless::StateMachine AWS Step Functions
  • 26. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Standard CloudFormation resources Reminder: Standard CloudFormation resources work in SAM.
  • 27. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda function event sources 14Function Event source types supported in SAM • S3 • SNS • Kinesis • DynamoDB • SQS • Api • HttpApi • Schedule • CloudWatchEvent • CloudWatchLogs • IoTRule • AlexaSkill • Cognito • EventBridgeRule
  • 28. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Other services that integrate with Lambda • Elastic Load Balancing (Application Load Balancer) • Amazon Lex • AmazonCloudFront (Lambda@Edge) • Amazon Simple Email Service • AWS CloudFormation • AWS CodeCommit • AWS Config
  • 29. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Using events with a Lambda function
  • 30. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM Globals
  • 31. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM Globals
  • 32. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM Globals
  • 33. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM Globals Globals help you make your SAM templates even smaller by enabling you to re-use attributes throughout.
  • 34. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Metadata – Serverless Application Repository Publish an application to the Serverless Application Repository
  • 35. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM CLI Command line interface
  • 36. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS SAM Command Line Interface (CLI) CLI tool for local development, debugging, testing, deploying, and monitoring of serverless applications SupportsAPI Gateway “proxy-style” and Lambda service API testing Response object and function logs available on your local machine Uses open source docker-lambda images to mimic Lambda’s execution environment such as timeout, memory limits, runtimes Can tail production logs from CloudWatch logs Can help you build in native dependencies https://aws.amazon.com/serverless/sam
  • 37. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM init • Creates a new serverless application • Options • Runtime: nodejs, dotnet, go, python, java, ruby • Dependency manager: (Ex: Maven or Gradle) • Output directory: path to application • Name: Application name • Location: location of custom template
  • 38. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM init
  • 39. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM init Creates a serverless application based on user input • Select an AWS managed template or a custom template of your own • Select runtime • Select dependency manager • Name application Results
  • 40. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM build • Generates deployment artifacts targeting Lambda's execution environment • Options • Use container to compile for native dependencies on Lambda execution environment • Utilizes native build tools like Dotnet, Go, and Maven for compiling • Allows for file omission in final artifacts
  • 41. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM build Results
  • 42. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM package • Packages a SAM application • Copies the artifacts to an S3 bucket • Outputs a YAML file with update CodeUri addresses • Options • Specify input template • Specify S3 bucket • Specify output template • Now built in to SAM deploy, but still available for CI/CD pipelines
  • 43. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM package
  • 44. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM deploy • Deploys or updates serverless application on AWS Cloud • Deploys and manages S3 bucket for deployment artifacts • Saves deploy options to a config file
  • 45. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM deploy --guided
  • 46. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM deploy --guided
  • 47. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM deploy - changeset
  • 48. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM deploy – execute changeset
  • 49. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM deploy - outputs
  • 50. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM deploy Results Serverless application • One lambda function • One API Gateway
  • 51. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM local • Provides local development tools for serverless applications. • Depends on a docker container • Options: • Generate-event • Start-API • Start-Lambda • Invoke Lambda
  • 52. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM local generate-event Generates a JSON object representing the output from the given service and type. Current available event types: alexa-skills-kit alexa-smart-home apigateway batch cloudformation cloudfront cloudwatch codecommit codepipeline cognito config connect dynamodb kinesis lex rekognition s3 sagemaker ses sns sqs stepfunctions *Abbreviated for display
  • 53. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM local start-api $ curl http://127.0.0.1:3000/hello SAM fetches proper docker container if it does not exist. Lambda function invoked locally via local API Gateway emulator. REST client call
  • 54. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Some helpful options for SAM local start-api • --env-vars • --debug-port • --debug-path • --debug-args • --log-file • --static-directory • --docker-network
  • 55. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM local start-lambda $ aws lambda invoke --function-name "HelloWorldFunction" --endpoint-url "http://127.0.0.1:3001" --no-verify-ssl out.txt AWS CLI used to invoke Lambda function invoked locally via Lambda API emulator SAM fetches proper docker container if it does not exist.
  • 56. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Some helpful options for SAM local start-lambda • --debug-port • --debug-path • --debug-args • --log-file • --static-directory • --env-vars • --docker-network
  • 57. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM local invoke lambda Directly invokes Lambda as if through Lambda API
  • 58. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Some helpful options for SAM local invoke • [function name] • --event • --env-vars • --debug-port • --debug-path • --debug-args • --log-file • --static-directory • --docker-network
  • 59. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM local is “build” aware sam-app ├── .aws-sam │ └── build │ ├── HelloWorldFunction │ │ ├── app.js │ │ ├── node_modules │ │ └── package.json │ └── template.yaml ├── .gitignore ├── README.md ├── events │ └── event.json ├── hello-world │ ├── .npmignore │ ├── app.js │ ├── package.json │ └── tests │ └── unit │ └── test-handler.js └── template.yaml Which manifest?
  • 60. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. SAM logs AWS Cloud Amazon CloudWatch User
  • 61. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Some helpful options for SAM logs • --filter: simple keywords or CloudWatch supported pattern • --start-time: relative values or timestamps • --end-time: relative values or timestamps • --tail: continuously fetches logs
  • 62. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Debugging locally with SAM CLI http://bit.ly/sam-debug NODE Example 1. In your IDE create a debug configuration 2. Add a breakpoint in your code 3. Invoke the Lambda using start-api, start-lambda, or invoke lambda 4. Attach the debugger
  • 63. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Debugging locally with SAM CLI
  • 64. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. #SessionsWithSAM slip.link/sws
  • 65. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. @edjgeek Image Source: Image by Gerd Altmann from Pixabay

Editor's Notes

  1. Creates a simple table Hash/Index: id Capacity: on-demand Encrypted, key managed by AWS If Range is needed then a standard table can be used here
  2. Creates a simple table Hash/Index: id Capacity: on-demand Encrypted, key managed by AWS If Range is needed then a standard table can be used here
  3. Starts local API Gateway emulator. Waits for rest calls
  4. Starts a local version of the Lambda API service. Waits for API calls to trigger Can also be called via SDK.
  5. Starts a local version of the Lambda API service
  6. Can be any Lambda in a stack
  7. Image by <a href="https://pixabay.com/users/geralt-9301/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2490552">Gerd Altmann</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2490552">Pixabay</a>
  8. Image by <a href="https://pixabay.com/users/geralt-9301/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2245264">Gerd Altmann</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2245264">Pixabay</a>