SlideShare a Scribd company logo
1 of 24
Download to read offline
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
AWS Lambda Layers in action
Eric Johnson
Senior Developer Advocate, Serverless
AWS
M A D 3 1 3
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Who am I?
• @edjgeek
• Senior developer advocate – Serverless
• Serverless/tooling/automation geek
• Dad of five
• Husband of one
• Drummer
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Serverless applications
Event source Services
Changes in
data state
Requests to
endpoints
Changes in
resource state
Function
Node.js
Python
Java
C#
Go
Ruby
Runtime API
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of an AWS Lambda function
Handler() function
Function to be executed
upon invocation
Event object
Data sent during Lambda
function invocation
Context object
Methods available to
interact with runtime
information (request ID, log
group, more)
import json
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello World!')
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of an AWS Lambda function
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
} else {
result = SubfunctionB()
return result;
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionB(thing){
## logic here
}
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of an AWS Lambda function
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
} else {
result = SubfunctionB()
return result;
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionB(thing){
## logic here
}
Functions will then grow in complexity with business
logic sub-functions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of an AWS Lambda function
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionB(thing){
## logic here
}
Business logic sub-functions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionB(thing){
## logic here
}
Anatomy of an AWS Lambda function
Dependencies, configuration information, common helper functions
Common helper functions
Business logic sub-functions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of a serverless application
/orders
/forums
/search
/lists
/user
/...
Now, assume that I
have an API-based
workloadAmazon API
Gateway
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of a serverless application
It needs to read/write to a
database and get keys and
configuration from
external services
AWS Secrets
Manager/
Parameter Store
Amazon DynamoDB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of a serverless application
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
/orders
/forums
/search
/lists
/user
/...
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Amazon API
Gateway
AWS Secrets
Manager/
Parameter Store
Amazon DynamoDB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of a serverless application
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
/orders
/forums
/search
/lists
/user
/...
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Pre-handler-secret-getter() {
}
Function Pre-handler-db-connect(){
}
Function subFunctionA(thing){
## logic here
}
Function subFunctionA(thing){
## logic here
}
Dependencies, configuration information,
common helper functions
Common helper functions
Business logic sub-functions
Amazon API
Gateway
AWS Secrets
Manager/
Parameter Store
Amazon DynamoDB
There could be a lot of
duplicated code here!
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Anatomy of a serverless application
/orders
/forums
/search
/lists
/user
/...
Amazon API
Gateway
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function
Import sdk
Import http-lib
Import ham-sandwich
Pre-handler-secret-getter()
Pre-handler-db-connect()
Function myhandler(event, context) {
<Event handling logic> {
result = SubfunctionA()
}else {
result = SubfunctionB()
return result;
}
Function
Dependencies, configuration information
Common helper functions
Business logic sub-functions
We want something
more like this
AWS Secrets
Manager/
Parameter Store
Amazon DynamoDB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Lambda layers
Let functions easily share code; upload layer once,
reference within any function
Layer can be anything: Dependencies, training data,
configuration files, etc.
Promote separation of responsibilities and let
developers iterate faster on writing business logic
Built-in support for secure sharing by ecosystem
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Using Lambda layers
• Put common components in a .zip file and upload
it as a Lambda layer
• Layers are immutable and can be versioned to
manage updates
• When a version is deleted or permissions to use it
are revoked, functions that used it previously will
continue to work, but you won’t be able to create
new ones
• You can reference up to five layers, one of which
can optionally be a custom runtime
Lambda
layers
arn:aws:lambda:region:accountId:layer:shared-lib :1
Lambda
layers
arn:aws:lambda:region:accountId:layer:shared-lib:2
Lambda
layers
arn:aws:lambda:region:accountId:layer:shared-lib:3
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
How Lambda layers work
Order is important because each layer is a .zip file, and they are all extracted in
the same path
• /opt
• Each layer can potentially overwrite the previous one
This approach can be used to customize the environment
For example, the first layer can be a custom runtime, and the second layer can add specific versions of the
libraries that you need
The storage of your Lambda layers takes part in the Lambda function storage per
region limit (75 GB)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Including library dependencies in a layer
Runtime Folders
Node.js
nodejs/node_modules
nodejs/node8/node_modules (NODE_PATH)
Python
python
python/lib/python3.7/site-packages (site directories)
Java java/lib (CLASSPATH)
Ruby
ruby/gems/2.5.0 (GEM_PATH)
ruby/lib (RUBY_LIB)
All
bin (PATH)
lib (LD_LIBRARY_PATH)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
AWS SAM template properties
Properties:
LayerName: MyLayer
Description: Layer description
ContentUri: 's3://my-bucket/my-layer.zip'
CompatibleRuntimes:
- nodejs6.10
- nodejs8.10
LicenseInfo: 'MIT-0 license.'
RetentionPolicy: Retain
From SAM version 2016-10-31
AWS::Serverless::Function
AWS::Serverless::Api
AWS::Serverless::SimpleTable
AWS::Serverless::LayerVersion
AWS::Serverless::Application
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
aws.amazon.com/serverless
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Eric Johnson
@edjgeek

More Related Content

What's hot

Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS Summit
Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS SummitKubernetes on AWS with Amazon EKS - MAD301 - New York AWS Summit
Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS SummitAmazon Web Services
 
Well-architected Amazon WorkSpaces: Enterprise deployment at scale - SVC304 -...
Well-architected Amazon WorkSpaces: Enterprise deployment at scale - SVC304 -...Well-architected Amazon WorkSpaces: Enterprise deployment at scale - SVC304 -...
Well-architected Amazon WorkSpaces: Enterprise deployment at scale - SVC304 -...Amazon Web Services
 
Scalable serverless architectures using event-driven design - MAD308 - New Yo...
Scalable serverless architectures using event-driven design - MAD308 - New Yo...Scalable serverless architectures using event-driven design - MAD308 - New Yo...
Scalable serverless architectures using event-driven design - MAD308 - New Yo...Amazon Web Services
 
Running Amazon EC2 workloads at scale - CMP301 - New York AWS Summit
Running Amazon EC2 workloads at scale - CMP301 - New York AWS SummitRunning Amazon EC2 workloads at scale - CMP301 - New York AWS Summit
Running Amazon EC2 workloads at scale - CMP301 - New York AWS SummitAmazon Web Services
 
Gain visibility & real-time actionable security alerts with VPC Flow Logs & A...
Gain visibility & real-time actionable security alerts with VPC Flow Logs & A...Gain visibility & real-time actionable security alerts with VPC Flow Logs & A...
Gain visibility & real-time actionable security alerts with VPC Flow Logs & A...Amazon Web Services
 
Architecting Digital Media Archive Migrations with AWS - STG301 - Anaheim AWS...
Architecting Digital Media Archive Migrations with AWS - STG301 - Anaheim AWS...Architecting Digital Media Archive Migrations with AWS - STG301 - Anaheim AWS...
Architecting Digital Media Archive Migrations with AWS - STG301 - Anaheim AWS...Amazon Web Services
 
Accelerating your Cloud Migration with VMware Cloud on AWS - SVC210 - Atlanta...
Accelerating your Cloud Migration with VMware Cloud on AWS - SVC210 - Atlanta...Accelerating your Cloud Migration with VMware Cloud on AWS - SVC210 - Atlanta...
Accelerating your Cloud Migration with VMware Cloud on AWS - SVC210 - Atlanta...Amazon Web Services
 
從業人員指南-如何像技術專家一樣守護您的雲端安全
從業人員指南-如何像技術專家一樣守護您的雲端安全從業人員指南-如何像技術專家一樣守護您的雲端安全
從業人員指南-如何像技術專家一樣守護您的雲端安全Amazon Web Services
 
AWS 如何協助客戶建立 DevOps 流程
AWS 如何協助客戶建立 DevOps 流程AWS 如何協助客戶建立 DevOps 流程
AWS 如何協助客戶建立 DevOps 流程Amazon Web Services
 
Getting started with AWS IoT Core - SVC306 - New York AWS Summit
Getting started with AWS IoT Core - SVC306 - New York AWS SummitGetting started with AWS IoT Core - SVC306 - New York AWS Summit
Getting started with AWS IoT Core - SVC306 - New York AWS SummitAmazon Web Services
 
Building-Serverless-Analytics-On-AWS
Building-Serverless-Analytics-On-AWSBuilding-Serverless-Analytics-On-AWS
Building-Serverless-Analytics-On-AWSAmazon Web Services
 
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS SummitAutomatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS SummitAmazon Web Services
 
How to act on security and compliance alerts with AWS Security Hub - SEC202 -...
How to act on security and compliance alerts with AWS Security Hub - SEC202 -...How to act on security and compliance alerts with AWS Security Hub - SEC202 -...
How to act on security and compliance alerts with AWS Security Hub - SEC202 -...Amazon Web Services
 
Orchestrating containers on AWS | AWS Summit Tel Aviv 2019
Orchestrating containers on AWS  | AWS Summit Tel Aviv 2019Orchestrating containers on AWS  | AWS Summit Tel Aviv 2019
Orchestrating containers on AWS | AWS Summit Tel Aviv 2019AWS Summits
 
Developing Modern Applications in the Cloud
Developing Modern Applications in the CloudDeveloping Modern Applications in the Cloud
Developing Modern Applications in the CloudAmazon Web Services
 
Using automation to drive continuous-compliance best practices - SEC208 - New...
Using automation to drive continuous-compliance best practices - SEC208 - New...Using automation to drive continuous-compliance best practices - SEC208 - New...
Using automation to drive continuous-compliance best practices - SEC208 - New...Amazon Web Services
 
Find all the threats - AWS threat detection and remediation - SEC202 - Atlant...
Find all the threats - AWS threat detection and remediation - SEC202 - Atlant...Find all the threats - AWS threat detection and remediation - SEC202 - Atlant...
Find all the threats - AWS threat detection and remediation - SEC202 - Atlant...Amazon Web Services
 
Twelve-Factor serverless applications - MAD311 - Chicago AWS Summit
Twelve-Factor serverless applications - MAD311 - Chicago AWS SummitTwelve-Factor serverless applications - MAD311 - Chicago AWS Summit
Twelve-Factor serverless applications - MAD311 - Chicago AWS SummitAmazon 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-PrometheusAmazon Web Services
 
Serverless is dead.
Serverless is dead.Serverless is dead.
Serverless is dead.Chris Munns
 

What's hot (20)

Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS Summit
Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS SummitKubernetes on AWS with Amazon EKS - MAD301 - New York AWS Summit
Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS Summit
 
Well-architected Amazon WorkSpaces: Enterprise deployment at scale - SVC304 -...
Well-architected Amazon WorkSpaces: Enterprise deployment at scale - SVC304 -...Well-architected Amazon WorkSpaces: Enterprise deployment at scale - SVC304 -...
Well-architected Amazon WorkSpaces: Enterprise deployment at scale - SVC304 -...
 
Scalable serverless architectures using event-driven design - MAD308 - New Yo...
Scalable serverless architectures using event-driven design - MAD308 - New Yo...Scalable serverless architectures using event-driven design - MAD308 - New Yo...
Scalable serverless architectures using event-driven design - MAD308 - New Yo...
 
Running Amazon EC2 workloads at scale - CMP301 - New York AWS Summit
Running Amazon EC2 workloads at scale - CMP301 - New York AWS SummitRunning Amazon EC2 workloads at scale - CMP301 - New York AWS Summit
Running Amazon EC2 workloads at scale - CMP301 - New York AWS Summit
 
Gain visibility & real-time actionable security alerts with VPC Flow Logs & A...
Gain visibility & real-time actionable security alerts with VPC Flow Logs & A...Gain visibility & real-time actionable security alerts with VPC Flow Logs & A...
Gain visibility & real-time actionable security alerts with VPC Flow Logs & A...
 
Architecting Digital Media Archive Migrations with AWS - STG301 - Anaheim AWS...
Architecting Digital Media Archive Migrations with AWS - STG301 - Anaheim AWS...Architecting Digital Media Archive Migrations with AWS - STG301 - Anaheim AWS...
Architecting Digital Media Archive Migrations with AWS - STG301 - Anaheim AWS...
 
Accelerating your Cloud Migration with VMware Cloud on AWS - SVC210 - Atlanta...
Accelerating your Cloud Migration with VMware Cloud on AWS - SVC210 - Atlanta...Accelerating your Cloud Migration with VMware Cloud on AWS - SVC210 - Atlanta...
Accelerating your Cloud Migration with VMware Cloud on AWS - SVC210 - Atlanta...
 
從業人員指南-如何像技術專家一樣守護您的雲端安全
從業人員指南-如何像技術專家一樣守護您的雲端安全從業人員指南-如何像技術專家一樣守護您的雲端安全
從業人員指南-如何像技術專家一樣守護您的雲端安全
 
AWS 如何協助客戶建立 DevOps 流程
AWS 如何協助客戶建立 DevOps 流程AWS 如何協助客戶建立 DevOps 流程
AWS 如何協助客戶建立 DevOps 流程
 
Getting started with AWS IoT Core - SVC306 - New York AWS Summit
Getting started with AWS IoT Core - SVC306 - New York AWS SummitGetting started with AWS IoT Core - SVC306 - New York AWS Summit
Getting started with AWS IoT Core - SVC306 - New York AWS Summit
 
Building-Serverless-Analytics-On-AWS
Building-Serverless-Analytics-On-AWSBuilding-Serverless-Analytics-On-AWS
Building-Serverless-Analytics-On-AWS
 
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS SummitAutomatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
Automatically scaling Kubernetes workloads - SVC215-S - New York AWS Summit
 
How to act on security and compliance alerts with AWS Security Hub - SEC202 -...
How to act on security and compliance alerts with AWS Security Hub - SEC202 -...How to act on security and compliance alerts with AWS Security Hub - SEC202 -...
How to act on security and compliance alerts with AWS Security Hub - SEC202 -...
 
Orchestrating containers on AWS | AWS Summit Tel Aviv 2019
Orchestrating containers on AWS  | AWS Summit Tel Aviv 2019Orchestrating containers on AWS  | AWS Summit Tel Aviv 2019
Orchestrating containers on AWS | AWS Summit Tel Aviv 2019
 
Developing Modern Applications in the Cloud
Developing Modern Applications in the CloudDeveloping Modern Applications in the Cloud
Developing Modern Applications in the Cloud
 
Using automation to drive continuous-compliance best practices - SEC208 - New...
Using automation to drive continuous-compliance best practices - SEC208 - New...Using automation to drive continuous-compliance best practices - SEC208 - New...
Using automation to drive continuous-compliance best practices - SEC208 - New...
 
Find all the threats - AWS threat detection and remediation - SEC202 - Atlant...
Find all the threats - AWS threat detection and remediation - SEC202 - Atlant...Find all the threats - AWS threat detection and remediation - SEC202 - Atlant...
Find all the threats - AWS threat detection and remediation - SEC202 - Atlant...
 
Twelve-Factor serverless applications - MAD311 - Chicago AWS Summit
Twelve-Factor serverless applications - MAD311 - Chicago AWS SummitTwelve-Factor serverless applications - MAD311 - Chicago AWS Summit
Twelve-Factor serverless applications - MAD311 - Chicago AWS Summit
 
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
 
Serverless is dead.
Serverless is dead.Serverless is dead.
Serverless is dead.
 

Similar to AWS Lambda Layers in action - MAD313 - New York AWS Summit

AWS Lambda Layers, the Runtime API, & Nested Applications: re:Invent 2018 Rec...
AWS Lambda Layers, the Runtime API, & Nested Applications: re:Invent 2018 Rec...AWS Lambda Layers, the Runtime API, & Nested Applications: re:Invent 2018 Rec...
AWS Lambda Layers, the Runtime API, & Nested Applications: re:Invent 2018 Rec...Amazon Web Services
 
AWS Lambda Layers, the Runtime API, & Nested Applications
AWS Lambda Layers, the Runtime API, & Nested ApplicationsAWS Lambda Layers, the Runtime API, & Nested Applications
AWS Lambda Layers, the Runtime API, & Nested ApplicationsAmazon Web Services
 
Track 4 Session 2_MAD03 容器技術和 AWS Lambda 讓您專注「應用優先」.pptx
Track 4 Session 2_MAD03 容器技術和 AWS Lambda 讓您專注「應用優先」.pptxTrack 4 Session 2_MAD03 容器技術和 AWS Lambda 讓您專注「應用優先」.pptx
Track 4 Session 2_MAD03 容器技術和 AWS Lambda 讓您專注「應用優先」.pptxAmazon Web Services
 
Deep Visibility: Logging From Distributed Microservices
Deep Visibility: Logging From Distributed MicroservicesDeep Visibility: Logging From Distributed Microservices
Deep Visibility: Logging From Distributed MicroservicesAaronLieberman5
 
Practical Guidance for Increasing your Serverless Application's Security
Practical Guidance for Increasing your Serverless Application's SecurityPractical Guidance for Increasing your Serverless Application's Security
Practical Guidance for Increasing your Serverless Application's SecurityChris Munns
 
End AWS Lambda Cold Starts with Provisioned Concurrency
End AWS Lambda Cold Starts with Provisioned ConcurrencyEnd AWS Lambda Cold Starts with Provisioned Concurrency
End AWS Lambda Cold Starts with Provisioned ConcurrencyJulian Wood
 
Best Practices and Hard Lessons of Serverless- AWS Startup Day Toronto- Diego...
Best Practices and Hard Lessons of Serverless- AWS Startup Day Toronto- Diego...Best Practices and Hard Lessons of Serverless- AWS Startup Day Toronto- Diego...
Best Practices and Hard Lessons of Serverless- AWS Startup Day Toronto- Diego...Amazon Web Services
 
SRV328 Designing and Implementing a Serverless Media-Processing Workflow
SRV328 Designing and Implementing a Serverless Media-Processing WorkflowSRV328 Designing and Implementing a Serverless Media-Processing Workflow
SRV328 Designing and Implementing a Serverless Media-Processing WorkflowAmazon Web Services
 
Thirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS Summit
Thirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS SummitThirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS Summit
Thirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS SummitAmazon Web Services
 
The Best Practices and Hard Lessons Learned of Serverless Applications
The Best Practices and Hard Lessons Learned of Serverless ApplicationsThe Best Practices and Hard Lessons Learned of Serverless Applications
The Best Practices and Hard Lessons Learned of Serverless ApplicationsAmazon Web Services LATAM
 
AWS Webinar 23 - Getting Started with AWS - Understanding total cost of owner...
AWS Webinar 23 - Getting Started with AWS - Understanding total cost of owner...AWS Webinar 23 - Getting Started with AWS - Understanding total cost of owner...
AWS Webinar 23 - Getting Started with AWS - Understanding total cost of owner...Cobus Bernard
 
2016 - Serverless Microservices on AWS with API Gateway and Lambda
2016 - Serverless Microservices on AWS with API Gateway and Lambda2016 - Serverless Microservices on AWS with API Gateway and Lambda
2016 - Serverless Microservices on AWS with API Gateway and Lambdadevopsdaysaustin
 
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...Amazon Web Services
 
AWS Serverless with Chalice
AWS Serverless with Chalice AWS Serverless with Chalice
AWS Serverless with Chalice Suman Debnath
 
Designing and Implementing a Serverless Media Processing Workflow Using AWS S...
Designing and Implementing a Serverless Media Processing Workflow Using AWS S...Designing and Implementing a Serverless Media Processing Workflow Using AWS S...
Designing and Implementing a Serverless Media Processing Workflow Using AWS S...Amazon Web Services
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugToshiaki Maki
 
Design and Implement a Serverless Media-Processing Workflow
Design and Implement a Serverless Media-Processing Workflow Design and Implement a Serverless Media-Processing Workflow
Design and Implement a Serverless Media-Processing Workflow Amazon Web Services
 
Design and Implement a Serverless Media-Processing Workflow - SRV328 - Atlant...
Design and Implement a Serverless Media-Processing Workflow - SRV328 - Atlant...Design and Implement a Serverless Media-Processing Workflow - SRV328 - Atlant...
Design and Implement a Serverless Media-Processing Workflow - SRV328 - Atlant...Amazon Web Services
 
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28Amazon Web Services
 

Similar to AWS Lambda Layers in action - MAD313 - New York AWS Summit (20)

AWS Lambda Layers, the Runtime API, & Nested Applications: re:Invent 2018 Rec...
AWS Lambda Layers, the Runtime API, & Nested Applications: re:Invent 2018 Rec...AWS Lambda Layers, the Runtime API, & Nested Applications: re:Invent 2018 Rec...
AWS Lambda Layers, the Runtime API, & Nested Applications: re:Invent 2018 Rec...
 
AWS Lambda Layers, the Runtime API, & Nested Applications
AWS Lambda Layers, the Runtime API, & Nested ApplicationsAWS Lambda Layers, the Runtime API, & Nested Applications
AWS Lambda Layers, the Runtime API, & Nested Applications
 
Track 4 Session 2_MAD03 容器技術和 AWS Lambda 讓您專注「應用優先」.pptx
Track 4 Session 2_MAD03 容器技術和 AWS Lambda 讓您專注「應用優先」.pptxTrack 4 Session 2_MAD03 容器技術和 AWS Lambda 讓您專注「應用優先」.pptx
Track 4 Session 2_MAD03 容器技術和 AWS Lambda 讓您專注「應用優先」.pptx
 
Deep Visibility: Logging From Distributed Microservices
Deep Visibility: Logging From Distributed MicroservicesDeep Visibility: Logging From Distributed Microservices
Deep Visibility: Logging From Distributed Microservices
 
Practical Guidance for Increasing your Serverless Application's Security
Practical Guidance for Increasing your Serverless Application's SecurityPractical Guidance for Increasing your Serverless Application's Security
Practical Guidance for Increasing your Serverless Application's Security
 
End AWS Lambda Cold Starts with Provisioned Concurrency
End AWS Lambda Cold Starts with Provisioned ConcurrencyEnd AWS Lambda Cold Starts with Provisioned Concurrency
End AWS Lambda Cold Starts with Provisioned Concurrency
 
Best Practices and Hard Lessons of Serverless- AWS Startup Day Toronto- Diego...
Best Practices and Hard Lessons of Serverless- AWS Startup Day Toronto- Diego...Best Practices and Hard Lessons of Serverless- AWS Startup Day Toronto- Diego...
Best Practices and Hard Lessons of Serverless- AWS Startup Day Toronto- Diego...
 
SRV328 Designing and Implementing a Serverless Media-Processing Workflow
SRV328 Designing and Implementing a Serverless Media-Processing WorkflowSRV328 Designing and Implementing a Serverless Media-Processing Workflow
SRV328 Designing and Implementing a Serverless Media-Processing Workflow
 
Thirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS Summit
Thirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS SummitThirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS Summit
Thirty Serverless Architectures in 30 Minutes - SRV325 - Chicago AWS Summit
 
The Best Practices and Hard Lessons Learned of Serverless Applications
The Best Practices and Hard Lessons Learned of Serverless ApplicationsThe Best Practices and Hard Lessons Learned of Serverless Applications
The Best Practices and Hard Lessons Learned of Serverless Applications
 
AWS Webinar 23 - Getting Started with AWS - Understanding total cost of owner...
AWS Webinar 23 - Getting Started with AWS - Understanding total cost of owner...AWS Webinar 23 - Getting Started with AWS - Understanding total cost of owner...
AWS Webinar 23 - Getting Started with AWS - Understanding total cost of owner...
 
Taking serverless to the edge
Taking serverless to the edgeTaking serverless to the edge
Taking serverless to the edge
 
2016 - Serverless Microservices on AWS with API Gateway and Lambda
2016 - Serverless Microservices on AWS with API Gateway and Lambda2016 - Serverless Microservices on AWS with API Gateway and Lambda
2016 - Serverless Microservices on AWS with API Gateway and Lambda
 
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
 
AWS Serverless with Chalice
AWS Serverless with Chalice AWS Serverless with Chalice
AWS Serverless with Chalice
 
Designing and Implementing a Serverless Media Processing Workflow Using AWS S...
Designing and Implementing a Serverless Media Processing Workflow Using AWS S...Designing and Implementing a Serverless Media Processing Workflow Using AWS S...
Designing and Implementing a Serverless Media Processing Workflow Using AWS S...
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
 
Design and Implement a Serverless Media-Processing Workflow
Design and Implement a Serverless Media-Processing Workflow Design and Implement a Serverless Media-Processing Workflow
Design and Implement a Serverless Media-Processing Workflow
 
Design and Implement a Serverless Media-Processing Workflow - SRV328 - Atlant...
Design and Implement a Serverless Media-Processing Workflow - SRV328 - Atlant...Design and Implement a Serverless Media-Processing Workflow - SRV328 - Atlant...
Design and Implement a Serverless Media-Processing Workflow - SRV328 - Atlant...
 
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
Building Advanced Serverless Workflows with AWS Step Functions | AWS Floor28
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

AWS Lambda Layers in action - MAD313 - New York AWS Summit

  • 1. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T AWS Lambda Layers in action Eric Johnson Senior Developer Advocate, Serverless AWS M A D 3 1 3
  • 2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Who am I? • @edjgeek • Senior developer advocate – Serverless • Serverless/tooling/automation geek • Dad of five • Husband of one • Drummer
  • 3.
  • 4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  • 5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Serverless applications Event source Services Changes in data state Requests to endpoints Changes in resource state Function Node.js Python Java C# Go Ruby Runtime API
  • 6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of an AWS Lambda function Handler() function Function to be executed upon invocation Event object Data sent during Lambda function invocation Context object Methods available to interact with runtime information (request ID, log group, more) import json def lambda_handler(event, context): # TODO implement return { 'statusCode': 200, 'body': json.dumps('Hello World!') }
  • 7. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of an AWS Lambda function Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() } else { result = SubfunctionB() return result; } Function subFunctionA(thing){ ## logic here } Function subFunctionB(thing){ ## logic here }
  • 8. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of an AWS Lambda function Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() } else { result = SubfunctionB() return result; } Function subFunctionA(thing){ ## logic here } Function subFunctionB(thing){ ## logic here } Functions will then grow in complexity with business logic sub-functions
  • 9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of an AWS Lambda function Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionB(thing){ ## logic here } Business logic sub-functions
  • 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionB(thing){ ## logic here } Anatomy of an AWS Lambda function Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of a serverless application /orders /forums /search /lists /user /... Now, assume that I have an API-based workloadAmazon API Gateway
  • 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of a serverless application It needs to read/write to a database and get keys and configuration from external services AWS Secrets Manager/ Parameter Store Amazon DynamoDB
  • 13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of a serverless application Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions /orders /forums /search /lists /user /... Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Amazon API Gateway AWS Secrets Manager/ Parameter Store Amazon DynamoDB
  • 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of a serverless application Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions /orders /forums /search /lists /user /... Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Pre-handler-secret-getter() { } Function Pre-handler-db-connect(){ } Function subFunctionA(thing){ ## logic here } Function subFunctionA(thing){ ## logic here } Dependencies, configuration information, common helper functions Common helper functions Business logic sub-functions Amazon API Gateway AWS Secrets Manager/ Parameter Store Amazon DynamoDB There could be a lot of duplicated code here!
  • 15. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Anatomy of a serverless application /orders /forums /search /lists /user /... Amazon API Gateway Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Import sdk Import http-lib Import ham-sandwich Pre-handler-secret-getter() Pre-handler-db-connect() Function myhandler(event, context) { <Event handling logic> { result = SubfunctionA() }else { result = SubfunctionB() return result; } Function Dependencies, configuration information Common helper functions Business logic sub-functions We want something more like this AWS Secrets Manager/ Parameter Store Amazon DynamoDB
  • 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Lambda layers Let functions easily share code; upload layer once, reference within any function Layer can be anything: Dependencies, training data, configuration files, etc. Promote separation of responsibilities and let developers iterate faster on writing business logic Built-in support for secure sharing by ecosystem
  • 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Using Lambda layers • Put common components in a .zip file and upload it as a Lambda layer • Layers are immutable and can be versioned to manage updates • When a version is deleted or permissions to use it are revoked, functions that used it previously will continue to work, but you won’t be able to create new ones • You can reference up to five layers, one of which can optionally be a custom runtime Lambda layers arn:aws:lambda:region:accountId:layer:shared-lib :1 Lambda layers arn:aws:lambda:region:accountId:layer:shared-lib:2 Lambda layers arn:aws:lambda:region:accountId:layer:shared-lib:3
  • 18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T How Lambda layers work Order is important because each layer is a .zip file, and they are all extracted in the same path • /opt • Each layer can potentially overwrite the previous one This approach can be used to customize the environment For example, the first layer can be a custom runtime, and the second layer can add specific versions of the libraries that you need The storage of your Lambda layers takes part in the Lambda function storage per region limit (75 GB)
  • 19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Including library dependencies in a layer Runtime Folders Node.js nodejs/node_modules nodejs/node8/node_modules (NODE_PATH) Python python python/lib/python3.7/site-packages (site directories) Java java/lib (CLASSPATH) Ruby ruby/gems/2.5.0 (GEM_PATH) ruby/lib (RUBY_LIB) All bin (PATH) lib (LD_LIBRARY_PATH)
  • 20. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T AWS SAM template properties Properties: LayerName: MyLayer Description: Layer description ContentUri: 's3://my-bucket/my-layer.zip' CompatibleRuntimes: - nodejs6.10 - nodejs8.10 LicenseInfo: 'MIT-0 license.' RetentionPolicy: Retain From SAM version 2016-10-31 AWS::Serverless::Function AWS::Serverless::Api AWS::Serverless::SimpleTable AWS::Serverless::LayerVersion AWS::Serverless::Application
  • 21. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  • 22. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T aws.amazon.com/serverless
  • 23. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 24. Thank you! S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Eric Johnson @edjgeek