id
stringlengths
14
16
text
stringlengths
1
2.43k
source
stringlengths
99
229
beea1b46a4a1-0
Use the *tab buttons bar* to select, view, and create files\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-tab-buttons-bar.png) **To display an open file's contents**, do one of the following: + Choose the file's tab\. + Choose the drop\-down menu button in the tab buttons bar, and then choose the file's name\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-drop-down-list.png) **To close an open file**, do one of the following: + Choose the **X** icon in the file's tab\. + Choose the file's tab\. Then choose the drop\-down menu button in the tab buttons bar, and choose **Close Pane**\. **To close multiple open files**, choose the drop\-down menu in the tab buttons bar, and then choose **Close All Tabs in All Panes** or **Close All But Current Tab** as needed\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/code-editor.md
beea1b46a4a1-1
**To create a new file**, choose the **\+** button in the tab buttons bar, and then choose **New File**\. When you're ready to save the file, choose **File, Save** or **File, Save As** on the menu bar\. Then use the **Save As** dialog box that displays to name the file and choose where to save it\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/code-editor.md
f4b0a7c80392-0
Use the status bar to move quickly to a line in the active file and to change how code is displayed\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-status-bar.png) **To move quickly to a line in the active file**, choose the line selector, type the line number to go to, and then press Enter \. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-line-selector.png) **To change the code color scheme in the active file**, choose the code color scheme selector, and then choose the new code color scheme\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-code-color.png) **To change in the active file whether soft tabs or spaces are used, the tab size, or whether to convert to spaces or tabs**, choose the spaces and tabs selector, and then choose the new settings\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-spaces-tabs.png)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/code-editor.md
f4b0a7c80392-1
**To change for all files whether to show or hide invisible characters or the gutter, auto\-pair brackets or quotes, wrap lines, or the font size**, choose the gear icon, and then choose the new settings\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-status-bar-settings.png)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/code-editor.md
448cbaebe44f-0
You can expand the code editor to get more room to work with your code\. To expand the code editor to the edges of the web browser window, choose the **Toggle fullscreen** button in the menu bar\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-menu-bar-fullscreen.png) To shrink the code editor to its original size, choose the **Toggle fullscreen** button again\. In fullscreen mode, additional options are displayed on the menu bar: **Save** and **Test**\. Choosing **Save** saves the function code\. Choosing **Test** or **Configure Events** enables you to create or edit the function's test events\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/code-editor.md
cc902b3c07d0-0
You can change various code editor settings such as which coding hints and warnings are displayed, code folding behaviors, code autocompletion behaviors, and much more\. To change code editor settings, choose the **Preferences** gear icon in the menu bar\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/code-editor/code-editor-menu-bar-preferences.png) For a list of what the settings do, see the following references in the *AWS Cloud9 User Guide*\. + [Project setting changes you can make](https://docs.aws.amazon.com/cloud9/latest/user-guide/settings-project.html#settings-project-change) + [User setting changes you can make](https://docs.aws.amazon.com/cloud9/latest/user-guide/settings-user.html#settings-user-change) Note that some of the settings listed in those references are not available in the code editor\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/code-editor.md
d55d6f6e4a36-0
When you update your function, Lambda deploys the change by launching new instances of the function with the updated code or settings\. Deployment errors prevent the new version from being used and can arise from issues with your deployment package, code, permissions, or tools\. When you deploy updates to your function directly with the Lambda API or with a client such as the AWS CLI, you can see errors from Lambda directly in the output\. If you use services like AWS CloudFormation, AWS CodeDeploy, or AWS CodePipeline, look for the response from Lambda in the logs or event stream for that service\. **Error:** *EACCES: permission denied, open '/var/task/index\.js'* **Error:** *cannot load such file \-\- function* **Error:** *\[Errno 13\] Permission denied: '/var/task/function\.py'* The Lambda runtime needs permission to read the files in your deployment package\. You can use the `chmod` command to change the file mode\. The following example commands make all files and folders in the current directory readable by any user\. ``` my-function$ chmod 644 $(find . -type f) my-function$ chmod 755 $(find . -type d) ``` **Error:** *An error occurred \(RequestEntityTooLargeException\) when calling the UpdateFunctionCode operation*
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/troubleshooting-deployment.md
d55d6f6e4a36-1
``` **Error:** *An error occurred \(RequestEntityTooLargeException\) when calling the UpdateFunctionCode operation* When you upload a deployment package or layer archive directly to Lambda, the size of the ZIP file is limited to 50 MB\. To upload a larger file, store it in Amazon S3 and use the [S3Bucket and S3Key](API_UpdateFunctionCode.md#SSS-UpdateFunctionCode-request-S3Bucket) parameters\. **Note** When you upload a file directly with the AWS CLI, AWS SDK, or otherwise, the binary ZIP file is converted to base64, which increases its size by about 30%\. To allow for this, and the size of other parameters in the request, the actual request size limit that Lambda applies is larger\. Due to this, the 50 MB limit is approximate\. **Error:** *Error occurred while GetObject\. S3 Error Code: PermanentRedirect\. S3 Error Message: The bucket is in this region: us\-east\-2\. Please use this region to retry the request* When you upload a function's deployment package from an Amazon S3 bucket, the bucket must be in the same Region as the function\. This issue can occur when you specify an Amazon S3 object in a call to [UpdateFunctionCode](API_UpdateFunctionCode.md), or use the package and deploy commands in the AWS CLI or AWS SAM CLI\. Create a deployment artifact bucket for each Region where you develop applications\. **Error:** *Cannot find module 'function'*
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/troubleshooting-deployment.md
d55d6f6e4a36-2
**Error:** *Cannot find module 'function'* **Error:** *cannot load such file \-\- function* **Error:** *Unable to import module 'function'* **Error:** *Class not found: function\.Handler* **Error:** *fork/exec /var/task/function: no such file or directory* **Error:** *Unable to load type 'Function\.Handler' from assembly 'Function'\.* The name of the file or class in your function's handler configuration doesn't match your code\. See the following entry for more information\. **Error:** *index\.handler is undefined or not exported* **Error:** *Handler 'handler' missing on module 'function'* **Error:** *undefined method `handler' for \#<LambdaHandler:0x000055b76ccebf98>* **Error:** *No public method named handleRequest with appropriate method signature found on class function\.Handler* **Error:** *Unable to find method 'handleRequest' in type 'Function\.Handler' from assembly 'Function'* The name of the handler method in your function's handler configuration doesn't match your code\. Each runtime defines a naming convention for handlers, such as *filename*\.*methodname*\. The handler is the method in your function's code that the runtime executes when your function is invoked\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/troubleshooting-deployment.md
d55d6f6e4a36-3
For some languages, Lambda provides a library with an interface that expects a handler method to have a specific name\. For details about handler naming for each language, see the following topics\. + [Building Lambda functions with Node\.js](lambda-nodejs.md) + [Building Lambda functions with Python](lambda-python.md) + [Building Lambda functions with Ruby](lambda-ruby.md) + [Building Lambda functions with Java](lambda-java.md) + [Building Lambda functions with Go](lambda-golang.md) + [Building Lambda functions with C\#](lambda-csharp.md) + [Building Lambda functions with PowerShell](lambda-powershell.md) **Error:** *InvalidParameterValueException: Lambda was unable to configure your environment variables because the environment variables you have provided exceeded the 4KB limit\. String measured: \{"A1":"uSFeY5cyPiPn7AtnX5BsM\.\.\.* **Error:** *RequestEntityTooLargeException: Request must be smaller than 5120 bytes for the UpdateFunctionConfiguration operation* The maximum size of the variables object that is stored in the function's configuration must not exceed 4096 bytes\. This includes key names, values, quotes, commas, and brackets\. The total size of the HTTP request body is also limited\. ``` { "FunctionName": "my-function",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/troubleshooting-deployment.md
d55d6f6e4a36-4
``` { "FunctionName": "my-function", "FunctionArn": "arn:aws:lambda:us-east-2:123456789012:function:my-function", "Runtime": "nodejs12.x", "Role": "arn:aws:iam::123456789012:role/lambda-role", "Environment": { "Variables": { "BUCKET": "my-bucket", "KEY": "file.txt" } }, ... } ``` In this example, the object is 39 characters and takes up 39 bytes when it's stored \(without white space\) as the string `{"BUCKET":"my-bucket","KEY":"file.txt"}`\. Standard ASCII characters in environment variable values use one byte each\. Extended ASCII and Unicode characters can use between 2 bytes and 4 bytes per character\. **Error:** *InvalidParameterValueException: Lambda was unable to configure your environment variables because the environment variables you have provided contains reserved keys that are currently not supported for modification\.*
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/troubleshooting-deployment.md
d55d6f6e4a36-5
Lambda reserves some environment variable keys for internal use\. For example, `AWS_REGION` is used by the runtime to determine the current Region and cannot be overridden\. Other variables, like `PATH`, are used by the runtime but can be extended in your function configuration\. For a full list, see [Runtime environment variables](configuration-envvars.md#configuration-envvars-runtime)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/troubleshooting-deployment.md
6059f6a50ca6-0
With AWS Lambda, you run functions to process events\. You can send events to your function by invoking it with the Lambda API, or by configuring an AWS service or resource to invoke it\. **Topics** + [Function](#gettingstarted-concepts-function) + [Qualifier](#gettingstarted-concepts-qualifier) + [Runtime](#gettingstarted-concepts-runtimes) + [Event](#gettingstarted-concepts-event) + [Concurrency](#gettingstarted-concepts-concurrency) + [Trigger](#gettingstarted-concepts-trigger)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-concepts.md
b207f255caaa-0
A function is a resource that you can invoke to run your code in AWS Lambda\. A function has code that processes events, and a runtime that passes requests and responses between Lambda and the function code\. You provide the code, and you can use the provided runtimes or create your own\. For more information, see [Managing AWS Lambda functions](lambda-functions.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-concepts.md
d22d6e123c68-0
When you invoke or view a function, you can include a qualifier to specify a version or alias\. A version is an immutable snapshot of a function's code and configuration that has a numerical qualifier\. For example, `my-function:1`\. An alias is a pointer to a version that can be updated to map to a different version, or split traffic between two versions\. For example, `my-function:BLUE`\. You can use versions and aliases together to provide a stable interface for clients to invoke your function\. For more information, see [Lambda function versions](configuration-versions.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-concepts.md
cb163918b291-0
Lambda runtimes allow functions in different languages to run in the same base execution environment\. You configure your function to use a runtime that matches your programming language\. The runtime sits in between the Lambda service and your function code, relaying invocation events, context information, and responses between the two\. You can use runtimes provided by Lambda, or build your own\. For more information, see [AWS Lambda runtimes](lambda-runtimes.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-concepts.md
539b2f4d1d29-0
An event is a JSON formatted document that contains data for a function to process\. The Lambda runtime converts the event to an object and passes it to your function code\. When you invoke a function, you determine the structure and contents of the event\. **Example custom event – Weather data** ``` { "TemperatureK": 281, "WindKmh": -3, "HumidityPct": 0.55, "PressureHPa": 1020 } ``` When an AWS service invokes your function, the service defines the shape of the event\. **Example service event – Amazon SNS notification** ``` { "Records": [ { "Sns": { "Timestamp": "2019-01-02T12:45:07.000Z", "Signature": "tcc6faL2yUC6dgZdmrwh1Y4cGa/ebXEkAi6RibDsvpi+tE/1+82j...65r==", "MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", "Message": "Hello from SNS!", ... ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-concepts.md
539b2f4d1d29-1
"Message": "Hello from SNS!", ... ``` For details on events from AWS services, see [Using AWS Lambda with other services](lambda-services.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-concepts.md
1e9d81c455ee-0
Concurrency is the number of requests that your function is serving at any given time\. When your function is invoked, Lambda provisions an instance of it to process the event\. When the function code finishes running, it can handle another request\. If the function is invoked again while a request is still being processed, another instance is provisioned, increasing the function's concurrency\. Concurrency is subject to quotas at the region level\. You can also configure individual functions to limit their concurrency, or to ensure that they can reach a specific level of concurrency\. For more information, see [Managing concurrency for a Lambda function](configuration-concurrency.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-concepts.md
5f08d970bfb6-0
A trigger is a resource or configuration that invokes a Lambda function\. This includes AWS services that can be configured to invoke a function, applications that you develop, and event source mappings\. An event source mapping is a resource in Lambda that reads items from a stream or queue and invokes a function\. For more information, see [Invoking AWS Lambda functions](lambda-invocation.md) and [Using AWS Lambda with other services](lambda-services.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-concepts.md
d46402371c52-0
The GitHub repository for this guide provides sample applications that demonstrate the use of Java in AWS Lambda\. Each sample application includes scripts for easy deployment and cleanup, an AWS CloudFormation template, and supporting resources\. **Sample Lambda applications in Java** + [blank\-java](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-java) – A Java function that shows the use of Lambda's Java libraries, logging, environment variables, layers, AWS X\-Ray tracing, unit tests, and the AWS SDK\. + [java\-basic](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/java-basic) – A minimal Java function with unit tests and variable logging configuration\. + [java\-events](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/java-events) – A minimal Java function that uses the [aws\-lambda\-java\-events](java-package.md) library with event types that don't require the AWS SDK as a dependency, such as Amazon API Gateway\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-samples.md
d46402371c52-1
+ [java\-events\-v1sdk](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/java-events-v1sdk) – A Java function that uses the [aws\-lambda\-java\-events](java-package.md) library with event types that require the AWS SDK as a dependency \(Amazon Simple Storage Service, Amazon DynamoDB, and Amazon Kinesis\)\. + [s3\-java](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/s3-java) – A Java function that processes notification events from Amazon S3 and uses the Java Class Library \(JCL\) to create thumbnails from uploaded image files\. Use the `blank-java` sample app to learn the basics, or as a starting point for your own application\. It shows the use of Lambda's Java libraries, environment variables, the AWS SDK, and the AWS X\-Ray SDK\. It uses a Lambda layer to package its dependencies separately from the function code, which speeds up deployment times when you are iterating on your function code\. The project requires minimal setup and can be deployed from the command line in less than a minute\. [https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-java](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-java)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-samples.md
d46402371c52-2
The other sample applications show other build configurations, handler interfaces, and use cases for services that integrate with Lambda\. The `java-basic` sample shows a function with minimal dependencies\. You can use this sample for cases where you don't need additional libraries like the AWS SDK, and can represent your function's input and output with standard Java types\. To try a different handler type, you can simply change the handler setting on the function\. **Example [java\-basic/src/main/java/example/HandlerStream\.java](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/java-basic/src/main/java/example/HandlerStream.java) – Stream handler** ``` // Handler value: example.HandlerStream public class HandlerStream implements RequestStreamHandler { Gson gson = new GsonBuilder().setPrettyPrinting().create(); @Override public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException { LambdaLogger logger = context.getLogger(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("US-ASCII"))); PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream, Charset.forName("US-ASCII")))); try {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-samples.md
d46402371c52-3
try { HashMap event = gson.fromJson(reader, HashMap.class); logger.log("STREAM TYPE: " + inputStream.getClass().toString()); logger.log("EVENT TYPE: " + event.getClass().toString()); writer.write(gson.toJson(event)); ... ``` The `java-events` and `java-events-v1sdk` samples show the use of the event types provided by the `aws-lambda-java-events` library\. These types represent the event documents that [AWS services](lambda-services.md) send to your function\. `java-events` includes handlers for types that don't require additional dependencies\. For event types like `DynamodbEvent` that require types from the AWS SDK for Java, `java-events-v1sdk` includes the SDK in its build configuration\. **Example [java\-events\-v1sdk/src/main/java/example/HandlerDynamoDB\.java](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/java-events-v1sdk/src/main/java/example/HandlerDynamoDB.java) – DynamoDB records** ``` import com.amazonaws.services.lambda.runtime.events.DynamodbEvent;
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-samples.md
d46402371c52-4
``` import com.amazonaws.services.lambda.runtime.events.DynamodbEvent; import com.amazonaws.services.lambda.runtime.events.DynamodbEvent.DynamodbStreamRecord; import com.amazonaws.services.dynamodbv2.model.Record; ... // Handler value: example.HandlerDynamoDB public class HandlerDynamoDB implements RequestHandler<DynamodbEvent, String>{ private static final Logger logger = LoggerFactory.getLogger(HandlerDynamoDB.class); Gson gson = new GsonBuilder().setPrettyPrinting().create(); @Override public String handleRequest(DynamodbEvent event, Context context) { String response = new String("200 OK"); for (DynamodbStreamRecord record : event.getRecords()){ logger.info(record.getEventID()); logger.info(record.getEventName()); logger.info(record.getDynamodb().toString()); } ... ``` For more highlights, see the other topics in this chapter\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-samples.md
87195dde56d2-0
A Lambda function written in [Go](https://golang.org/) is authored as a Go executable\. In your Lambda function code, you need to include the [github\.com/aws/aws\-lambda\-go/lambda](https://github.com/aws/aws-lambda-go/tree/master/lambda) package, which implements the Lambda programming model for Go\. In addition, you need to implement handler function code and a `main()` function\. ``` package main import ( "fmt" "context" "github.com/aws/aws-lambda-go/lambda" ) type MyEvent struct { Name string `json:"name"` } func HandleRequest(ctx context.Context, name MyEvent) (string, error) { return fmt.Sprintf("Hello %s!", name.Name ), nil } func main() { lambda.Start(HandleRequest) } ``` Note the following: + **package main**: In Go, the package containing `func main()` must always be named `main`\. + **import**: Use this to include the libraries your Lambda function requires\. In this instance, it includes:
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
87195dde56d2-1
+ **import**: Use this to include the libraries your Lambda function requires\. In this instance, it includes: + **context: **[AWS Lambda context object in Go](golang-context.md)\. + **fmt:** The Go [Formatting](https://golang.org/pkg/fmt/) object used to format the return value of your function\. + **github\.com/aws/aws\-lambda\-go/lambda:** As mentioned previously, implements the Lambda programming model for Go\. + **func HandleRequest\(ctx context\.Context, name MyEvent\) \(string, error\)**: This is your Lambda handler signature and includes the code which will be executed\. In addition, the parameters included denote the following: + **ctx context\.Context**: Provides runtime information for your Lambda function invocation\. `ctx` is the variable you declare to leverage the information available via [AWS Lambda context object in Go](golang-context.md)\. + **name MyEvent**: An input type with a variable name of `name` whose value will be returned in the `return` statement\. + **string, error**: Returns two values: string for success and standard [error](https://golang.org/pkg/builtin/#error) information\. For more information on custom error handling, see [AWS Lambda function errors in Go](golang-exceptions.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
87195dde56d2-2
+ **return fmt\.Sprintf\("Hello %s\!", name\), nil**: Simply returns a formatted "Hello" greeting with the name you supplied in the input event\. `nil` indicates there were no errors and the function executed successfully\. + **func main\(\)**: The entry point that executes your Lambda function code\. This is required\. By adding `lambda.Start(HandleRequest)` between `func main(){}` code brackets, your Lambda function will be executed\. Per Go language standards, the opening bracket, `{` must be placed directly at end the of the `main` function signature\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
9ae337deedcd-0
In the example above, the input type was a simple string\. But you can also pass in structured events to your function handler: ``` package main import ( "fmt" "github.com/aws/aws-lambda-go/lambda" ) type MyEvent struct { Name string `json:"What is your name?"` Age int `json:"How old are you?"` } type MyResponse struct { Message string `json:"Answer:"` } func HandleLambdaEvent(event MyEvent) (MyResponse, error) { return MyResponse{Message: fmt.Sprintf("%s is %d years old!", event.Name, event.Age)}, nil } func main() { lambda.Start(HandleLambdaEvent) } ``` Your request would then look like this: ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
40583a4bda90-0
{ "What is your name?": "Jim", "How old are you?": 33 } ``` And the response would look like this: ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
b93e9a80d47f-0
{ "Answer": "Jim is 33 years old!" } ``` To be exported, field names in the event struct must be capitalized\. For more information on handling events from AWS event sources, see [aws\-lambda\-go/events](https://github.com/aws/aws-lambda-go/tree/master/events)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
e5878ce2df8c-0
You have several options when building a Lambda function handler in Go, but you must adhere to the following rules: + The handler must be a function\. + The handler may take between 0 and 2 arguments\. If there are two arguments, the first argument must implement `context.Context`\. + The handler may return between 0 and 2 arguments\. If there is a single return value, it must implement `error`\. If there are two return values, the second value must implement `error`\. For more information on implementing error\-handling information, see [AWS Lambda function errors in Go](golang-exceptions.md)\. The following lists valid handler signatures\. `TIn` and `TOut` represent types compatible with the *encoding/json* standard library\. For more information, see [func Unmarshal](https://golang.org/pkg/encoding/json/#Unmarshal) to learn how these types are deserialized\. + ``` func () ``` + ``` func () error ``` + ``` func (TIn), error ``` + ``` func () (TOut, error) ``` + ``` func (context.Context) error ``` + ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
e5878ce2df8c-1
``` func (context.Context) error ``` + ``` func (context.Context, TIn) error ``` + ``` func (context.Context) (TOut, error) ``` + ``` func (context.Context, TIn) (TOut, error) ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
0c36b987efbb-0
You can declare and modify global variables that are independent of your Lambda function's handler code\. In addition, your handler may declare an `init` function that is executed when your handler is loaded\. This behaves the same in AWS Lambda as it does in standard Go programs\. A single instance of your Lambda function will never handle multiple events simultaneously\. ``` package main import ( "log" "github.com/aws/aws-lambda-go/lambda" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/aws" ) var invokeCount = 0 var myObjects []*s3.Object func init() { svc := s3.New(session.New()) input := &s3.ListObjectsV2Input{ Bucket: aws.String("examplebucket"), } result, _ := svc.ListObjectsV2(input) myObjects = result.Contents } func LambdaHandler() (int, error) { invokeCount = invokeCount + 1 log.Print(myObjects)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
0c36b987efbb-1
invokeCount = invokeCount + 1 log.Print(myObjects) return invokeCount, nil } func main() { lambda.Start(LambdaHandler) } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/golang-handler.md
ec1f26d1bf7e-0
Returns information about a version of an [AWS Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html), with a link to download the layer archive that's valid for 10 minutes\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
9247ac44aac7-0
``` GET /2018-10-31/layers?find=LayerVersion&Arn=Arn HTTP/1.1 ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
7141554f4aab-0
The request uses the following URI parameters\. ** [Arn](#API_GetLayerVersionByArn_RequestSyntax) ** <a name="SSS-GetLayerVersionByArn-request-Arn"></a> The ARN of the layer version\. Length Constraints: Minimum length of 1\. Maximum length of 140\. Pattern: `arn:[a-zA-Z0-9-]+:lambda:[a-zA-Z0-9-]+:\d{12}:layer:[a-zA-Z0-9-_]+:[0-9]+` Required: Yes
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
09a042945481-0
The request does not have a request body\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
14b1ce8980c6-0
``` HTTP/1.1 200 Content-type: application/json { "CompatibleRuntimes": [ "string" ], "Content": { "CodeSha256": "string", "CodeSize": number, "Location": "string" }, "CreatedDate": "string", "Description": "string", "LayerArn": "string", "LayerVersionArn": "string", "LicenseInfo": "string", "Version": number } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
7bbc3b69e925-0
If the action is successful, the service sends back an HTTP 200 response\. The following data is returned in JSON format by the service\. ** [CompatibleRuntimes](#API_GetLayerVersionByArn_ResponseSyntax) ** <a name="SSS-GetLayerVersionByArn-response-CompatibleRuntimes"></a> The layer's compatible runtimes\. Type: Array of strings Array Members: Maximum number of 5 items\. Valid Values:` nodejs10.x | nodejs12.x | java8 | java8.al2 | java11 | python2.7 | python3.6 | python3.7 | python3.8 | dotnetcore2.1 | dotnetcore3.1 | go1.x | ruby2.5 | ruby2.7 | provided | provided.al2` ** [Content](#API_GetLayerVersionByArn_ResponseSyntax) ** <a name="SSS-GetLayerVersionByArn-response-Content"></a> Details about the layer version\. Type: [LayerVersionContentOutput](API_LayerVersionContentOutput.md) object ** [CreatedDate](#API_GetLayerVersionByArn_ResponseSyntax) ** <a name="SSS-GetLayerVersionByArn-response-CreatedDate"></a>
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
7bbc3b69e925-1
The date that the layer version was created, in [ISO\-8601 format](https://www.w3.org/TR/NOTE-datetime) \(YYYY\-MM\-DDThh:mm:ss\.sTZD\)\. Type: String ** [Description](#API_GetLayerVersionByArn_ResponseSyntax) ** <a name="SSS-GetLayerVersionByArn-response-Description"></a> The description of the version\. Type: String Length Constraints: Minimum length of 0\. Maximum length of 256\. ** [LayerArn](#API_GetLayerVersionByArn_ResponseSyntax) ** <a name="SSS-GetLayerVersionByArn-response-LayerArn"></a> The ARN of the layer\. Type: String Length Constraints: Minimum length of 1\. Maximum length of 140\. Pattern: `arn:[a-zA-Z0-9-]+:lambda:[a-zA-Z0-9-]+:\d{12}:layer:[a-zA-Z0-9-_]+` ** [LayerVersionArn](#API_GetLayerVersionByArn_ResponseSyntax) ** <a name="SSS-GetLayerVersionByArn-response-LayerVersionArn"></a> The ARN of the layer version\. Type: String
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
7bbc3b69e925-2
The ARN of the layer version\. Type: String Length Constraints: Minimum length of 1\. Maximum length of 140\. Pattern: `arn:[a-zA-Z0-9-]+:lambda:[a-zA-Z0-9-]+:\d{12}:layer:[a-zA-Z0-9-_]+:[0-9]+` ** [LicenseInfo](#API_GetLayerVersionByArn_ResponseSyntax) ** <a name="SSS-GetLayerVersionByArn-response-LicenseInfo"></a> The layer's software license\. Type: String Length Constraints: Maximum length of 512\. ** [Version](#API_GetLayerVersionByArn_ResponseSyntax) ** <a name="SSS-GetLayerVersionByArn-response-Version"></a> The version number\. Type: Long
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
bd80f285f1d1-0
**InvalidParameterValueException** One of the parameters in the request is invalid\. HTTP Status Code: 400 **ResourceNotFoundException** The resource specified in the request does not exist\. HTTP Status Code: 404 **ServiceException** The AWS Lambda service encountered an internal error\. HTTP Status Code: 500 **TooManyRequestsException** The request throughput limit was exceeded\. HTTP Status Code: 429
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
be786da8408a-0
For more information about using this API in one of the language\-specific AWS SDKs, see the following: + [AWS Command Line Interface](https://docs.aws.amazon.com/goto/aws-cli/lambda-2015-03-31/GetLayerVersionByArn) + [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/GetLayerVersionByArn) + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/GetLayerVersionByArn) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/GetLayerVersionByArn) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/GetLayerVersionByArn) + [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/GetLayerVersionByArn)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
be786da8408a-1
+ [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/GetLayerVersionByArn) + [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/GetLayerVersionByArn) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/GetLayerVersionByArn)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetLayerVersionByArn.md
b9c0cc3a23d9-0
You can use Lambda functions to build services that give new skills to Alexa, the Voice assistant on Amazon Echo\. The Alexa Skills Kit provides the APIs, tools, and documentation to create these new skills, powered by your own services running as Lambda functions\. Amazon Echo users can access these new skills by asking Alexa questions or making requests\. The Alexa Skills Kit is available on GitHub\. + [Alexa Skills Kit SDK for Node\.js ](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs) + [Alexa Skills Kit SDK for Java](https://github.com/alexa/alexa-skills-kit-sdk-for-java) **Example Alexa smart home event** ``` { "header": { "payloadVersion": "1", "namespace": "Control", "name": "SwitchOnOffRequest" }, "payload": { "switchControlAction": "TURN_ON", "appliance": { "additionalApplianceDetails": { "key2": "value2", "key1": "value1" }, "applianceId": "sampleId" }, "accessToken": "sampleAccessToken" } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-alexa.md
b9c0cc3a23d9-1
}, "accessToken": "sampleAccessToken" } } ``` For more information, see [ Host a custom skill as an AWS Lambda Function](https://developer.amazon.com/docs/alexa/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html) in the *Build Skills with the Alexa Skills Kit* guide\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-alexa.md
da3ab0db0716-0
You can use the Lambda console to create an Amazon RDS Proxy database proxy for your function\. A database proxy manages a pool of database connections and relays queries from a function\. This enables a function to reach high [concurrency](gettingstarted-concepts.md#gettingstarted-concepts-concurrency) levels without exhausting database connections\. **To create a database proxy** 1. Open the Lambda console [Functions page](https://console.aws.amazon.com/lambda/home#/functions)\. 1. Choose a function\. 1. Choose **Add database proxy**\. 1. Configure the following options\. + **Proxy identifier** – The name of the proxy\. + **RDS DB instance** – A [supported MySQL or PostgreSQL](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html#rds-proxy.limitations) DB instance or cluster\. + **Secret** – A Secrets Manager secret with the database user name and password\. **Example secret** ``` { "username": "admin", "password": "e2abcecxmpldc897" } ``` + **IAM role** – An IAM role with permission to use the secret, and a trust policy that allows Amazon RDS to assume the role\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/configuration-database.md
da3ab0db0716-1
+ **IAM role** – An IAM role with permission to use the secret, and a trust policy that allows Amazon RDS to assume the role\. + **Authentication** – The authentication and authorization method for connecting to the proxy from your function code\. 1. Choose **Add**\. **Pricing** Amazon RDS charges a hourly price for proxies that that is determined by the instance size of your database\. For details, see [RDS Proxy pricing](https://aws.amazon.com/rds/proxy/pricing/)\. Proxy creation takes a few minutes\. When the proxy is available, configure your function to connect to the proxy endpoint instead of the database endpoint\. Standard [Amazon RDS Proxy pricing](https://aws.amazon.com/rds/proxy/pricing/) applies\. For more information, see [Managing connections with the Amazon RDS Proxy](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/rds-proxy.html) in the Amazon Aurora User Guide\. **Topics** + [Using the function's permissions for authentication](#configuration-database-auth) + [Sample application](#configuration-database-sample)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/configuration-database.md
02ff22badfa4-0
By default, you can connect to a proxy with the same username and password that it uses to connect to the database\. The only difference in your function code is the endpoint that the database client connects to\. The drawback of this method is that you must expose the password to your function code, either by configuring it in a secure environment variable or by retrieving it from Secrets Manager\. You can create a database proxy that uses the function's IAM credentials for authentication and authorization instead of a password\. To use the function's permissions to connect to the proxy, set **Authentication** to **Execution role**\. The Lambda console adds the required permission \(`rds-db:connect`\) to the execution role\. You can then use the AWS SDK to generate a token that allows it to connect to the proxy\. The following example shows how to configure a database connection with the `mysql2` library in Node\.js\. **Example [dbadmin/index\-iam\.js](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/rds-mysql/dbadmin/index-iam.js) – AWS SDK signer** ``` const signer = new AWS.RDS.Signer({ region: region, hostname: host, port: sqlport, username: username }) exports.handler = async (event) => {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/configuration-database.md
02ff22badfa4-1
port: sqlport, username: username }) exports.handler = async (event) => { let connectionConfig = { host : host, user : username, database : database, ssl: 'Amazon RDS', authPlugins: { mysql_clear_password: () => () => signer.getAuthToken() } } var connection = mysql.createConnection(connectionConfig) var query = event.query var result connection.connect() ``` For more information, see [IAM database authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) in the Amazon RDS User Guide\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/configuration-database.md
546ba20cc656-0
Sample applications that demonstrate the use of Lambda with an Amazon RDS database are available in this guide's GitHub repository\. There are two applications: + [RDS MySQL](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/rds-mysql) – The AWS CloudFormation template `template-vpcrds.yml` creates a MySQL 5\.7 database in a private VPC\. In the sample application, a Lambda function proxies queries to the database\. The function and database templates both use Secrets Manager to access database credentials\. [ ![\[The dbadmin function relays queries to a database.\]](http://docs.aws.amazon.com/lambda/latest/dg/images/sample-rdsmysql.png)](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/rds-mysql) + [List Manager](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/list-manager) – A processor function reads events from a Kinesis stream\. It uses the data from the events to update DynamoDB tables, and stores a copy of the event in a MySQL database\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/configuration-database.md
546ba20cc656-1
[ ![\[The processor function processes Kinesis events and stores the events in a MySQL database.\]](http://docs.aws.amazon.com/lambda/latest/dg/images/sample-listmanager.png)](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/list-manager) To use the sample applications, follow the instructions in the GitHub repository: [RDS MySQL](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/rds-mysql/README.md), [List Manager](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/list-manager/README.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/configuration-database.md
8e6bc471b90c-0
When you create a Lambda function, you specify a handler that AWS Lambda can invoke when the service executes the function on your behalf\. You define a Lambda function handler as an instance or static method in a class\. If you want access to the Lambda context object, it is available by defining a method parameter of type *ILambdaContext*, an interface you can use to access information about the current execution, such as the name of the current function, the memory limit, execution time remaining, and logging\. ``` returnType handler-name(inputType input, ILambdaContext context) { ... } ``` In the syntax, note the following: + *inputType* – The first handler parameter is the input to the handler, which can be event data \(published by an event source\) or custom input that you provide such as a string or any custom data object\. + *returnType* – If you plan to invoke the Lambda function synchronously \(using the `RequestResponse` invocation type\), you can return the output of your function using any of the supported data types\. For example, if you use a Lambda function as a mobile application backend, you are invoking it synchronously\. Your output data type will be serialized into JSON\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
8e6bc471b90c-1
If you plan to invoke the Lambda function asynchronously \(using the `Event` invocation type\), the `returnType` should be `void`\. For example, if you use AWS Lambda with event sources such as Amazon S3 or Amazon SNS, these event sources invoke the Lambda function using the `Event` invocation type\. + `ILambdaContext context` – The second argument in the handler signature is optional\. It provides access to the [context object](csharp-context.md) which has information about the function and request\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
d63ffedd1b87-0
Only the `System.IO.Stream` type is supported as an input parameter by default\. For example, consider the following C\# example code\. ``` using System.IO; namespace Example { public class Hello { public Stream MyHandler(Stream stream) { //function logic } } } ``` In the example C\# code, the first handler parameter is the input to the handler \(MyHandler\), which can be event data \(published by an event source such as Amazon S3\) or custom input you provide such as a `Stream` \(as in this example\) or any custom data object\. The output is of type `Stream`\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
db1f13e3cf53-0
All other types, as listed below, require you to specify a serializer\. + Primitive \.NET types \(such as string or int\)\. + Collections and maps \- IList, IEnumerable, IList<T>, Array, IDictionary, IDictionary<TKey, TValue> + POCO types \(Plain old CLR objects\) + Predefined AWS event types + For asynchronous invocations the return\-type will be ignored by Lambda\. The return type may be set to void in such cases\. + If you are using \.NET asynchronous programming, the return type can be Task and Task<T> types and use `async` and `await` keywords\. For more information, see [Using async in C\# functions with AWS Lambda](#csharp-handler-async)\. Unless your function input and output parameters are of type `System.IO.Stream`, you will need to serialize them\. AWS Lambda provides a default serializer that can be applied at the assembly or method level of your application, or you can define your own by implementing the `ILambdaSerializer` interface provided by the `Amazon.Lambda.Core` library\. For more information, see [AWS Lambda Deployment Package in C\#](csharp-package.md)\. To add the default serializer attribute to a method, first add a dependency on `Amazon.Lambda.Serialization.Json` in your `project.json` file\. ``` {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
db1f13e3cf53-1
``` { "version": "1.0.0-*", "dependencies":{ "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.1" }, "Amazon.Lambda.Serialization.Json": "1.3.0" }, "frameworks": { "netcoreapp1.0": { "imports": "dnxcore50" } } } ``` The example below illustrates the flexibility you can leverage by specifying the default Json\.NET serializer on one method and another of your choosing on a different method: ``` public class ProductService{ [LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] public Product DescribeProduct(DescribeProductRequest request) { return catalogService.DescribeProduct(request.Id); } [LambdaSerializer(typeof(MyJsonSerializer))] public Customer DescribeCustomer(DescribeCustomerRequest request) { return customerService.DescribeCustomer(request.Id); } } ``` **Note**
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
db1f13e3cf53-2
} } ``` **Note** If you are using \.NET Core 3\.1, we recommend that you use the [ Amazon\.Lambda\.Serialization\.SystemTextJson](https://github.com/aws/aws-lambda-dotnet/tree/0eff7ab687bbfc1e026feee1de336849e0315bc6/Libraries/src/Amazon.Lambda.Serialization.SystemTextJson) serializer\. This package provides a performance improvement over `Amazon.Lambda.Serialization.Json`\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
035a07a53057-0
When creating Lambda functions, you have to provide a handler string that tells AWS Lambda where to look for the code to invoke\. In C\#, the format is: *ASSEMBLY::TYPE::METHOD* where: + *ASSEMBLY* is the name of the \.NET assembly file for your application\. When using the \.NET Core CLI to build your application, if you haven't set the assembly name using the `buildOptions.outputName` setting in project\.json, the *ASSEMBLY* name will be the name of the folder that contains your project\.json file\. For more information, see [\.NET Core CLI](csharp-package-cli.md)\. In this case, let's assume the folder name is `HelloWorldApp`\. + *TYPE* is the full name of the handler type, which consists of the *Namespace* and the *ClassName*\. In this case `Example.Hello`\. + *METHOD* is name of the function handler, in this case `MyHandler`\. Ultimately, the signature will be of this format: *Assembly::Namespace\.ClassName::MethodName* Again, consider the following example: ``` using System.IO; namespace Example { public class Hello { public Stream MyHandler(Stream stream) { //function logic } } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
035a07a53057-1
{ //function logic } } } ``` The handler string would be: `HelloWorldApp::Example.Hello::MyHandler` **Important** If the method specified in your handler string is overloaded, you must provide the exact signature of the method Lambda should invoke\. AWS Lambda will reject an otherwise valid signature if the resolution would require selecting among multiple \(overloaded\) signatures\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
fecefa9336ef-0
For any Lambda functions that use input or output types other than a `Stream` object, you will need to add a serialization library to your application\. You can do this in the following ways: + Use the `Amazon.Lambda.Serialization.Json` NuGet package\. This library uses JSON\.NET to handle serialization\. **Note** If you are using \.NET Core 3\.1, we recommend that you use the [ Amazon\.Lambda\.Serialization\.SystemTextJson](https://github.com/aws/aws-lambda-dotnet/tree/0eff7ab687bbfc1e026feee1de336849e0315bc6/Libraries/src/Amazon.Lambda.Serialization.SystemTextJson) serializer\. This package provides a performance improvement over `Amazon.Lambda.Serialization.Json`\. + Create your own serialization library by implementing the `ILambdaSerializer` interface, which is available as part of the `Amazon.Lambda.Core` library\. The interface defines two methods: + `T Deserialize<T>(Stream requestStream);` You implement this method to deserialize the request payload from the `Invoke` API into the object that is passed to the Lambda function handler\. + `T Serialize<T>(T response, Stream responseStream);`\. You implement this method to serialize the result returned from the Lambda function handler into the response payload that is returned by the `Invoke` API\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
fecefa9336ef-1
You implement this method to serialize the result returned from the Lambda function handler into the response payload that is returned by the `Invoke` API\. You use whichever serializer you wish by adding it as a dependency to your `MyProject.csproj` file\. ``` ... <ItemGroup> <PackageReference Include="Amazon.Lambda.Core" Version="1.0.0" /> <PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.3.0" /> </ItemGroup> ``` You then add it to your AssemblyInfo\.cs file\. For example, if you are using the default Json\.NET serializer, this is what you would add: ``` [assembly:LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] ``` **Note** You can define a custom serialization attribute at the method level, which will override the default serializer specified at the assembly level\. For more information, see [Handling standard data types](#csharp-handler-types)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
01f65178bc71-0
Note that there are some restrictions on the handler signature\. + It may not be `unsafe` and use pointer types in the handler signature, though `unsafe` context can be used inside the handler method and its dependencies\. For more information, see [unsafe \(C\# reference\)](https://msdn.microsoft.com/en-us/library/chfa2zb8.aspx)\. + It may not pass a variable number of parameters using the `params` keyword, or use `ArgIterator` as an input or return parameter which is used to support variable number of parameters\. + The handler may not be a generic method \(e\.g\. IList<T> Sort<T>\(IList<T> input\)\)\. + Async handlers with signature `async void` are not supported\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
b8afc4c16ccd-0
If you know your Lambda function will require a long\-running process, such as uploading large files to Amazon S3 or reading a large stream of records from DynamoDB, you can take advantage of the async/await pattern\. When you use this signature, Lambda executes the function synchronously and waits for the function to return a response or for execution to [time out](configuration-console.md)\. ``` public async Task<Response> ProcessS3ImageResizeAsync(SimpleS3Event input) { var response = await client.DoAsyncWork(input); return response; } ``` If you use this pattern, there are some considerations you must take into account: + AWS Lambda does not support `async void` methods\. + If you create an async Lambda function without implementing the `await` operator, \.NET will issue a compiler warning and you will observe unexpected behavior\. For example, some async actions will execute while others won't\. Or some async actions won't complete before the function execution is complete\. ``` public async Task ProcessS3ImageResizeAsync(SimpleS3Event event) // Compiler warning { client.DoAsyncWork(input); } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
b8afc4c16ccd-1
{ client.DoAsyncWork(input); } ``` + Your Lambda function can include multiple async calls, which can be invoked in parallel\. You can use the `Task.WhenAll` and `Task.WhenAny` methods to work with multiple tasks\. To use the `Task.WhenAll` method, you pass a list of the operations as an array to the method\. Note that in the example below, if you neglect to include any operation to the array, that call may return before its operation completes\. ``` public async Task DoesNotWaitForAllTasks1() { // In Lambda, Console.WriteLine goes to CloudWatch Logs. var task1 = Task.Run(() => Console.WriteLine("Test1")); var task2 = Task.Run(() => Console.WriteLine("Test2")); var task3 = Task.Run(() => Console.WriteLine("Test3")); // Lambda may return before printing "Test2" since we never wait on task2. await Task.WhenAll(task1, task3); } ``` To use the `Task.WhenAny` method, you again pass a list of operations as an array to the method\. The call returns as soon as the first operation completes, even if the others are still running\. ``` public async Task DoesNotWaitForAllTasks2()
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
b8afc4c16ccd-2
``` public async Task DoesNotWaitForAllTasks2() { // In Lambda, Console.WriteLine goes to CloudWatch Logs. var task1 = Task.Run(() => Console.WriteLine("Test1")); var task2 = Task.Run(() => Console.WriteLine("Test2")); var task3 = Task.Run(() => Console.WriteLine("Test3")); // Lambda may return before printing all tests since we're only waiting for one to finish. await Task.WhenAny(task1, task2, task3); } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-handler.md
c2db62b57463-0
Your Lambda function comes with a CloudWatch Logs log group, with a log stream for each instance of your function\. The runtime sends details about each invocation to the log stream, and relays logs and other output from your function's code\. To output logs from your function code, you can use methods on the [console object](https://developer.mozilla.org/en-US/docs/Web/API/Console), or any logging library that writes to `stdout` or `stderr`\. The following example logs the values of environment variables and the event object\. **Example index\.js file – Logging** ``` exports.handler = async function(event, context) { console.log("ENVIRONMENT VARIABLES\n" + JSON.stringify(process.env, null, 2)) console.info("EVENT\n" + JSON.stringify(event, null, 2)) console.warn("Event not processed.") return context.logStreamName } ``` **Example log format** ``` START RequestId: c793869b-ee49-115b-a5b6-4fd21e8dedac Version: $LATEST 2019-06-07T19:11:20.562Z c793869b-ee49-115b-a5b6-4fd21e8dedac INFO ENVIRONMENT VARIABLES {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
c2db62b57463-1
{ "AWS_LAMBDA_FUNCTION_VERSION": "$LATEST", "AWS_LAMBDA_LOG_GROUP_NAME": "/aws/lambda/my-function", "AWS_LAMBDA_LOG_STREAM_NAME": "2019/06/07/[$LATEST]e6f4a0c4241adcd70c262d34c0bbc85c", "AWS_EXECUTION_ENV": "AWS_Lambda_nodejs12.x", "AWS_LAMBDA_FUNCTION_NAME": "my-function", "PATH": "/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin", "NODE_PATH": "/opt/nodejs/node10/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules", ... } 2019-06-07T19:11:20.563Z c793869b-ee49-115b-a5b6-4fd21e8dedac INFO EVENT { "key": "value" } 2019-06-07T19:11:20.564Z c793869b-ee49-115b-a5b6-4fd21e8dedac WARN Event not processed.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
c2db62b57463-2
END RequestId: c793869b-ee49-115b-a5b6-4fd21e8dedac REPORT RequestId: c793869b-ee49-115b-a5b6-4fd21e8dedac Duration: 128.83 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 74 MB Init Duration: 166.62 ms XRAY TraceId: 1-5d9d007f-0a8c7fd02xmpl480aed55ef0 SegmentId: 3d752xmpl1bbe37e Sampled: true ``` The Node\.js runtime logs the `START`, `END`, and `REPORT` lines for each invocation\. It adds a timestamp, request ID, and log level to each entry logged by the function\. The report line provides the following details\. **Report Log** + **RequestId** – The unique request ID for the invocation\. + **Duration** – The amount of time that your function's handler method spent processing the event\. + **Billed Duration** – The amount of time billed for the invocation\. + **Memory Size** – The amount of memory allocated to the function\. + **Max Memory Used** – The amount of memory used by the function\. + **Init Duration** – For the first request served, the amount of time it took the runtime to load the function and run code outside of the handler method\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
c2db62b57463-3
+ **Init Duration** – For the first request served, the amount of time it took the runtime to load the function and run code outside of the handler method\. + **XRAY TraceId** – For traced requests, the [AWS X\-Ray trace ID](services-xray.md)\. + **SegmentId** – For traced requests, the X\-Ray segment ID\. + **Sampled** – For traced requests, the sampling result\. You can view logs in the Lambda console, in the CloudWatch Logs console, or from the command line\. **Topics** + [Viewing logs in the AWS Management Console](#nodejs-logging-console) + [Using the AWS CLI](#nodejs-logging-cli) + [Deleting logs](#nodejs-logging-delete)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
813799d84a6f-0
The Lambda console shows log output when you test a function on the function configuration page\. To view logs for all invocations, use the CloudWatch Logs console\. **To view your Lambda function's logs** 1. Open the [Logs page of the CloudWatch console](https://console.aws.amazon.com/cloudwatch/home?#logs:)\. 1. Choose the log group for your function \(**/aws/lambda/*function\-name***\)\. 1. Choose the first stream in the list\. Each log stream corresponds to an [instance of your function](runtimes-context.md)\. New streams appear when you update your function and when additional instances are created to handle multiple concurrent invocations\. To find logs for specific invocations, you can instrument your function with X\-Ray, and record details about the request and log stream in the trace\. For a sample application that correlates logs and traces with X\-Ray, see [Error processor sample application for AWS Lambda](samples-errorprocessor.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
60b550e83318-0
To get logs for an invocation from the command line, use the `--log-type` option\. The response includes a `LogResult` field that contains up to 4 KB of base64\-encoded logs from the invocation\. ``` $ aws lambda invoke --function-name my-function out --log-type Tail { "StatusCode": 200, "LogResult": "U1RBUlQgUmVxdWVzdElkOiA4N2QwNDRiOC1mMTU0LTExZTgtOGNkYS0yOTc0YzVlNGZiMjEgVmVyc2lvb...", "ExecutedVersion": "$LATEST" } ``` You can use the `base64` utility to decode the logs\. ``` $ aws lambda invoke --function-name my-function out --log-type Tail \ --query 'LogResult' --output text | base64 -d START RequestId: 57f231fb-1730-4395-85cb-4f71bd2b87b8 Version: $LATEST
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
60b550e83318-1
START RequestId: 57f231fb-1730-4395-85cb-4f71bd2b87b8 Version: $LATEST "AWS_SESSION_TOKEN": "AgoJb3JpZ2luX2VjELj...", "_X_AMZN_TRACE_ID": "Root=1-5d02e5ca-f5792818b6fe8368e5b51d50;Parent=191db58857df8395;Sampled=0"",ask/lib:/opt/lib", END RequestId: 57f231fb-1730-4395-85cb-4f71bd2b87b8 REPORT RequestId: 57f231fb-1730-4395-85cb-4f71bd2b87b8 Duration: 79.67 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 73 MB ``` The `base64` utility is available on Linux, macOS, and [Ubuntu on Windows](https://docs.microsoft.com/en-us/windows/wsl/install-win10)\. For macOS, the command is `base64 -D`\. To get full log events from the command line, you can include the log stream name in the output of your function, as shown in the preceding example\. The following example script invokes a function named `my-function` and downloads the last five log events\. **Example get\-logs\.sh Script**
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
60b550e83318-2
**Example get\-logs\.sh Script** This example requires that `my-function` returns a log stream ID\. ``` #!/bin/bash aws lambda invoke --function-name my-function --payload '{"key": "value"}' out sed -i'' -e 's/"//g' out sleep 15 aws logs get-log-events --log-group-name /aws/lambda/my-function --log-stream-name $(cat out) --limit 5 ``` The script uses `sed` to remove quotes from the output file, and sleeps for 15 seconds to allow time for the logs to be available\. The output includes the response from Lambda and the output from the `get-log-events` command\. ``` $ ./get-logs.sh { "StatusCode": 200, "ExecutedVersion": "$LATEST" } { "events": [ { "timestamp": 1559763003171, "message": "START RequestId: 4ce9340a-b765-490f-ad8a-02ab3415e2bf Version: $LATEST\n", "ingestionTime": 1559763003309 }, {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
60b550e83318-3
"ingestionTime": 1559763003309 }, { "timestamp": 1559763003173, "message": "2019-06-05T19:30:03.173Z\t4ce9340a-b765-490f-ad8a-02ab3415e2bf\tINFO\tENVIRONMENT VARIABLES\r{\r \"AWS_LAMBDA_FUNCTION_VERSION\": \"$LATEST\",\r ...", "ingestionTime": 1559763018353 }, { "timestamp": 1559763003173, "message": "2019-06-05T19:30:03.173Z\t4ce9340a-b765-490f-ad8a-02ab3415e2bf\tINFO\tEVENT\r{\r \"key\": \"value\"\r}\n", "ingestionTime": 1559763018353 }, { "timestamp": 1559763003218, "message": "END RequestId: 4ce9340a-b765-490f-ad8a-02ab3415e2bf\n", "ingestionTime": 1559763018353 }, {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
60b550e83318-4
"ingestionTime": 1559763018353 }, { "timestamp": 1559763003218, "message": "REPORT RequestId: 4ce9340a-b765-490f-ad8a-02ab3415e2bf\tDuration: 26.73 ms\tBilled Duration: 100 ms \tMemory Size: 128 MB\tMax Memory Used: 75 MB\t\n", "ingestionTime": 1559763018353 } ], "nextForwardToken": "f/34783877304859518393868359594929986069206639495374241795", "nextBackwardToken": "b/34783877303811383369537420289090800615709599058929582080" } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
04ebbf25581c-0
Log groups aren't deleted automatically when you delete a function\. To avoid storing logs indefinitely, delete the log group, or [configure a retention period](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html#SettingLogRetention) after which logs are deleted automatically\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-logging.md
185d2602d2f6-0
Updates the configuration for asynchronous invocation for a function, version, or alias\. To configure options for asynchronous invocation, use [PutFunctionEventInvokeConfig](API_PutFunctionEventInvokeConfig.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
93ad9d185c47-0
``` POST /2019-09-25/functions/FunctionName/event-invoke-config?Qualifier=Qualifier HTTP/1.1 Content-type: application/json { "DestinationConfig": { "OnFailure": { "Destination": "string" }, "OnSuccess": { "Destination": "string" } }, "MaximumEventAgeInSeconds": number, "MaximumRetryAttempts": number } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
948c165e0381-0
The request uses the following URI parameters\. ** [FunctionName](#API_UpdateFunctionEventInvokeConfig_RequestSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-request-FunctionName"></a> The name of the Lambda function, version, or alias\. **Name formats** + **Function name** \- `my-function` \(name\-only\), `my-function:v1` \(with alias\)\. + **Function ARN** \- `arn:aws:lambda:us-west-2:123456789012:function:my-function`\. + **Partial ARN** \- `123456789012:function:my-function`\. You can append a version number or alias to any of the formats\. The length constraint applies only to the full ARN\. If you specify only the function name, it is limited to 64 characters in length\. Length Constraints: Minimum length of 1\. Maximum length of 140\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
948c165e0381-1
Length Constraints: Minimum length of 1\. Maximum length of 140\. Pattern: `(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?` Required: Yes ** [Qualifier](#API_UpdateFunctionEventInvokeConfig_RequestSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-request-Qualifier"></a> A version number or alias name\. Length Constraints: Minimum length of 1\. Maximum length of 128\. Pattern: `(|[a-zA-Z0-9$_-]+)`
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
e843a5f5df1e-0
The request accepts the following data in JSON format\. ** [DestinationConfig](#API_UpdateFunctionEventInvokeConfig_RequestSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-request-DestinationConfig"></a> A destination for events after they have been sent to a function for processing\. **Destinations** + **Function** \- The Amazon Resource Name \(ARN\) of a Lambda function\. + **Queue** \- The ARN of an SQS queue\. + **Topic** \- The ARN of an SNS topic\. + **Event Bus** \- The ARN of an Amazon EventBridge event bus\. Type: [DestinationConfig](API_DestinationConfig.md) object Required: No ** [MaximumEventAgeInSeconds](#API_UpdateFunctionEventInvokeConfig_RequestSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-request-MaximumEventAgeInSeconds"></a> The maximum age of a request that Lambda sends to a function for processing\. Type: Integer Valid Range: Minimum value of 60\. Maximum value of 21600\. Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
e843a5f5df1e-1
Type: Integer Valid Range: Minimum value of 60\. Maximum value of 21600\. Required: No ** [MaximumRetryAttempts](#API_UpdateFunctionEventInvokeConfig_RequestSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-request-MaximumRetryAttempts"></a> The maximum number of times to retry when the function returns an error\. Type: Integer Valid Range: Minimum value of 0\. Maximum value of 2\. Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
c908c3f06f17-0
``` HTTP/1.1 200 Content-type: application/json { "DestinationConfig": { "OnFailure": { "Destination": "string" }, "OnSuccess": { "Destination": "string" } }, "FunctionArn": "string", "LastModified": number, "MaximumEventAgeInSeconds": number, "MaximumRetryAttempts": number } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
d42d05f7c331-0
If the action is successful, the service sends back an HTTP 200 response\. The following data is returned in JSON format by the service\. ** [DestinationConfig](#API_UpdateFunctionEventInvokeConfig_ResponseSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-response-DestinationConfig"></a> A destination for events after they have been sent to a function for processing\. **Destinations** + **Function** \- The Amazon Resource Name \(ARN\) of a Lambda function\. + **Queue** \- The ARN of an SQS queue\. + **Topic** \- The ARN of an SNS topic\. + **Event Bus** \- The ARN of an Amazon EventBridge event bus\. Type: [DestinationConfig](API_DestinationConfig.md) object ** [FunctionArn](#API_UpdateFunctionEventInvokeConfig_ResponseSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-response-FunctionArn"></a> The Amazon Resource Name \(ARN\) of the function\. Type: String
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
d42d05f7c331-1
The Amazon Resource Name \(ARN\) of the function\. Type: String Pattern: `arn:(aws[a-zA-Z-]*)?:lambda:[a-z]{2}(-gov)?-[a-z]+-\d{1}:\d{12}:function:[a-zA-Z0-9-_]+(:(\$LATEST|[a-zA-Z0-9-_]+))?` ** [LastModified](#API_UpdateFunctionEventInvokeConfig_ResponseSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-response-LastModified"></a> The date and time that the configuration was last updated, in Unix time seconds\. Type: Timestamp ** [MaximumEventAgeInSeconds](#API_UpdateFunctionEventInvokeConfig_ResponseSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-response-MaximumEventAgeInSeconds"></a> The maximum age of a request that Lambda sends to a function for processing\. Type: Integer Valid Range: Minimum value of 60\. Maximum value of 21600\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
d42d05f7c331-2
Type: Integer Valid Range: Minimum value of 60\. Maximum value of 21600\. ** [MaximumRetryAttempts](#API_UpdateFunctionEventInvokeConfig_ResponseSyntax) ** <a name="SSS-UpdateFunctionEventInvokeConfig-response-MaximumRetryAttempts"></a> The maximum number of times to retry when the function returns an error\. Type: Integer Valid Range: Minimum value of 0\. Maximum value of 2\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
ff65a760798b-0
**InvalidParameterValueException** One of the parameters in the request is invalid\. HTTP Status Code: 400 **ResourceNotFoundException** The resource specified in the request does not exist\. HTTP Status Code: 404 **ServiceException** The AWS Lambda service encountered an internal error\. HTTP Status Code: 500 **TooManyRequestsException** The request throughput limit was exceeded\. HTTP Status Code: 429
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
e7be58cdb6bc-0
For more information about using this API in one of the language\-specific AWS SDKs, see the following: + [AWS Command Line Interface](https://docs.aws.amazon.com/goto/aws-cli/lambda-2015-03-31/UpdateFunctionEventInvokeConfig) + [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/UpdateFunctionEventInvokeConfig) + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/UpdateFunctionEventInvokeConfig) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/UpdateFunctionEventInvokeConfig) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/UpdateFunctionEventInvokeConfig) + [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/UpdateFunctionEventInvokeConfig)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
e7be58cdb6bc-1
+ [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/UpdateFunctionEventInvokeConfig) + [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/UpdateFunctionEventInvokeConfig) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/UpdateFunctionEventInvokeConfig)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_UpdateFunctionEventInvokeConfig.md
f3a1994f7dbe-0
Returns details about the reserved concurrency configuration for a function\. To set a concurrency limit for a function, use [PutFunctionConcurrency](API_PutFunctionConcurrency.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md
599dbd867c44-0
``` GET /2019-09-30/functions/FunctionName/concurrency HTTP/1.1 ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md
a19dbf0f86ed-0
The request uses the following URI parameters\. ** [FunctionName](#API_GetFunctionConcurrency_RequestSyntax) ** <a name="SSS-GetFunctionConcurrency-request-FunctionName"></a> The name of the Lambda function\. **Name formats** + **Function name** \- `my-function`\. + **Function ARN** \- `arn:aws:lambda:us-west-2:123456789012:function:my-function`\. + **Partial ARN** \- `123456789012:function:my-function`\. The length constraint applies only to the full ARN\. If you specify only the function name, it is limited to 64 characters in length\. Length Constraints: Minimum length of 1\. Maximum length of 140\. Pattern: `(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?` Required: Yes
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md
fefcaf2ce9e5-0
The request does not have a request body\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md
0c3c9ea12cfc-0
``` HTTP/1.1 200 Content-type: application/json { "ReservedConcurrentExecutions": number } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md
1a6bb2a8acad-0
If the action is successful, the service sends back an HTTP 200 response\. The following data is returned in JSON format by the service\. ** [ReservedConcurrentExecutions](#API_GetFunctionConcurrency_ResponseSyntax) ** <a name="SSS-GetFunctionConcurrency-response-ReservedConcurrentExecutions"></a> The number of simultaneous executions that are reserved for the function\. Type: Integer Valid Range: Minimum value of 0\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md
b6cfd778f3ae-0
**InvalidParameterValueException** One of the parameters in the request is invalid\. HTTP Status Code: 400 **ResourceNotFoundException** The resource specified in the request does not exist\. HTTP Status Code: 404 **ServiceException** The AWS Lambda service encountered an internal error\. HTTP Status Code: 500 **TooManyRequestsException** The request throughput limit was exceeded\. HTTP Status Code: 429
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md
7d432f291851-0
For more information about using this API in one of the language\-specific AWS SDKs, see the following: + [AWS Command Line Interface](https://docs.aws.amazon.com/goto/aws-cli/lambda-2015-03-31/GetFunctionConcurrency) + [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/GetFunctionConcurrency) + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/GetFunctionConcurrency) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/GetFunctionConcurrency) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/GetFunctionConcurrency) + [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/GetFunctionConcurrency)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md