AWS Lambda - Developer Guide
Developer Guide
AWS Lambda
Copyright ? 2024 Amazon Web Services, Inc. and/or its a?liates. All rights reserved.
AWS Lambda
Developer Guide
AWS Lambda: Developer Guide
Copyright ? 2024 Amazon Web Services, Inc. and/or its a?liates. All rights reserved.
Amazon's trademarks and trade dress may not be used in connection with any product or service
that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any
manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are
the property of their respective owners, who may or may not be a?liated with, connected to, or
sponsored by Amazon.
AWS Lambda
Developer Guide
Table of Contents
What is AWS Lambda? ....................................................................................................................
When to use Lambda ..................................................................................................................................
Key features ...................................................................................................................................................
Create your ?rst function ...............................................................................................................
Prerequisites ..................................................................................................................................................
1
1
2
4
4
Create a Lambda function with the console .......................................................................................... 6
Invoke the Lambda function using the console .................................................................................. 12
Clean up ....................................................................................................................................................... 15
Additional resources and next steps ...................................................................................................... 16
Create your ?rst app ..................................................................................................................... 18
Prerequisites ................................................................................................................................................ 19
Downloading the example app ?les ...................................................................................................... 20
Deploying the app ..................................................................................................................................... 27
Deploy the resources manually .......................................................................................................... 27
Deploy the resources using AWS SAM ............................................................................................. 35
Testing the app ........................................................................................................................................... 37
Testing the app manually ................................................................................................................... 37
Testing the app with the automated script .................................................................................... 39
Next steps .................................................................................................................................................... 40
Key Lambda concepts .................................................................................................................... 42
Function ........................................................................................................................................................ 42
Trigger ........................................................................................................................................................... 42
Event ............................................................................................................................................................. 43
Execution environment ............................................................................................................................. 43
Deployment package ................................................................................................................................. 44
Runtime ........................................................................................................................................................ 44
Layer .............................................................................................................................................................. 44
Concurrency ................................................................................................................................................. 45
Quali?er ........................................................................................................................................................ 45
Destination ................................................................................................................................................... 45
Infrastructure as code (IaC) .......................................................................................................... 47
IaC tools for Lambda ................................................................................................................................. 47
Getting started with IaC for Lambda .................................................................................................... 49
Prerequisites ........................................................................................................................................... 50
iii
AWS Lambda
Developer Guide
Create a Lambda function .................................................................................................................. 50
View the AWS SAM template for your function ............................................................................. 50
Use AWS Application Composer to design a serverless application ........................................... 53
Deploy your serverless application using AWS SAM (optional) ................................................... 58
Testing your deployed application (optional) ................................................................................. 60
Next steps .................................................................................................................................................... 61
Supported regions for Lambda integration with Application Composer ........................................ 62
Programming model ..................................................................................................................... 63
Lambda runtimes ........................................................................................................................... 65
Supported runtimes ................................................................................................................................... 65
New runtime releases ................................................................................................................................ 68
Runtime deprecation policy ..................................................................................................................... 68
Shared responsibility model .................................................................................................................... 69
Runtime use after deprecation ............................................................................................................... 71
Receiving runtime deprecation noti?cations ........................................................................................ 72
Deprecated runtimes ................................................................................................................................. 73
Runtime version updates .......................................................................................................................... 76
Choosing a runtime update mode .................................................................................................... 77
Two-phase runtime version rollout ................................................................................................... 78
Rolling back a runtime version .......................................................................................................... 78
Identifying runtime version changes ................................................................................................ 80
Con?guring runtime management settings .................................................................................... 82
Understanding the shared responsibility model ............................................................................ 83
Controlling runtime update permissions for high-compliance applications ............................. 85
Get data about functions by runtime .................................................................................................... 86
Listing function versions that use a particular runtime ................................................................ 86
Identifying most commonly and most recently invoked functions ............................................ 88
Runtime modi?cations .............................................................................................................................. 93
Language-speci?c environment variables ........................................................................................ 93
Wrapper scripts ..................................................................................................................................... 93
Runtime API ................................................................................................................................................. 97
Next invocation ..................................................................................................................................... 97
Invocation response .............................................................................................................................. 99
Initialization error ................................................................................................................................. 99
Invocation error ................................................................................................................................... 101
OS-only runtimes ..................................................................................................................................... 103
iv
AWS Lambda
Developer Guide
Building a custom runtime ............................................................................................................... 104
Custom runtime tutorial ................................................................................................................... 107
Execution environment ............................................................................................................... 116
Runtime environment lifecycle ............................................................................................................. 117
Init phase .............................................................................................................................................. 117
Failures during the Init phase .......................................................................................................... 118
Restore phase (Lambda SnapStart only) ....................................................................................... 119
Invoke phase ........................................................................................................................................ 119
Failures during the invoke phase .................................................................................................... 120
Shutdown phase ................................................................................................................................. 122
Implementing statelessness ................................................................................................................... 123
Con?guring functions ................................................................................................................. 125
.zip ?le archives ........................................................................................................................................ 127
Creating the function ........................................................................................................................ 127
Using the console code editor ......................................................................................................... 129
Updating function code .................................................................................................................... 129
Changing the runtime ....................................................................................................................... 130
Changing the architecture ................................................................................................................ 130
Using the Lambda API ....................................................................................................................... 131
AWS CloudFormation ......................................................................................................................... 131
Container images ..................................................................................................................................... 133
Requirements ....................................................................................................................................... 134
Using an AWS base image ................................................................................................................ 135
Using an AWS OS-only base image ................................................................................................ 136
Using a non-AWS base image ......................................................................................................... 136
Runtime interface clients .................................................................................................................. 137
Amazon ECR permissions .................................................................................................................. 137
Function lifecycle ................................................................................................................................ 140
Memory ...................................................................................................................................................... 141
When to increase memory ............................................................................................................... 141
Using the console ............................................................................................................................... 142
Using the AWS CLI ............................................................................................................................. 142
Using AWS SAM .................................................................................................................................. 142
Accepting function memory recommendations (console) .......................................................... 143
Ephemeral storage ................................................................................................................................... 144
Use cases .............................................................................................................................................. 144
v
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- salesforce platform developer 2 certificati
- salesforce lightning developer guide
- aws python lambda function examples
- aws lambda python event object
- aws lambda pip install
- aws lambda package python
- microsoft visual web developer express
- business developer job description
- aws lambda doc
- developer tools microsoft word
- salesforce developer edition
- salesforce developer edition org