id
stringlengths
14
16
text
stringlengths
1
2.43k
source
stringlengths
99
229
8ddf45a95562-0
This tutorial assumes that you have some knowledge of basic Lambda operations and the Lambda console\. If you haven't already, follow the instructions in [Getting started with AWS Lambda](getting-started.md) to create your first Lambda function\. To follow the procedures in this guide, you will need a command line terminal or shell to run commands\. Commands are shown in listings preceded by a prompt symbol \($\) and the name of the current directory, when appropriate: ``` ~/lambda-project$ this is a command this is output ``` For long commands, an escape character \(`\`\) is used to split a command over multiple lines\. On Linux and macOS, use your preferred shell and package manager\. On Windows 10, you can [install the Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) to get a Windows\-integrated version of Ubuntu and Bash\. In the tutorial, you use two accounts\. The AWS CLI commands illustrate this by using two [named profiles](https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html), each configured for use with a different account\. If you use profiles with different names, or the default profile and one named profile, modify the commands as needed\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
5820a52a4c1b-0
From account A \(01234567891A\), create the source Amazon SNS topic\. ``` $ aws sns create-topic --name lambda-x-account --profile accountA ``` Note the topic ARN that is returned by the command\. You will need it when you add permissions to the Lambda function to subscribe to the topic\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
fb3eeedc08e5-0
From account B \(01234567891B\), create the [execution role](lambda-intro-execution-role.md) that gives your function permission to access AWS resources\. **To create an execution role** 1. Open the [roles page](https://console.aws.amazon.com/iam/home#/roles) in the IAM console\. 1. Choose **Create role**\. 1. Create a role with the following properties\. + **Trusted entity** – **AWS Lambda**\. + **Permissions** – **AWSLambdaBasicExecutionRole**\. + **Role name** – **lambda\-sns\-role**\. The **AWSLambdaBasicExecutionRole** policy has the permissions that the function needs to write logs to CloudWatch Logs\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
35bd1f4312c3-0
From account B \(01234567891B\), create the function that processes events from Amazon SNS\. The following example code receives an Amazon SNS event input and processes the messages that it contains\. For illustration, the code writes some of the incoming event data to CloudWatch Logs\. **Note** For sample code in other languages, see [Sample function code](with-sns-create-package.md)\. **Example index\.js** ``` console.log('Loading function'); exports.handler = function(event, context, callback) { // console.log('Received event:', JSON.stringify(event, null, 4)); var message = event.Records[0].Sns.Message; console.log('Message received from SNS:', message); callback(null, "Success"); }; ``` **To create the function** 1. Copy the sample code into a file named `index.js`\. 1. Create a deployment package\. ``` $ zip function.zip index.js ``` 1. Create a Lambda function with the `create-function` command\. ``` $ aws lambda create-function --function-name SNS-X-Account \
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
35bd1f4312c3-1
``` $ aws lambda create-function --function-name SNS-X-Account \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs12.x \ --role arn:aws:iam::01234567891B:role/service-role/lambda-sns-execution-role \ --timeout 60 --profile accountB ``` Note the function ARN that is returned by the command\. You will need it when you add permissions to allow Amazon SNS to invoke your function\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
738835f800a9-0
From account A \(01234567891A\), grant permission to account B \(01234567891B\) to subscribe to the topic: ``` $ aws sns add-permission --label lambda-access --aws-account-id 12345678901B \ --topic-arn arn:aws:sns:us-east-2:12345678901A:lambda-x-account \ --action-name Subscribe ListSubscriptionsByTopic Receive --profile accountA ``` From account B \(01234567891B\), add the Lambda permission to allow invocation from Amazon SNS\. ``` $ aws lambda add-permission --function-name SNS-X-Account \ --source-arn arn:aws:sns:us-east-2:12345678901A:lambda-x-account \ --statement-id sns-x-account --action "lambda:InvokeFunction" \ --principal sns.amazonaws.com --profile accountB { "Statement": "{\"Condition\":{\"ArnLike\":{\"AWS:SourceArn\": \"arn:aws:lambda:us-east-2:12345678901B:function:SNS-X-Account\"}},
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
738835f800a9-1
\"arn:aws:lambda:us-east-2:12345678901B:function:SNS-X-Account\"}}, \"Action\":[\"lambda:InvokeFunction\"], \"Resource\":\"arn:aws:lambda:us-east-2:01234567891A:function:SNS-X-Account\", \"Effect\":\"Allow\",\"Principal\":{\"Service\":\"sns.amazonaws.com\"}, \"Sid\":\"sns-x-account1\"}" } ``` Do not use the `--source-account` parameter to add a source account to the Lambda policy when adding the policy\. Source account is not supported for Amazon SNS event sources and will result in access being denied\. **Note** If the account with the SNS topic is hosted in an opt\-in region, you need to specify the region in the principal\. For an example, see [Invoking Lambda functions using Amazon SNS notifications](https://docs.aws.amazon.com/sns/latest/dg/sns-lambda.html) in the *Amazon Simple Notification Service Developer Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
f179335ae030-0
From account B, subscribe the Lambda function to the topic\. When a message is sent to the `lambda-x-account` topic in account A \(01234567891A\), Amazon SNS invokes the `SNS-X-Account` function in account B \(01234567891B\)\. ``` $ aws sns subscribe --protocol lambda \ --topic-arn arn:aws:sns:us-east-2:12345678901A:lambda-x-account \ --notification-endpoint arn:aws:lambda:us-east-2:12345678901B:function:SNS-X-Account \ --profile accountB { "SubscriptionArn": "arn:aws:sns:us-east-2:12345678901A:lambda-x-account:5d906xxxx-7c8x-45dx-a9dx-0484e31c98xx" } ``` The output contains the ARN of the topic subscription\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
dab8d59189d7-0
From account A \(01234567891A\), test the subscription\. Type `Hello World` into a text file and save it as `message.txt`\. Then run the following command: ``` $ aws sns publish --message file://message.txt --subject Test \ --topic-arn arn:aws:sns:us-east-2:12345678901A:lambda-x-account \ --profile accountA ``` This will return a message id with a unique identifier, indicating the message has been accepted by the Amazon SNS service\. Amazon SNS will then attempt to deliver it to the topic's subscribers\. Alternatively, you could supply a JSON string directly to the `message` parameter, but using a text file allows for line breaks in the message\. To learn more about Amazon SNS, see [What is Amazon Simple Notification Service](https://docs.aws.amazon.com/sns/latest/dg/)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md
a2d287e707d0-0
Sample code is available for the following languages\. **Topics** + [Node\.js](#services-apigateway-code-nodejs) + [Python 3](#services-apigateway-code-python) + [Go](#services-apigateway-code-go)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-apigateway-code.md
b3e870f1c90d-0
The following example processes messages from API Gateway, and manages DynamoDB documents based on the request method\. **Example index\.js** ``` console.log('Loading function'); var AWS = require('aws-sdk'); var dynamo = new AWS.DynamoDB.DocumentClient(); /** * Provide an event that contains the following keys: * * - operation: one of the operations in the switch statement below * - tableName: required for operations that interact with DynamoDB * - payload: a parameter to pass to the operation being performed */ exports.handler = function(event, context, callback) { //console.log('Received event:', JSON.stringify(event, null, 2)); var operation = event.operation; if (event.tableName) { event.payload.TableName = event.tableName; } switch (operation) { case 'create': dynamo.put(event.payload, callback); break; case 'read': dynamo.get(event.payload, callback); break; case 'update': dynamo.update(event.payload, callback); break; case 'delete':
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-apigateway-code.md
b3e870f1c90d-1
case 'update': dynamo.update(event.payload, callback); break; case 'delete': dynamo.delete(event.payload, callback); break; case 'list': dynamo.scan(event.payload, callback); break; case 'echo': callback(null, "Success"); break; case 'ping': callback(null, "pong"); break; default: callback('Unknown operation: ${operation}'); } }; ``` Zip up the sample code to create a deployment package\. For instructions, see [AWS Lambda deployment package in Node\.js](nodejs-package.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-apigateway-code.md
a3f7a82dd9bc-0
The following example processes messages from API Gateway, and manages DynamoDB documents based on the request method\. **Example LambdaFunctionOverHttps\.py** ``` from __future__ import print_function import boto3 import json print('Loading function') def handler(event, context): '''Provide an event that contains the following keys: - operation: one of the operations in the operations dict below - tableName: required for operations that interact with DynamoDB - payload: a parameter to pass to the operation being performed ''' #print("Received event: " + json.dumps(event, indent=2)) operation = event['operation'] if 'tableName' in event: dynamo = boto3.resource('dynamodb').Table(event['tableName']) operations = { 'create': lambda x: dynamo.put_item(**x), 'read': lambda x: dynamo.get_item(**x), 'update': lambda x: dynamo.update_item(**x), 'delete': lambda x: dynamo.delete_item(**x), 'list': lambda x: dynamo.scan(**x), 'echo': lambda x: x, 'ping': lambda x: 'pong'
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-apigateway-code.md
a3f7a82dd9bc-1
'echo': lambda x: x, 'ping': lambda x: 'pong' } if operation in operations: return operations[operation](event.get('payload')) else: raise ValueError('Unrecognized operation "{}"'.format(operation)) ``` Zip up the sample code to create a deployment package\. For instructions, see [AWS Lambda deployment package in Python](python-package.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-apigateway-code.md
e5e0f19ead81-0
The following example processes messages from API Gateway, and logs information about the request\. **Example LambdaFunctionOverHttps\.go** ``` import ( "strings" "github.com/aws/aws-lambda-go/events" ) func handleRequest(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { fmt.Printf("Processing request data for request %s.\n", request.RequestContext.RequestId) fmt.Printf("Body size = %d.\n", len(request.Body)) fmt.Println("Headers:") for key, value := range request.Headers { fmt.Printf(" %s: %s\n", key, value) } return events.APIGatewayProxyResponse { Body: request.Body, StatusCode: 200 }, nil } ``` Build the executable with `go build` and create a deployment package\. For instructions, see [AWS Lambda deployment package in Go](golang-package.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-apigateway-code.md
7011c6ba20a8-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 class](https://docs.microsoft.com/en-us/dotnet/api/system.console), or any logging library that writes to `stdout` or `stderr`\. The following example uses the `LambdaLogger` class from the [Amazon\.Lambda\.Core](lambda-csharp.md) library\. **Example [src/blank\-csharp/Function\.cs](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-csharp/src/blank-csharp/Function.cs) – Logging** ``` public async Task<AccountUsage> FunctionHandler(SQSEvent invocationEvent, ILambdaContext context) { GetAccountSettingsResponse accountSettings; try { accountSettings = await callLambda(); } catch (AmazonLambdaException ex) { throw ex; } AccountUsage accountUsage = accountSettings.AccountUsage;
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-logging.md
7011c6ba20a8-1
{ throw ex; } AccountUsage accountUsage = accountSettings.AccountUsage; LambdaLogger.Log("ENVIRONMENT VARIABLES: " + JsonConvert.SerializeObject(System.Environment.GetEnvironmentVariables())); LambdaLogger.Log("CONTEXT: " + JsonConvert.SerializeObject(context)); LambdaLogger.Log("EVENT: " + JsonConvert.SerializeObject(invocationEvent)); return accountUsage; } ``` **Example Log format** ``` START RequestId: d1cf0ccb-xmpl-46e6-950d-04c96c9b1c5d Version: $LATEST ENVIRONMENT VARIABLES: { "AWS_EXECUTION_ENV": "AWS_Lambda_dotnetcore2.1", "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "256", "AWS_LAMBDA_LOG_GROUP_NAME": "/aws/lambda/blank-csharp-function-WU56XMPLV2XA", "AWS_LAMBDA_FUNCTION_VERSION": "$LATEST", "AWS_LAMBDA_LOG_STREAM_NAME": "2020/03/27/[$LATEST]5296xmpl084f411d9fb73b258393f30c",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-logging.md
7011c6ba20a8-2
"AWS_LAMBDA_FUNCTION_NAME": "blank-csharp-function-WU56XMPLV2XA", ... EVENT: { "Records": [ { "MessageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb78", "ReceiptHandle": "MessageReceiptHandle", "Body": "Hello from SQS!", "Md5OfBody": "7b270e59b47ff90a553787216d55d91d", "Md5OfMessageAttributes": null, "EventSourceArn": "arn:aws:sqs:us-west-2:123456789012:MyQueue", "EventSource": "aws:sqs", "AwsRegion": "us-west-2", "Attributes": { "ApproximateReceiveCount": "1", "SentTimestamp": "1523232000000", "SenderId": "123456789012", "ApproximateFirstReceiveTimestamp": "1523232000001" }, ...
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-logging.md
7011c6ba20a8-3
"ApproximateFirstReceiveTimestamp": "1523232000001" }, ... END RequestId: d1cf0ccb-xmpl-46e6-950d-04c96c9b1c5d REPORT RequestId: d1cf0ccb-xmpl-46e6-950d-04c96c9b1c5d Duration: 4157.16 ms Billed Duration: 4200 ms Memory Size: 256 MB Max Memory Used: 99 MB Init Duration: 841.60 ms XRAY TraceId: 1-5e7e8131-7ff0xmpl32bfb31045d0a3bb SegmentId: 0152xmpl6016310f Sampled: true ``` The \.NET runtime logs the `START`, `END`, and `REPORT` lines for each invocation\. 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\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-logging.md
7011c6ba20a8-4
+ **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\. + **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](#csharp-logging-console) + [Using the AWS CLI](#csharp-logging-cli) + [Deleting logs](#csharp-logging-delete)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-logging.md
9f12b0dca550-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/csharp-logging.md
d12e2d7b5bcc-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/csharp-logging.md
d12e2d7b5bcc-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/csharp-logging.md
d12e2d7b5bcc-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/csharp-logging.md
d12e2d7b5bcc-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/csharp-logging.md
d12e2d7b5bcc-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/csharp-logging.md
d69fad2b6a23-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/csharp-logging.md
0643b76cf621-0
You can run Python code in AWS Lambda\. Lambda provides [runtimes](lambda-runtimes.md) for Python that execute your code to process events\. Your code runs in an environment that includes the SDK for Python \(Boto3\), with credentials from an AWS Identity and Access Management \(IAM\) role that you manage\. Lambda supports the following Python runtimes\. **Python runtimes** | Name | Identifier | AWS SDK for Python | Operating system | | --- | --- | --- | --- | | Python 3\.8 | `python3.8` | boto3\-1\.14\.17 botocore\-1\.17\.17 | Amazon Linux 2 | | Python 3\.7 | `python3.7` | boto3\-1\.14\.17 botocore\-1\.17\.17 | Amazon Linux | | Python 3\.6 | `python3.6` | boto3\-1\.14\.17 botocore\-1\.17\.17 | Amazon Linux | | Python 2\.7 | `python2.7` | boto3\-1\.14\.17 botocore\-1\.17\.17 | Amazon Linux | Lambda functions use an [execution role](lambda-intro-execution-role.md) to get permission to write logs to Amazon CloudWatch Logs, and to access other services and resources\. If you don't already have an execution role for function development, create one\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/lambda-python.md
0643b76cf621-1
**To create an execution role** 1. Open the [roles page](https://console.aws.amazon.com/iam/home#/roles) in the IAM console\. 1. Choose **Create role**\. 1. Create a role with the following properties\. + **Trusted entity** – **Lambda**\. + **Permissions** – **AWSLambdaBasicExecutionRole**\. + **Role name** – **lambda\-role**\. The **AWSLambdaBasicExecutionRole** policy has the permissions that the function needs to write logs to CloudWatch Logs\. You can add permissions to the role later, or swap it out for a different role that's specific to a single function\. **To create a Python function** 1. Open the [Lambda console](https://console.aws.amazon.com/lambda)\. 1. Choose **Create function**\. 1. Configure the following settings: + **Name** – **my\-function**\. + **Runtime** – **Python 3\.8**\. + **Role** – **Choose an existing role**\. + **Existing role** – **lambda\-role**\. 1. Choose **Create function**\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/lambda-python.md
0643b76cf621-2
+ **Existing role** – **lambda\-role**\. 1. Choose **Create function**\. 1. To configure a test event, choose **Test**\. 1. For **Event name**, enter **test**\. 1. Choose **Create**\. 1. To execute the function, choose **Test**\. The console creates a Lambda function with a single source file named `lambda_function`\. You can edit this file and add more files in the built\-in [code editor](code-editor.md)\. To save your changes, choose **Save**\. Then, to run your code, choose **Test**\. **Note** The Lambda console uses AWS Cloud9 to provide an integrated development environment in the browser\. You can also use AWS Cloud9 to develop Lambda functions in your own environment\. For more information, see [Working with AWS Lambda Functions](https://docs.aws.amazon.com/cloud9/latest/user-guide/lambda-functions.html) in the AWS Cloud9 user guide\. The `lambda_function` file exports a function named `lambda_handler` that takes an event object and a context object\. This is the [handler function](python-handler.md) that Lambda calls when the function is invoked\. The Python function runtime gets invocation events from Lambda and passes them to the handler\. In the function configuration, the handler value is `lambda_function.lambda_handler`\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/lambda-python.md
0643b76cf621-3
Each time you save your function code, the Lambda console creates a deployment package, which is a ZIP archive that contains your function code\. As your function development progresses, you will want to store your function code in source control, add libraries, and automate deployments\. Start by [creating a deployment package](python-package.md) and updating your code at the command line\. **Note** To get started with application development in your local environment, deploy one of the sample applications available in this guide's GitHub repository\. [blank\-python](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-python) – A Python function that shows the use of logging, environment variables, AWS X\-Ray tracing, layers, unit tests and the AWS SDK\. The function runtime passes a context object to the handler, in addition to the invocation event\. The [context object](python-context.md) contains additional information about the invocation, the function, and the execution environment\. More information is available from environment variables\. Your Lambda function comes with a CloudWatch Logs log group\. The function runtime sends details about each invocation to CloudWatch Logs\. It relays any [logs that your function outputs](python-logging.md) during invocation\. If your function [returns an error](python-exceptions.md), Lambda formats the error and returns it to the invoker\. **Topics** + [AWS Lambda function handler in Python](python-handler.md)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/lambda-python.md
0643b76cf621-4
**Topics** + [AWS Lambda function handler in Python](python-handler.md) + [AWS Lambda deployment package in Python](python-package.md) + [AWS Lambda context object in Python](python-context.md) + [AWS Lambda function logging in Python](python-logging.md) + [AWS Lambda function errors in Python](python-exceptions.md) + [Instrumenting Python code in AWS Lambda](python-tracing.md)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/lambda-python.md
e19c426f5692-0
Details about a version of an [AWS Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_LayerVersionsListItem.md
77f9d91fc0af-0
**CompatibleRuntimes** <a name="SSS-Type-LayerVersionsListItem-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` Required: No **CreatedDate** <a name="SSS-Type-LayerVersionsListItem-CreatedDate"></a> The date that the version was created, in ISO 8601 format\. For example, `2018-11-27T15:10:45.123+0000`\. Type: String Required: No **Description** <a name="SSS-Type-LayerVersionsListItem-Description"></a> The description of the version\. Type: String Length Constraints: Minimum length of 0\. Maximum length of 256\. Required: No **LayerVersionArn** <a name="SSS-Type-LayerVersionsListItem-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_LayerVersionsListItem.md
77f9d91fc0af-1
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]+` Required: No **LicenseInfo** <a name="SSS-Type-LayerVersionsListItem-LicenseInfo"></a> The layer's open\-source license\. Type: String Length Constraints: Maximum length of 512\. Required: No **Version** <a name="SSS-Type-LayerVersionsListItem-Version"></a> The version number\. Type: Long Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_LayerVersionsListItem.md
247aabaabfa1-0
For more information about using this API in one of the language\-specific AWS SDKs, see the following: + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/LayerVersionsListItem) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/LayerVersionsListItem) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/LayerVersionsListItem) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/LayerVersionsListItem)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_LayerVersionsListItem.md
7d40c3ffd832-0
Lists the versions of an [AWS Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html)\. Versions that have been deleted aren't listed\. Specify a [runtime identifier](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) to list only versions that indicate that they're compatible with that runtime\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListLayerVersions.md
1236cfb80427-0
``` GET /2018-10-31/layers/LayerName/versions?CompatibleRuntime=CompatibleRuntime&Marker=Marker&MaxItems=MaxItems HTTP/1.1 ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListLayerVersions.md
54052e141064-0
The request uses the following URI parameters\. ** [CompatibleRuntime](#API_ListLayerVersions_RequestSyntax) ** <a name="SSS-ListLayerVersions-request-CompatibleRuntime"></a> A runtime identifier\. For example, `go1.x`\. 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` ** [LayerName](#API_ListLayerVersions_RequestSyntax) ** <a name="SSS-ListLayerVersions-request-LayerName"></a> The name or Amazon Resource Name \(ARN\) of the layer\. 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-_]+)|[a-zA-Z0-9-_]+` Required: Yes ** [Marker](#API_ListLayerVersions_RequestSyntax) ** <a name="SSS-ListLayerVersions-request-Marker"></a>
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListLayerVersions.md
54052e141064-1
A pagination token returned by a previous call\. ** [MaxItems](#API_ListLayerVersions_RequestSyntax) ** <a name="SSS-ListLayerVersions-request-MaxItems"></a> The maximum number of versions to return\. Valid Range: Minimum value of 1\. Maximum value of 50\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListLayerVersions.md
7e281e4dd769-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_ListLayerVersions.md
d6eaf172031f-0
``` HTTP/1.1 200 Content-type: application/json { "LayerVersions": [ { "CompatibleRuntimes": [ "string" ], "CreatedDate": "string", "Description": "string", "LayerVersionArn": "string", "LicenseInfo": "string", "Version": number } ], "NextMarker": "string" } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListLayerVersions.md
56cc9249b21d-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\. ** [LayerVersions](#API_ListLayerVersions_ResponseSyntax) ** <a name="SSS-ListLayerVersions-response-LayerVersions"></a> A list of versions\. Type: Array of [LayerVersionsListItem](API_LayerVersionsListItem.md) objects ** [NextMarker](#API_ListLayerVersions_ResponseSyntax) ** <a name="SSS-ListLayerVersions-response-NextMarker"></a> A pagination token returned when the response doesn't contain all versions\. Type: String
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListLayerVersions.md
40df00c640a5-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_ListLayerVersions.md
ab137f1409a0-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/ListLayerVersions) + [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/ListLayerVersions) + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/ListLayerVersions) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/ListLayerVersions) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/ListLayerVersions) + [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/ListLayerVersions) + [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/ListLayerVersions)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListLayerVersions.md
ab137f1409a0-1
+ [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/ListLayerVersions) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/ListLayerVersions)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListLayerVersions.md
5c7c771a5a74-0
Sample code is available for the following languages\. **Topics** + [Node\.js](#with-android-example-deployment-pkg-nodejs) + [Java](#with-on-demand-custom-android-example-deployment-pkg-java)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-android-create-package.md
f1d672bf7620-0
The following example uses data to generate a string response\. **Example index\.js** ``` exports.handler = function(event, context, callback) { console.log("Received event: ", event); var data = { "greetings": "Hello, " + event.firstName + " " + event.lastName + "." }; callback(null, data); } ``` Zip up the sample code to create a deployment package\. For instructions, see [AWS Lambda deployment package in Node\.js](nodejs-package.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-android-create-package.md
39353ad5b64b-0
The following example uses data to generate a string response\. In the code, the `handler` \(`myHandler`\) uses the `RequestClass` and `ResponseClass` types for the input and output\. The code provides implementation for these types\. **Example HelloPojo\.java** ``` package example; import com.amazonaws.services.lambda.runtime.Context; public class HelloPojo { // Define two classes/POJOs for use with Lambda function. public static class RequestClass { String firstName; String lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public RequestClass(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public RequestClass() { } } public static class ResponseClass { String greetings; public String getGreetings() { return greetings; }
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-android-create-package.md
39353ad5b64b-1
String greetings; public String getGreetings() { return greetings; } public void setGreetings(String greetings) { this.greetings = greetings; } public ResponseClass(String greetings) { this.greetings = greetings; } public ResponseClass() { } } public static ResponseClass myHandler(RequestClass request, Context context){ String greetingString = String.format("Hello %s, %s.", request.firstName, request.lastName); context.getLogger().log(greetingString); return new ResponseClass(greetingString); } } ``` **Dependencies** + `aws-lambda-java-core` Build the code with the Lambda library dependencies to create a deployment package\. For instructions, see [AWS Lambda deployment package in Java](java-package.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-android-create-package.md
4c7f5065f69f-0
An [AWS Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_Layer.md
863ac2803f4f-0
**Arn** <a name="SSS-Type-Layer-Arn"></a> The Amazon Resource Name \(ARN\) of the function 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-_]+:[0-9]+` Required: No **CodeSize** <a name="SSS-Type-Layer-CodeSize"></a> The size of the layer archive in bytes\. Type: Long Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_Layer.md
83ecd6e2944e-0
For more information about using this API in one of the language\-specific AWS SDKs, see the following: + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/Layer) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/Layer) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/Layer) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/Layer)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_Layer.md
0183a2059b4d-0
A mapping between an AWS resource and an AWS Lambda function\. See [CreateEventSourceMapping](API_CreateEventSourceMapping.md) for details\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EventSourceMappingConfiguration.md
e1fb60345df5-0
**BatchSize** <a name="SSS-Type-EventSourceMappingConfiguration-BatchSize"></a> The maximum number of items to retrieve in a single batch\. Type: Integer Valid Range: Minimum value of 1\. Maximum value of 10000\. Required: No **BisectBatchOnFunctionError** <a name="SSS-Type-EventSourceMappingConfiguration-BisectBatchOnFunctionError"></a> \(Streams\) If the function returns an error, split the batch in two and retry\. The default value is false\. Type: Boolean Required: No **DestinationConfig** <a name="SSS-Type-EventSourceMappingConfiguration-DestinationConfig"></a> \(Streams\) An Amazon SQS queue or Amazon SNS topic destination for discarded records\. Type: [DestinationConfig](API_DestinationConfig.md) object Required: No **EventSourceArn** <a name="SSS-Type-EventSourceMappingConfiguration-EventSourceArn"></a> The Amazon Resource Name \(ARN\) of the event source\. Type: String
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EventSourceMappingConfiguration.md
e1fb60345df5-1
The Amazon Resource Name \(ARN\) of the event source\. Type: String Pattern: `arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)` Required: No **FunctionArn** <a name="SSS-Type-EventSourceMappingConfiguration-FunctionArn"></a> The ARN of the Lambda 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-_]+))?` Required: No **LastModified** <a name="SSS-Type-EventSourceMappingConfiguration-LastModified"></a> The date that the event source mapping was last updated, or its state changed, in Unix time seconds\. Type: Timestamp Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EventSourceMappingConfiguration.md
e1fb60345df5-2
The date that the event source mapping was last updated, or its state changed, in Unix time seconds\. Type: Timestamp Required: No **LastProcessingResult** <a name="SSS-Type-EventSourceMappingConfiguration-LastProcessingResult"></a> The result of the last AWS Lambda invocation of your Lambda function\. Type: String Required: No **MaximumBatchingWindowInSeconds** <a name="SSS-Type-EventSourceMappingConfiguration-MaximumBatchingWindowInSeconds"></a> \(Streams\) The maximum amount of time to gather records before invoking the function, in seconds\. The default value is zero\. Type: Integer Valid Range: Minimum value of 0\. Maximum value of 300\. Required: No **MaximumRecordAgeInSeconds** <a name="SSS-Type-EventSourceMappingConfiguration-MaximumRecordAgeInSeconds"></a> \(Streams\) Discard records older than the specified age\. The default value is infinite \(\-1\)\. When set to infinite \(\-1\), failed records are retried until the record expires\. Type: Integer Valid Range: Minimum value of 60\. Maximum value of 604800\. Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EventSourceMappingConfiguration.md
e1fb60345df5-3
Type: Integer Valid Range: Minimum value of 60\. Maximum value of 604800\. Required: No **MaximumRetryAttempts** <a name="SSS-Type-EventSourceMappingConfiguration-MaximumRetryAttempts"></a> \(Streams\) Discard records after the specified number of retries\. The default value is infinite \(\-1\)\. When set to infinite \(\-1\), failed records are retried until the record expires\. Type: Integer Valid Range: Minimum value of 0\. Maximum value of 10000\. Required: No **ParallelizationFactor** <a name="SSS-Type-EventSourceMappingConfiguration-ParallelizationFactor"></a> \(Streams\) The number of batches to process from each shard concurrently\. The default value is 1\. Type: Integer Valid Range: Minimum value of 1\. Maximum value of 10\. Required: No **State** <a name="SSS-Type-EventSourceMappingConfiguration-State"></a> The state of the event source mapping\. It can be one of the following: `Creating`, `Enabling`, `Enabled`, `Disabling`, `Disabled`, `Updating`, or `Deleting`\. Type: String Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EventSourceMappingConfiguration.md
e1fb60345df5-4
Type: String Required: No **StateTransitionReason** <a name="SSS-Type-EventSourceMappingConfiguration-StateTransitionReason"></a> Indicates whether the last change to the event source mapping was made by a user, or by the Lambda service\. Type: String Required: No **Topics** <a name="SSS-Type-EventSourceMappingConfiguration-Topics"></a> \(MSK\) The name of the Kafka topic\. Type: Array of strings Array Members: Fixed number of 1 item\. Length Constraints: Minimum length of 1\. Maximum length of 249\. Pattern: `^[^.]([a-zA-Z0-9\-_.]+)` Required: No **UUID** <a name="SSS-Type-EventSourceMappingConfiguration-UUID"></a> The identifier of the event source mapping\. Type: String Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EventSourceMappingConfiguration.md
7e117e22f654-0
For more information about using this API in one of the language\-specific AWS SDKs, see the following: + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/EventSourceMappingConfiguration) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/EventSourceMappingConfiguration) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/EventSourceMappingConfiguration) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/EventSourceMappingConfiguration)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EventSourceMappingConfiguration.md
de0c9488dcce-0
The following topics provide troubleshooting advice for errors and issues that you might encounter when using the Lambda API, console, or tools\. If you find an issue that is not listed here, you can use the **Feedback** button on this page to report it\. For more troubleshooting advice and answers to common support questions, visit the [AWS Knowledge Center](https://aws.amazon.com/premiumsupport/knowledge-center/#AWS_Lambda)\. **Topics** + [Troubleshoot deployment issues in AWS Lambda](troubleshooting-deployment.md) + [Troubleshoot invocation issues in AWS Lambda](troubleshooting-invocation.md) + [Troubleshoot execution issues in AWS Lambda](troubleshooting-execution.md) + [Troubleshoot networking issues in AWS Lambda](troubleshooting-networking.md)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/lambda-troubleshooting.md
a6ef20b999aa-0
AWS Identity and Access Management \(IAM\) is an AWS service that helps an administrator securely control access to AWS resources\. IAM administrators control who can be *authenticated* \(signed in\) and *authorized* \(have permissions\) to use Lambda resources\. IAM is an AWS service that you can use with no additional charge\. **Topics** + [Audience](#security_iam_audience) + [Authenticating with identities](#security_iam_authentication) + [Managing access using policies](#security_iam_access-manage) + [How AWS Lambda works with IAM](security_iam_service-with-iam.md) + [AWS Lambda identity\-based policy examples](security_iam_id-based-policy-examples.md) + [Troubleshooting AWS Lambda identity and access](security_iam_troubleshoot.md)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
daae046a9675-0
How you use AWS Identity and Access Management \(IAM\) differs, depending on the work you do in Lambda\. **Service user** – If you use the Lambda service to do your job, then your administrator provides you with the credentials and permissions that you need\. As you use more Lambda features to do your work, you might need additional permissions\. Understanding how access is managed can help you request the right permissions from your administrator\. If you cannot access a feature in Lambda, see [Troubleshooting AWS Lambda identity and access](security_iam_troubleshoot.md)\. **Service administrator** – If you're in charge of Lambda resources at your company, you probably have full access to Lambda\. It's your job to determine which Lambda features and resources your employees should access\. You must then submit requests to your IAM administrator to change the permissions of your service users\. Review the information on this page to understand the basic concepts of IAM\. To learn more about how your company can use IAM with Lambda, see [How AWS Lambda works with IAM](security_iam_service-with-iam.md)\. **IAM administrator** – If you're an IAM administrator, you might want to learn details about how you can write policies to manage access to Lambda\. To view example Lambda identity\-based policies that you can use in IAM, see [AWS Lambda identity\-based policy examples](security_iam_id-based-policy-examples.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
dc0d67657751-0
Authentication is how you sign in to AWS using your identity credentials\. For more information about signing in using the AWS Management Console, see [The IAM Console and Sign\-in Page](https://docs.aws.amazon.com/IAM/latest/UserGuide/console.html) in the *IAM User Guide*\. You must be *authenticated* \(signed in to AWS\) as the AWS account root user, an IAM user, or by assuming an IAM role\. You can also use your company's single sign\-on authentication, or even sign in using Google or Facebook\. In these cases, your administrator previously set up identity federation using IAM roles\. When you access AWS using credentials from another company, you are assuming a role indirectly\. To sign in directly to the [AWS Management Console](https://console.aws.amazon.com/), use your password with your root user email or your IAM user name\. You can access AWS programmatically using your root user or IAM user access keys\. AWS provides SDK and command line tools to cryptographically sign your request using your credentials\. If you don’t use AWS tools, you must sign the request yourself\. Do this using *Signature Version 4*, a protocol for authenticating inbound API requests\. For more information about authenticating requests, see [Signature Version 4 Signing Process](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) in the *AWS General Reference*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
dc0d67657751-1
Regardless of the authentication method that you use, you might also be required to provide additional security information\. For example, AWS recommends that you use multi\-factor authentication \(MFA\) to increase the security of your account\. To learn more, see [Using Multi\-Factor Authentication \(MFA\) in AWS](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
dcb4a3ac9f2a-0
When you first create an AWS account, you begin with a single sign\-in identity that has complete access to all AWS services and resources in the account\. This identity is called the AWS account *root user* and is accessed by signing in with the email address and password that you used to create the account\. We strongly recommend that you do not use the root user for your everyday tasks, even the administrative ones\. Instead, adhere to
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
dcb4a3ac9f2a-1
even the administrative ones\. Instead, adhere to the [best practice of using the root user only to create your first IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users)\. Then securely lock away the root user credentials and use them to perform only a few account and service management tasks\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
6fa7f0b83985-0
An *[IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html)* is an identity within your AWS account that has specific permissions for a single person or application\. An IAM user can have long\-term credentials such as a user name and password or a set of access keys\. To learn how to generate access keys, see [Managing Access Keys for IAM Users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) in the *IAM User Guide*\. When you generate access keys for an IAM user, make sure you view and securely save the key pair\. You cannot recover the secret access key in the future\. Instead, you must generate a new access key pair\. An [https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) is an identity that specifies a collection of IAM users\. You can't sign in as a group\. You can use groups to specify permissions for multiple users at a time\. Groups make permissions easier to manage for large sets of users\. For example, you could have a group named *IAMAdmins* and give that group permissions to administer IAM resources\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
6fa7f0b83985-1
Users are different from roles\. A user is uniquely associated with one person or application, but a role is intended to be assumable by anyone who needs it\. Users have permanent long\-term credentials, but roles provide temporary credentials\. To learn more, see [When to Create an IAM User \(Instead of a Role\)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id.html#id_which-to-choose) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
c0b836ee69ec-0
An *[IAM role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)* is an identity within your AWS account that has specific permissions\. It is similar to an IAM user, but is not associated with a specific person\. You can temporarily assume an IAM role in the AWS Management Console by [switching roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html)\. You can assume a role by calling an AWS CLI or AWS API operation or by using a custom URL\. For more information about methods for using roles, see [Using IAM Roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) in the *IAM User Guide*\. IAM roles with temporary credentials are useful in the following situations: + **Temporary IAM user permissions** – An IAM user can assume an IAM role to temporarily take on different permissions for a specific task\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
c0b836ee69ec-1
+ **Temporary IAM user permissions** – An IAM user can assume an IAM role to temporarily take on different permissions for a specific task\. + **Federated user access** – Instead of creating an IAM user, you can use existing identities from AWS Directory Service, your enterprise user directory, or a web identity provider\. These are known as *federated users*\. AWS assigns a role to a federated user when access is requested through an [identity provider](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers.html)\. For more information about federated users, see [Federated Users and Roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_access-management.html#intro-access-roles) in the *IAM User Guide*\. + **Cross\-account access** – You can use an IAM role to allow someone \(a trusted principal\) in a different account to access resources in your account\. Roles are the primary way to grant cross\-account access\. However, with some AWS services, you can attach a policy directly to a resource \(instead of using a role as a proxy\)\. To learn the difference between roles and resource\-based policies for cross\-account access, see [How IAM Roles Differ from Resource\-based Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_compare-resource-policies.html) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
c0b836ee69ec-2
+ **AWS service access** – A service role is an IAM role that a service assumes to perform actions in your account on your behalf\. When you set up some AWS service environments, you must define a role for the service to assume\. This service role must include all the permissions that are required for the service to access the AWS resources that it needs\. Service roles vary from service to service, but many allow you to choose your permissions as long as you meet the documented requirements for that service\. Service roles provide access only within your account and cannot be used to grant access to services in other accounts\. You can create, modify, and delete a service role from within IAM\. For example, you can create a role that allows Amazon Redshift to access an Amazon S3 bucket on your behalf and then load data from that bucket into an Amazon Redshift cluster\. For more information, see [Creating a Role to Delegate Permissions to an AWS Service](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-service.html) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
c0b836ee69ec-3
+ **Applications running on Amazon EC2** – You can use an IAM role to manage temporary credentials for applications that are running on an EC2 instance and making AWS CLI or AWS API requests\. This is preferable to storing access keys within the EC2 instance\. To assign an AWS role to an EC2 instance and make it available to all of its applications, you create an instance profile that is attached to the instance\. An instance profile contains the role and enables programs that are running on the EC2 instance to get temporary credentials\. For more information, see [Using an IAM Role to Grant Permissions to Applications Running on Amazon EC2 Instances](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html) in the *IAM User Guide*\. To learn whether to use IAM roles, see [When to Create an IAM Role \(Instead of a User\)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id.html#id_which-to-choose_role) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
f0ab3bae4a5e-0
You control access in AWS by creating policies and attaching them to IAM identities or AWS resources\. A policy is an object in AWS that, when associated with an identity or resource, defines their permissions\. AWS evaluates these policies when an entity \(root user, IAM user, or IAM role\) makes a request\. Permissions in the policies determine whether the request is allowed or denied\. Most policies are stored in AWS as JSON documents\. For more information about the structure and contents of JSON policy documents, see [Overview of JSON Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json) in the *IAM User Guide*\. An IAM administrator can use policies to specify who has access to AWS resources, and what actions they can perform on those resources\. Every IAM entity \(user or role\) starts with no permissions\. In other words, by default, users can do nothing, not even change their own password\. To give a user permission to do something, an administrator must attach a permissions policy to a user\. Or the administrator can add the user to a group that has the intended permissions\. When an administrator gives permissions to a group, all users in that group are granted those permissions\. IAM policies define permissions for an action regardless of the method that you use to perform the operation\. For example, suppose that you have a policy that allows the `iam:GetRole` action\. A user with that policy can get role information from the AWS Management Console, the AWS CLI, or the AWS API\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
58b6971f3b49-0
Identity\-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, role, or group\. These policies control what actions that identity can perform, on which resources, and under what conditions\. To learn how to create an identity\-based policy, see [Creating IAM Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html) in the *IAM User Guide*\. Identity\-based policies can be further categorized as *inline policies* or *managed policies*\. Inline policies are embedded directly into a single user, group, or role\. Managed policies are standalone policies that you can attach to multiple users, groups, and roles in your AWS account\. Managed policies include AWS managed policies and customer managed policies\. To learn how to choose between a managed policy or an inline policy, see [Choosing Between Managed Policies and Inline Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#choosing-managed-or-inline) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
dad09099e68c-0
Resource\-based policies are JSON policy documents that you attach to a resource such as an Amazon S3 bucket\. Service administrators can use these policies to define what actions a specified principal \(account member, user, or role\) can perform on that resource and under what conditions\. Resource\-based policies are inline policies\. There are no managed resource\-based policies\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
c29e0d7aeb24-0
Access control lists \(ACLs\) are a type of policy that controls which principals \(account members, users, or roles\) have permissions to access a resource\. ACLs are similar to resource\-based policies, although they do not use the JSON policy document format\. Amazon S3, AWS WAF, and Amazon VPC are examples of services that support ACLs\. To learn more about ACLs, see [Access Control List \(ACL\) Overview](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) in
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
c29e0d7aeb24-1
Overview](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) in the *Amazon Simple Storage Service Developer Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
ae1bde4c9f90-0
AWS supports additional, less\-common policy types\. These policy types can set the maximum permissions granted to you by the more common policy types\. + **Permissions boundaries** – A permissions boundary is an advanced feature in which you set the maximum permissions that an identity\-based policy can grant to an IAM entity \(IAM user or role\)\. You can set a permissions boundary for an entity\. The resulting permissions are the intersection of entity's identity\-based policies and its permissions boundaries\. Resource\-based policies that specify the user or role in the `Principal` field are not limited by the permissions boundary\. An explicit deny in any of these policies overrides the allow\. For more information about permissions boundaries, see [Permissions Boundaries for IAM Entities](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
ae1bde4c9f90-1
+ **Service control policies \(SCPs\)** – SCPs are JSON policies that specify the maximum permissions for an organization or organizational unit \(OU\) in AWS Organizations\. AWS Organizations is a service for grouping and centrally managing multiple AWS accounts that your business owns\. If you enable all features in an organization, then you can apply service control policies \(SCPs\) to any or all of your accounts\. The SCP limits permissions for entities in member accounts, including each AWS account root user\. For more information about Organizations and SCPs, see [How SCPs Work](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_about-scps.html) in the *AWS Organizations User Guide*\. + **Session policies** – Session policies are advanced policies that you pass as a parameter when you programmatically create a temporary session for a role or federated user\. The resulting session's permissions are the intersection of the user or role's identity\-based policies and the session policies\. Permissions can also come from a resource\-based policy\. An explicit deny in any of these policies overrides the allow\. For more information, see [Session Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
ed937d7846b7-0
When multiple types of policies apply to a request, the resulting permissions are more complicated to understand\. To learn how AWS determines whether to allow a request when multiple policy types are involved, see [Policy Evaluation Logic](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html) in the *IAM User Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-iam.md
6b4e1d267bd2-0
Details about a function's deployment package\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_FunctionCodeLocation.md
8ed6d8ebf1ee-0
**Location** <a name="SSS-Type-FunctionCodeLocation-Location"></a> A presigned URL that you can use to download the deployment package\. Type: String Required: No **RepositoryType** <a name="SSS-Type-FunctionCodeLocation-RepositoryType"></a> The service that's hosting the file\. Type: String Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_FunctionCodeLocation.md
aad5050da37f-0
For more information about using this API in one of the language\-specific AWS SDKs, see the following: + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/FunctionCodeLocation) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/FunctionCodeLocation) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/FunctionCodeLocation) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/FunctionCodeLocation)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_FunctionCodeLocation.md
e4dbb2bf4132-0
The results of an operation to update or read environment variables\. If the operation is successful, the response contains the environment variables\. If it failed, the response contains details about the error\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EnvironmentResponse.md
582267be8e67-0
**Error** <a name="SSS-Type-EnvironmentResponse-Error"></a> Error messages for environment variables that couldn't be applied\. Type: [EnvironmentError](API_EnvironmentError.md) object Required: No **Variables** <a name="SSS-Type-EnvironmentResponse-Variables"></a> Environment variable key\-value pairs\. Type: String to string map Key Pattern: `[a-zA-Z]([a-zA-Z0-9_])+` Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EnvironmentResponse.md
363df759048c-0
For more information about using this API in one of the language\-specific AWS SDKs, see the following: + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/EnvironmentResponse) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/EnvironmentResponse) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/EnvironmentResponse) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/EnvironmentResponse)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_EnvironmentResponse.md
8db1e63c6642-0
Deletes an [event source mapping](https://docs.aws.amazon.com/lambda/latest/dg/intro-invocation-modes.html)\. You can get the identifier of a mapping from the output of [ListEventSourceMappings](API_ListEventSourceMappings.md)\. When you delete an event source mapping, it enters a `Deleting` state and might not be completely deleted for several seconds\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
14e1a725e5d4-0
``` DELETE /2015-03-31/event-source-mappings/UUID HTTP/1.1 ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
353e88c48ac0-0
The request uses the following URI parameters\. ** [UUID](#API_DeleteEventSourceMapping_RequestSyntax) ** <a name="SSS-DeleteEventSourceMapping-request-UUID"></a> The identifier of the event source mapping\. Required: Yes
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
64eb73639bfb-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_DeleteEventSourceMapping.md
f73fa082452c-0
``` HTTP/1.1 202 Content-type: application/json { "BatchSize": number, "BisectBatchOnFunctionError": boolean, "DestinationConfig": { "OnFailure": { "Destination": "string" }, "OnSuccess": { "Destination": "string" } }, "EventSourceArn": "string", "FunctionArn": "string", "LastModified": number, "LastProcessingResult": "string", "MaximumBatchingWindowInSeconds": number, "MaximumRecordAgeInSeconds": number, "MaximumRetryAttempts": number, "ParallelizationFactor": number, "State": "string", "StateTransitionReason": "string", "Topics": [ "string" ], "UUID": "string" } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
aff8382af477-0
If the action is successful, the service sends back an HTTP 202 response\. The following data is returned in JSON format by the service\. ** [BatchSize](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-BatchSize"></a> The maximum number of items to retrieve in a single batch\. Type: Integer Valid Range: Minimum value of 1\. Maximum value of 10000\. ** [BisectBatchOnFunctionError](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-BisectBatchOnFunctionError"></a> \(Streams\) If the function returns an error, split the batch in two and retry\. The default value is false\. Type: Boolean ** [DestinationConfig](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-DestinationConfig"></a> \(Streams\) An Amazon SQS queue or Amazon SNS topic destination for discarded records\. Type: [DestinationConfig](API_DestinationConfig.md) object
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
aff8382af477-1
Type: [DestinationConfig](API_DestinationConfig.md) object ** [EventSourceArn](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-EventSourceArn"></a> The Amazon Resource Name \(ARN\) of the event source\. Type: String Pattern: `arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)` ** [FunctionArn](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-FunctionArn"></a> The ARN of the Lambda 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-_]+))?`
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
aff8382af477-2
** [LastModified](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-LastModified"></a> The date that the event source mapping was last updated, or its state changed, in Unix time seconds\. Type: Timestamp ** [LastProcessingResult](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-LastProcessingResult"></a> The result of the last AWS Lambda invocation of your Lambda function\. Type: String ** [MaximumBatchingWindowInSeconds](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-MaximumBatchingWindowInSeconds"></a> \(Streams\) The maximum amount of time to gather records before invoking the function, in seconds\. The default value is zero\. Type: Integer Valid Range: Minimum value of 0\. Maximum value of 300\. ** [MaximumRecordAgeInSeconds](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-MaximumRecordAgeInSeconds"></a>
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
aff8382af477-3
\(Streams\) Discard records older than the specified age\. The default value is infinite \(\-1\)\. When set to infinite \(\-1\), failed records are retried until the record expires\. Type: Integer Valid Range: Minimum value of 60\. Maximum value of 604800\. ** [MaximumRetryAttempts](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-MaximumRetryAttempts"></a> \(Streams\) Discard records after the specified number of retries\. The default value is infinite \(\-1\)\. When set to infinite \(\-1\), failed records are retried until the record expires\. Type: Integer Valid Range: Minimum value of 0\. Maximum value of 10000\. ** [ParallelizationFactor](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-ParallelizationFactor"></a> \(Streams\) The number of batches to process from each shard concurrently\. The default value is 1\. Type: Integer Valid Range: Minimum value of 1\. Maximum value of 10\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
aff8382af477-4
Type: Integer Valid Range: Minimum value of 1\. Maximum value of 10\. ** [State](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-State"></a> The state of the event source mapping\. It can be one of the following: `Creating`, `Enabling`, `Enabled`, `Disabling`, `Disabled`, `Updating`, or `Deleting`\. Type: String ** [StateTransitionReason](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-StateTransitionReason"></a> Indicates whether the last change to the event source mapping was made by a user, or by the Lambda service\. Type: String ** [Topics](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-Topics"></a> \(MSK\) The name of the Kafka topic\. Type: Array of strings Array Members: Fixed number of 1 item\. Length Constraints: Minimum length of 1\. Maximum length of 249\. Pattern: `^[^.]([a-zA-Z0-9\-_.]+)`
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
aff8382af477-5
Pattern: `^[^.]([a-zA-Z0-9\-_.]+)` ** [UUID](#API_DeleteEventSourceMapping_ResponseSyntax) ** <a name="SSS-DeleteEventSourceMapping-response-UUID"></a> The identifier of the event source mapping\. Type: String
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md
c9397e57dc61-0
**InvalidParameterValueException** One of the parameters in the request is invalid\. HTTP Status Code: 400 **ResourceInUseException** The operation conflicts with the resource's availability\. For example, you attempted to update an EventSource Mapping in CREATING, or tried to delete a EventSource mapping currently in the UPDATING state\. 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_DeleteEventSourceMapping.md
0decf549b55f-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/DeleteEventSourceMapping) + [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/DeleteEventSourceMapping) + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/DeleteEventSourceMapping) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/DeleteEventSourceMapping) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/DeleteEventSourceMapping) + [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/DeleteEventSourceMapping)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteEventSourceMapping.md