id
stringlengths
14
16
text
stringlengths
1
2.43k
source
stringlengths
99
229
7d432f291851-1
+ [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/GetFunctionConcurrency) + [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/GetFunctionConcurrency) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/GetFunctionConcurrency)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_GetFunctionConcurrency.md
a8d0e4a9094e-0
When Lambda runs your function, it passes context information by making a `$LambdaContext` variable available to the [handler](powershell-handler.md)\. This variable provides methods and properties with information about the invocation, function, and execution environment\. **Context properties** + `FunctionName` – The name of the Lambda function\. + `FunctionVersion` – The [version](configuration-versions.md) of the function\. + `InvokedFunctionArn` – The Amazon Resource Name \(ARN\) that's used to invoke the function\. Indicates if the invoker specified a version number or alias\. + `MemoryLimitInMB` – The amount of memory that's allocated for the function\. + `AwsRequestId` – The identifier of the invocation request\. + `LogGroupName` – The log group for the function\. + `LogStreamName` – The log stream for the function instance\. + `RemainingTime` – The number of milliseconds left before the execution times out\. + `Identity` – \(mobile apps\) Information about the Amazon Cognito identity that authorized the request\. + `ClientContext` – \(mobile apps\) Client context that's provided to Lambda by the client application\. + `Logger` – The [logger object](powershell-logging.md) for the function\. The following PowerShell code snippet shows a simple handler function that prints some of the context information\. ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/powershell-context.md
a8d0e4a9094e-1
The following PowerShell code snippet shows a simple handler function that prints some of the context information\. ``` #Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.618.0'} Write-Host 'Function name:' $LambdaContext.FunctionName Write-Host 'Remaining milliseconds:' $LambdaContext.RemainingTime.TotalMilliseconds Write-Host 'Log group name:' $LambdaContext.LogGroupName Write-Host 'Log stream name:' $LambdaContext.LogStreamName ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/powershell-context.md
75c734f40f12-0
A PowerShell Lambda deployment package is a ZIP file that contains your PowerShell script, PowerShell modules that are required for your PowerShell script, and the assemblies needed to host PowerShell Core\. The AWSLambdaPSCore module has the following new cmdlets to help author and publish PowerShell Lambda functions\. **AWSLambdaPSCore cmdlets** + **Get\-AWSPowerShellLambdaTemplate** – Returns a list of getting started templates\. + **New\-AWSPowerShellLambda** – Creates an initial PowerShell script based on a template\. + **Publish\-AWSPowerShellLambda** – Publishes a given PowerShell script to Lambda\. + **New\-AWSPowerShellLambdaPackage** – Creates a Lambda deployment package that can be used in a CI/CD system for deployment\. To help get started writing and invoking a PowerShell script with Lambda, you can use the `New-AWSPowerShellLambda` cmdlet to create a starter script based on a template\. You can use the `Publish-AWSPowerShellLambda` cmdlet to deploy your script to AWS Lambda\. Then you can test your script either through the command line or the console\. To create a new PowerShell script, upload it, and test it, follow this procedure: 1. Run the following command to view the list of available templates: ``` PS C:\> Get-AWSPowerShellLambdaTemplate
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/powershell-package.md
75c734f40f12-1
``` PS C:\> Get-AWSPowerShellLambdaTemplate Template Description -------- ----------- Basic Bare bones script CodeCommitTrigger Script to process AWS CodeCommit Triggers ... ``` 1. Run the following command to create a sample script based on the `Basic` template: ``` New-AWSPowerShellLambda -ScriptName MyFirstPSScript -Template Basic ``` A new file named `MyFirstPSScript.ps1` is created in a new subdirectory of the current directory\. The name of the directory is based on the `-ScriptName` parameter\. You can use the `-Directory` parameter to choose an alternative directory\. You can see that the new file has the following contents: ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/powershell-package.md
267483cff7ca-0
#Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.618.0'}
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/powershell-package.md
3fd490ee5b05-0
``` 1. To see how log messages from your PowerShell script are sent to CloudWatch Logs, uncomment the `Write-Host` line of the sample script\. To demonstrate how you can return data back from your Lambda functions, add a new line at the end of the script with `$PSVersionTable`\. This adds the `$PSVersionTable` to the PowerShell pipeline\. After the PowerShell script is complete, the last object in the PowerShell pipeline is the return data for the Lambda function\. `$PSVersionTable` is a PowerShell global variable that also provides information about the running environment\. After making these changes, the last two lines of the sample script look like this: ``` Write-Host (ConvertTo-Json -InputObject $LambdaInput -Compress -Depth 5) $PSVersionTable ``` 1. After editing the `MyFirstPSScript.ps1` file, change the directory to the script's location\. Then run the following command to publish the script to AWS Lambda: ``` Publish-AWSPowerShellLambda -ScriptPath .\MyFirstPSScript.ps1 -Name MyFirstPSScript -Region us-east-2 ``` Note that the `-Name` parameter specifies the Lambda function name, which appears in the Lambda console\. You can use this function to invoke your script manually\. 1. Invoke your function with the AWS CLI `invoke` command\. ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/powershell-package.md
3fd490ee5b05-1
1. Invoke your function with the AWS CLI `invoke` command\. ``` > aws lambda invoke --function-name MyFirstPSScript out ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/powershell-package.md
82164edb290d-0
You can use an AWS Lambda function to process records in an [Amazon DynamoDB stream](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html)\. With DynamoDB Streams, you can trigger a Lambda function to perform additional work each time a DynamoDB table is updated\. Lambda reads records from the stream and invokes your function [synchronously](invocation-sync.md) with an event that contains stream records\. Lambda reads records in batches and invokes your function to process records from the batch\. **Example DynamoDB Streams record event** ``` { "Records": [ { "eventID": "1", "eventVersion": "1.0", "dynamodb": { "Keys": { "Id": { "N": "101" } }, "NewImage": { "Message": { "S": "New item!" }, "Id": { "N": "101" } }, "StreamViewType": "NEW_AND_OLD_IMAGES", "SequenceNumber": "111", "SizeBytes": 26 }, "awsRegion": "us-west-2",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
82164edb290d-1
"SizeBytes": 26 }, "awsRegion": "us-west-2", "eventName": "INSERT", "eventSourceARN": eventsourcearn, "eventSource": "aws:dynamodb" }, { "eventID": "2", "eventVersion": "1.0", "dynamodb": { "OldImage": { "Message": { "S": "New item!" }, "Id": { "N": "101" } }, "SequenceNumber": "222", "Keys": { "Id": { "N": "101" } }, "SizeBytes": 59, "NewImage": { "Message": { "S": "This item has changed" }, "Id": { "N": "101" } }, "StreamViewType": "NEW_AND_OLD_IMAGES" }, "awsRegion": "us-west-2", "eventName": "MODIFY",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
82164edb290d-2
}, "awsRegion": "us-west-2", "eventName": "MODIFY", "eventSourceARN": sourcearn, "eventSource": "aws:dynamodb" } ``` Lambda polls shards in your DynamoDB stream for records at a base rate of 4 times per second\. When records are available, Lambda invokes your function and waits for the result\. If processing succeeds, Lambda resumes polling until it receives more records\. By default, Lambda invokes your function as soon as records are available in the stream\. If the batch that Lambda reads from the stream only has one record in it, Lambda sends only one record to the function\. To avoid invoking the function with a small number of records, you can tell the event source to buffer records for up to five minutes by configuring a *batch window*\. Before invoking the function, Lambda continues to read records from the stream until it has gathered a full batch, or until the batch window expires\. If your function returns an error, Lambda retries the batch until processing succeeds or the data expires\. To avoid stalled shards, you can configure the event source mapping to retry with a smaller batch size, limit the number of retries, or discard records that are too old\. To retain discarded events, you can configure the event source mapping to send details about failed batches to an SQS queue or SNS topic\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
82164edb290d-3
You can also increase concurrency by processing multiple batches from each shard in parallel\. Lambda can process up to 10 batches in each shard simultaneously\. If you increase the number of concurrent batches per shard, Lambda still ensures in\-order processing at the partition\-key level\. **Topics** + [Execution role permissions](#events-dynamodb-permissions) + [Configuring a stream as an event source](#services-dynamodb-eventsourcemapping) + [Event source mapping APIs](#services-dynamodb-api) + [Error handling](#services-dynamodb-errors) + [Amazon CloudWatch metrics](#events-dynamodb-metrics) + [Tutorial: Using AWS Lambda with Amazon DynamoDB streams](with-ddb-example.md) + [Sample function code](with-ddb-create-package.md) + [AWS SAM template for a DynamoDB application](kinesis-tutorial-spec.md)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
d7d4463ff1fb-0
Lambda needs the following permissions to manage resources related to your DynamoDB stream\. Add them to your function's execution role\. + [dynamodb:DescribeStream](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_DescribeStream.html) + [dynamodb:GetRecords](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_GetRecords.html) + [dynamodb:GetShardIterator](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_GetShardIterator.html) + [dynamodb:ListStreams](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_ListStreams.html) The `AWSLambdaDynamoDBExecutionRole` managed policy includes these permissions\. For more information, see [AWS Lambda execution role](lambda-intro-execution-role.md)\. To send records of failed batches to a queue or topic, your function needs additional permissions\. Each destination service requires a different permission, as follows: + **Amazon SQS** – [sqs:SendMessage](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
d7d4463ff1fb-1
+ **Amazon SNS** – [sns:Publish](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
47411121a29f-0
Create an event source mapping to tell Lambda to send records from your stream to a Lambda function\. You can create multiple event source mappings to process the same data with multiple Lambda functions, or to process items from multiple streams with a single function\. To configure your function to read from DynamoDB Streams in the Lambda console, create a **DynamoDB** trigger\. **To create a trigger** 1. Open the Lambda console [Functions page](https://console.aws.amazon.com/lambda/home#/functions)\. 1. Choose a function\. 1. Under **Designer**, choose **Add trigger**\. 1. Choose a trigger type\. 1. Configure the required options and then choose **Add**\. Lambda supports the following options for DynamoDB event sources\. **Event source options** + **DynamoDB table** – The DynamoDB table to read records from\. + **Batch size** – The number of records to send to the function in each batch, up to 1,000\. Lambda passes all of the records in the batch to the function in a single call, as long as the total size of the events doesn't exceed the [payload limit](gettingstarted-limits.md) for synchronous invocation \(6 MB\)\. + **Batch window** – Specify the maximum amount of time to gather records before invoking the function, in seconds\. + **Starting position** – Process only new records, or all existing records\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
47411121a29f-1
+ **Starting position** – Process only new records, or all existing records\. + **Latest** – Process new records that are added to the stream\. + **Trim horizon** – Process all records in the stream\. After processing any existing records, the function is caught up and continues to process new records\. + **On\-failure destination** – An SQS queue or SNS topic for records that can't be processed\. When Lambda discards a batch of records because it's too old or has exhausted all retries, it sends details about the batch to the queue or topic\. + **Retry attempts** – The maximum number of times that Lambda retries when the function returns an error\. This doesn't apply to service errors or throttles where the batch didn't reach the function\. + **Maximum age of record** – The maximum age of a record that Lambda sends to your function\. + **Split batch on error** – When the function returns an error, split the batch into two before retrying\. + **Concurrent batches per shard** – Process multiple batches from the same shard concurrently\. + **Enabled** – Set to true to enable the event source mapping\. Set to false to stop processing records\. Lambda keeps track of the last record processed and resumes processing from that point when the mapping is reenabled\. **Note** You are not charged for GetRecords API calls invoked by Lambda as part of DynamoDB triggers\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
47411121a29f-2
**Note** You are not charged for GetRecords API calls invoked by Lambda as part of DynamoDB triggers\. To manage the event source configuration later, choose the trigger in the designer\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
50ad17717e40-0
To manage event source mappings with the AWS CLI or AWS SDK, use the following API actions: + [CreateEventSourceMapping](API_CreateEventSourceMapping.md) + [ListEventSourceMappings](API_ListEventSourceMappings.md) + [GetEventSourceMapping](API_GetEventSourceMapping.md) + [UpdateEventSourceMapping](API_UpdateEventSourceMapping.md) + [DeleteEventSourceMapping](API_DeleteEventSourceMapping.md) The following example uses the AWS CLI to map a function named `my-function` to a DynamoDB stream that is specified by its Amazon Resource Name \(ARN\), with a batch size of 500\. ``` $ aws lambda create-event-source-mapping --function-name my-function --batch-size 500 --starting-position LATEST \ --event-source-arn arn:aws:dynamodb:us-east-2:123456789012:table/my-table/stream/2019-06-10T19:26:16.525 { "UUID": "14e0db71-5d35-4eb5-b481-8945cf9d10c2", "BatchSize": 500, "MaximumBatchingWindowInSeconds": 0,
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
50ad17717e40-1
"BatchSize": 500, "MaximumBatchingWindowInSeconds": 0, "ParallelizationFactor": 1, "EventSourceArn": "arn:aws:dynamodb:us-east-2:123456789012:table/my-table/stream/2019-06-10T19:26:16.525", "FunctionArn": "arn:aws:lambda:us-east-2:123456789012:function:my-function", "LastModified": 1560209851.963, "LastProcessingResult": "No records processed", "State": "Creating", "StateTransitionReason": "User action", "DestinationConfig": {}, "MaximumRecordAgeInSeconds": 604800, "BisectBatchOnFunctionError": false, "MaximumRetryAttempts": 10000 } ``` Configure additional options to customize how batches are processed and to specify when to discard records that can't be processed\. The following example updates an event source mapping to send a failure record to an SQS queue after two retry attempts, or if the records are more than an hour old\. ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
50ad17717e40-2
``` $ aws lambda update-event-source-mapping --uuid f89f8514-cdd9-4602-9e1f-01a5b77d449b \ --maximum-retry-attempts 2 --maximum-record-age-in-seconds 3600 --destination-config '{"OnFailure": {"Destination": "arn:aws:sqs:us-east-2:123456789012:dlq"}}' { "UUID": "f89f8514-cdd9-4602-9e1f-01a5b77d449b", "BatchSize": 100, "MaximumBatchingWindowInSeconds": 0, "ParallelizationFactor": 1, "EventSourceArn": "arn:aws:dynamodb:us-east-2:123456789012:table/my-table/stream/2019-06-10T19:26:16.525", "FunctionArn": "arn:aws:lambda:us-east-2:123456789012:function:my-function", "LastModified": 1573243620.0, "LastProcessingResult": "PROBLEM: Function call failed", "State": "Updating", "StateTransitionReason": "User action",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
50ad17717e40-3
"State": "Updating", "StateTransitionReason": "User action", "DestinationConfig": {}, "MaximumRecordAgeInSeconds": 604800, "BisectBatchOnFunctionError": false, "MaximumRetryAttempts": 10000 } ``` Updated settings are applied asynchronously and aren't reflected in the output until the process completes\. Use the `get-event-source-mapping` command to view the current status\. ``` $ aws lambda get-event-source-mapping --uuid f89f8514-cdd9-4602-9e1f-01a5b77d449b { "UUID": "f89f8514-cdd9-4602-9e1f-01a5b77d449b", "BatchSize": 100, "MaximumBatchingWindowInSeconds": 0, "ParallelizationFactor": 1, "EventSourceArn": "arn:aws:dynamodb:us-east-2:123456789012:table/my-table/stream/2019-06-10T19:26:16.525", "FunctionArn": "arn:aws:lambda:us-east-2:123456789012:function:my-function",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
50ad17717e40-4
"FunctionArn": "arn:aws:lambda:us-east-2:123456789012:function:my-function", "LastModified": 1573244760.0, "LastProcessingResult": "PROBLEM: Function call failed", "State": "Enabled", "StateTransitionReason": "User action", "DestinationConfig": { "OnFailure": { "Destination": "arn:aws:sqs:us-east-2:123456789012:dlq" } }, "MaximumRecordAgeInSeconds": 3600, "BisectBatchOnFunctionError": false, "MaximumRetryAttempts": 2 } ``` To process multiple batches concurrently, use the `--parallelization-factor` option\. ``` $ aws lambda update-event-source-mapping --uuid 2b733gdc-8ac3-cdf5-af3a-1827b3b11284 \ --parallelization-factor 5 ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
c2ffb27aa269-0
The event source mapping that reads records from your DynamoDB stream invokes your function synchronously and retries on errors\. If the function is throttled or the Lambda service returns an error without invoking the function, Lambda retries until the records expire or exceed the maximum age that you configure on the event source mapping\. If the function receives the records but returns an error, Lambda retries until the records in the batch expire, exceed the maximum age, or reach the configured retry quota\. For function errors, you can also configure the event source mapping to split a failed batch into two batches\. Retrying with smaller batches isolates bad records and works around timeout issues\. Splitting a batch does not count towards the retry quota\. If the error handling measures fail, Lambda discards the records and continues processing batches from the stream\. With the default settings, this means that a bad record can block processing on the affected shard for up to one day\. To avoid this, configure your function's event source mapping with a reasonable number of retries and a maximum record age that fits your use case\. To retain a record of discarded batches, configure a failed\-event destination\. Lambda sends a document to the destination queue or topic with details about the batch\. **To configure a destination for failed\-event records** 1. Open the Lambda console [Functions page](https://console.aws.amazon.com/lambda/home#/functions)\. 1. Choose a function\. 1. Under **Designer**, choose **Add destination**\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
c2ffb27aa269-1
1. Choose a function\. 1. Under **Designer**, choose **Add destination**\. 1. For **Source**, choose **Stream invocation**\. 1. For **Stream**, choose a stream that is mapped to the function\. 1. For **Destination type**, choose the type of resource that receives the invocation record\. 1. For **Destination**, choose a resource\. 1. Choose **Save**\. The following example shows an invocation record for a DynamoDB stream\. **Example Invocation Record** ``` { "requestContext": { "requestId": "316aa6d0-8154-xmpl-9af7-85d5f4a6bc81", "functionArn": "arn:aws:lambda:us-east-2:123456789012:function:myfunction", "condition": "RetryAttemptsExhausted", "approximateInvokeCount": 1 }, "responseContext": { "statusCode": 200, "executedVersion": "$LATEST", "functionError": "Unhandled" }, "version": "1.0",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
c2ffb27aa269-2
"functionError": "Unhandled" }, "version": "1.0", "timestamp": "2019-11-14T00:13:49.717Z", "DDBStreamBatchInfo": { "shardId": "shardId-00000001573689847184-864758bb", "startSequenceNumber": "800000000003126276362", "endSequenceNumber": "800000000003126276362", "approximateArrivalOfFirstRecord": "2019-11-14T00:13:19Z", "approximateArrivalOfLastRecord": "2019-11-14T00:13:19Z", "batchSize": 1, "streamArn": "arn:aws:dynamodb:us-east-2:123456789012:table/mytable/stream/2019-11-14T00:04:06.388" } } ``` You can use this information to retrieve the affected records from the stream for troubleshooting\. The actual records aren't included, so you must process this record and retrieve them from the stream before they expire and are lost\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
92d6c7c3a6b1-0
Lambda emits the `IteratorAge` metric when your function finishes processing a batch of records\. The metric indicates how old the last record in the batch was when processing finished\. If your function is processing new events, you can use the iterator age to estimate the latency between when a record is added and when the function processes it\. An increasing trend in iterator age can indicate issues with your function\. For more information, see [Working with AWS Lambda function metrics](monitoring-metrics.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb.md
b387d4adbf21-0
Retrieves a list of provisioned concurrency configurations for a function\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListProvisionedConcurrencyConfigs.md
a44cf20aea53-0
``` GET /2019-09-30/functions/FunctionName/provisioned-concurrency?List=ALL&Marker=Marker&MaxItems=MaxItems HTTP/1.1 ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListProvisionedConcurrencyConfigs.md
b1aa52c2dee5-0
The request uses the following URI parameters\. ** [FunctionName](#API_ListProvisionedConcurrencyConfigs_RequestSyntax) ** <a name="SSS-ListProvisionedConcurrencyConfigs-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_ListProvisionedConcurrencyConfigs.md
b1aa52c2dee5-1
Required: Yes ** [Marker](#API_ListProvisionedConcurrencyConfigs_RequestSyntax) ** <a name="SSS-ListProvisionedConcurrencyConfigs-request-Marker"></a> Specify the pagination token that's returned by a previous request to retrieve the next page of results\. ** [MaxItems](#API_ListProvisionedConcurrencyConfigs_RequestSyntax) ** <a name="SSS-ListProvisionedConcurrencyConfigs-request-MaxItems"></a> Specify a number to limit the number of configurations returned\. 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_ListProvisionedConcurrencyConfigs.md
d5e7ef15bc62-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_ListProvisionedConcurrencyConfigs.md
14603e5bd645-0
``` HTTP/1.1 200 Content-type: application/json { "NextMarker": "string", "ProvisionedConcurrencyConfigs": [ { "AllocatedProvisionedConcurrentExecutions": number, "AvailableProvisionedConcurrentExecutions": number, "FunctionArn": "string", "LastModified": "string", "RequestedProvisionedConcurrentExecutions": number, "Status": "string", "StatusReason": "string" } ] } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListProvisionedConcurrencyConfigs.md
d6e325abc02c-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\. ** [NextMarker](#API_ListProvisionedConcurrencyConfigs_ResponseSyntax) ** <a name="SSS-ListProvisionedConcurrencyConfigs-response-NextMarker"></a> The pagination token that's included if more results are available\. Type: String ** [ProvisionedConcurrencyConfigs](#API_ListProvisionedConcurrencyConfigs_ResponseSyntax) ** <a name="SSS-ListProvisionedConcurrencyConfigs-response-ProvisionedConcurrencyConfigs"></a> A list of provisioned concurrency configurations\. Type: Array of [ProvisionedConcurrencyConfigListItem](API_ProvisionedConcurrencyConfigListItem.md) objects
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListProvisionedConcurrencyConfigs.md
37c62070ca32-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_ListProvisionedConcurrencyConfigs.md
23843ea1d5f9-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/ListProvisionedConcurrencyConfigs) + [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/ListProvisionedConcurrencyConfigs) + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/ListProvisionedConcurrencyConfigs) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/ListProvisionedConcurrencyConfigs) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/ListProvisionedConcurrencyConfigs) + [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/ListProvisionedConcurrencyConfigs)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListProvisionedConcurrencyConfigs.md
23843ea1d5f9-1
+ [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/ListProvisionedConcurrencyConfigs) + [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/ListProvisionedConcurrencyConfigs) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/ListProvisionedConcurrencyConfigs)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_ListProvisionedConcurrencyConfigs.md
73f1636f6423-0
**ReservedConcurrentExecutions** <a name="SSS-Type-Concurrency-ReservedConcurrentExecutions"></a> The number of concurrent executions that are reserved for this function\. For more information, see [Managing Concurrency](https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html)\. Type: Integer Valid Range: Minimum value of 0\. Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_Concurrency.md
4e7f31ae2b9e-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/Concurrency) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/Concurrency) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/Concurrency) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/Concurrency)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_Concurrency.md
5570a013d081-0
Third\-party auditors assess the security and compliance of AWS Lambda as part of multiple AWS compliance programs\. These include SOC, PCI, FedRAMP, HIPAA, and others\. For a list of AWS services in scope of specific compliance programs, see [AWS services in scope by compliance program](http://aws.amazon.com/compliance/services-in-scope/)\. For general information, see [AWS compliance programs](http://aws.amazon.com/compliance/programs/)\. You can download third\-party audit reports using AWS Artifact\. For more information, see [Downloading reports in AWS artifact](https://docs.aws.amazon.com/artifact/latest/ug/downloading-documents.html)\. Your compliance responsibility when using Lambda is determined by the sensitivity of your data, your company's compliance objectives, and applicable laws and regulations\. AWS provides the following resources to help with compliance: + [Security and compliance quick start guides](http://aws.amazon.com/quickstart/?awsf.quickstart-homepage-filter=categories%23security-identity-compliance) – These deployment guides discuss architectural considerations and provide steps for deploying security\- and compliance\-focused baseline environments on AWS\. + [Architecting for HIPAA security and compliance whitepaper ](https://d0.awsstatic.com/whitepapers/compliance/AWS_HIPAA_Compliance_Whitepaper.pdf) – This whitepaper describes how companies can use AWS to create HIPAA\-compliant applications\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-compliance.md
5570a013d081-1
+ [AWS compliance resources](http://aws.amazon.com/compliance/resources/) – This collection of workbooks and guides might apply to your industry and location\. + [AWS Config](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html) – This AWS service assesses how well your resource configurations comply with internal practices, industry guidelines, and regulations\. + [AWS Security Hub](https://docs.aws.amazon.com/securityhub/latest/userguide/what-is-securityhub.html) – This AWS service provides a comprehensive view of your security state within AWS that helps you check your compliance with security industry standards and best practices\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-compliance.md
74a6d1143728-0
When you invoke a function synchronously, Lambda runs the function and waits for a response\. When the function execution ends, Lambda returns the response from the function's code with additional data, such as the version of the function that was executed\. To invoke a function synchronously with the AWS CLI, use the `invoke` command\. ``` $ aws lambda invoke --function-name my-function --payload '{ "key": "value" }' response.json { "ExecutedVersion": "$LATEST", "StatusCode": 200 } ``` The following diagram shows clients invoking a Lambda function synchronously\. Lambda sends the events directly to the function and sends the function's response back to the invoker\. ![\[\]](http://docs.aws.amazon.com/lambda/latest/dg/images/invocation-sync.png) The `payload` is a string that contains an event in JSON format\. The name of the file where the AWS CLI writes the response from the function is `response.json`\. If the function returns an object or error, the response is the object or error in JSON format\. If the function exits without error, the response is `null`\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/invocation-sync.md
74a6d1143728-1
The output from the command, which is displayed in the terminal, includes information from headers in the response from Lambda\. This includes the version that processed the event \(useful when you use [aliases](configuration-aliases.md)\), and the status code returned by Lambda\. If Lambda was able to run the function, the status code is 200, even if the function returned an error\. **Note** For functions with a long timeout, your client might be disconnected during synchronous invocation while it waits for a response\. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep\-alive settings\. If Lambda isn't able to run the function, the error is displayed in the output\. ``` $ aws lambda invoke --function-name my-function --payload value response.json An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Unrecognized token 'value': was expecting ('true', 'false' or 'null') at [Source: (byte[])"value"; line: 1, column: 11] ``` 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\. ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/invocation-sync.md
74a6d1143728-2
``` $ 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 "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
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/invocation-sync.md
74a6d1143728-3
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`\. For more information about the `Invoke` API, including a full list of parameters, headers, and errors, see [Invoke](API_Invoke.md)\. When you invoke a function directly, you can check the response for errors and retry\. The AWS CLI and AWS SDK also automatically retry on client timeouts, throttling, and service errors\. For more information, see [Error handling and automatic retries in AWS Lambda](invocation-retries.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/invocation-sync.md
27d825457342-0
Below is a sample AWS SAM template for the Lambda application from the [tutorial](services-apigateway-tutorial.md)\. Copy the text below to a file and save it next to the ZIP package you created previously\. Note that the `Handler` and `Runtime` parameter values should match the ones you used when you created the function in the previous section\. **Example template\.yaml** ``` AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Resources: LambdaFunctionOverHttps: Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html) Properties: Handler: index.handler Runtime: nodejs12.x Policies: AmazonDynamoDBFullAccess Events: HttpPost: Type: Api Properties: Path: '/DynamoDBOperations/DynamoDBManager' Method: post ``` For information on how to package and deploy your serverless application using the package and deploy commands, see [Deploying serverless applications](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-deploying.html) in the *AWS Serverless Application Model Developer Guide*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-apigateway-template.md
67c4f6f9ca3c-0
Creates a [version](https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html) from the current code and configuration of a function\. Use versions to create a snapshot of your function code and configuration that doesn't change\. AWS Lambda doesn't publish a version if the function's configuration and code haven't changed since the last version\. Use [UpdateFunctionCode](API_UpdateFunctionCode.md) or [UpdateFunctionConfiguration](API_UpdateFunctionConfiguration.md) to update the function before publishing a version\. Clients can invoke versions directly or with an alias\. To create an alias, use [CreateAlias](API_CreateAlias.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
0c7be235c115-0
``` POST /2015-03-31/functions/FunctionName/versions HTTP/1.1 Content-type: application/json { "CodeSha256": "string", "Description": "string", "RevisionId": "string" } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
c7b9437f874c-0
The request uses the following URI parameters\. ** [FunctionName](#API_PublishVersion_RequestSyntax) ** <a name="SSS-PublishVersion-request-FunctionName"></a> The name of the Lambda function\. **Name formats** + **Function name** \- `MyFunction`\. + **Function ARN** \- `arn:aws:lambda:us-west-2:123456789012:function:MyFunction`\. + **Partial ARN** \- `123456789012:function:MyFunction`\. 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_PublishVersion.md
3be0f2592679-0
The request accepts the following data in JSON format\. ** [CodeSha256](#API_PublishVersion_RequestSyntax) ** <a name="SSS-PublishVersion-request-CodeSha256"></a> Only publish a version if the hash value matches the value that's specified\. Use this option to avoid publishing a version if the function code has changed since you last updated it\. You can get the hash for the version that you uploaded from the output of [UpdateFunctionCode](API_UpdateFunctionCode.md)\. Type: String Required: No ** [Description](#API_PublishVersion_RequestSyntax) ** <a name="SSS-PublishVersion-request-Description"></a> A description for the version to override the description in the function configuration\. Type: String Length Constraints: Minimum length of 0\. Maximum length of 256\. Required: No ** [RevisionId](#API_PublishVersion_RequestSyntax) ** <a name="SSS-PublishVersion-request-RevisionId"></a> Only update the function if the revision ID matches the ID that's specified\. Use this option to avoid publishing a version if the function configuration has changed since you last updated it\. Type: String Required: No
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
2d33bec638cd-0
``` HTTP/1.1 201 Content-type: application/json { "CodeSha256": "string", "CodeSize": number, "DeadLetterConfig": { "TargetArn": "string" }, "Description": "string", "Environment": { "Error": { "ErrorCode": "string", "Message": "string" }, "Variables": { "string" : "string" } }, "FileSystemConfigs": [ { "Arn": "string", "LocalMountPath": "string" } ], "FunctionArn": "string", "FunctionName": "string", "Handler": "string", "KMSKeyArn": "string", "LastModified": "string", "LastUpdateStatus": "string", "LastUpdateStatusReason": "string", "LastUpdateStatusReasonCode": "string", "Layers": [ { "Arn": "string", "CodeSize": number
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
2d33bec638cd-1
"Layers": [ { "Arn": "string", "CodeSize": number } ], "MasterArn": "string", "MemorySize": number, "RevisionId": "string", "Role": "string", "Runtime": "string", "State": "string", "StateReason": "string", "StateReasonCode": "string", "Timeout": number, "TracingConfig": { "Mode": "string" }, "Version": "string", "VpcConfig": { "SecurityGroupIds": [ "string" ], "SubnetIds": [ "string" ], "VpcId": "string" } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
9975839529ac-0
If the action is successful, the service sends back an HTTP 201 response\. The following data is returned in JSON format by the service\. ** [CodeSha256](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-CodeSha256"></a> The SHA256 hash of the function's deployment package\. Type: String ** [CodeSize](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-CodeSize"></a> The size of the function's deployment package, in bytes\. Type: Long ** [DeadLetterConfig](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-DeadLetterConfig"></a> The function's dead letter queue\. Type: [DeadLetterConfig](API_DeadLetterConfig.md) object ** [Description](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-Description"></a> The function's description\. Type: String Length Constraints: Minimum length of 0\. Maximum length of 256\. ** [Environment](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-Environment"></a>
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
9975839529ac-1
The function's environment variables\. Type: [EnvironmentResponse](API_EnvironmentResponse.md) object ** [FileSystemConfigs](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-FileSystemConfigs"></a> Connection settings for an Amazon EFS file system\. Type: Array of [FileSystemConfig](API_FileSystemConfig.md) objects Array Members: Maximum number of 1 item\. ** [FunctionArn](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-FunctionArn"></a> The function's Amazon Resource Name \(ARN\)\. 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-_]+))?` ** [FunctionName](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-FunctionName"></a> The name of the function\. Type: String Length Constraints: Minimum length of 1\. Maximum length of 170\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
9975839529ac-2
The name of the function\. Type: String Length Constraints: Minimum length of 1\. Maximum length of 170\. 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-_]+))?` ** [Handler](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-Handler"></a> The function that Lambda calls to begin executing your function\. Type: String Length Constraints: Maximum length of 128\. Pattern: `[^\s]+` ** [KMSKeyArn](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-KMSKeyArn"></a> The KMS key that's used to encrypt the function's environment variables\. This key is only returned if you've configured a customer managed CMK\. Type: String Pattern: `(arn:(aws[a-zA-Z-]*)?:[a-z0-9-.]+:.*)|()`
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
9975839529ac-3
** [LastModified](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-LastModified"></a> The date and time that the function was last updated, in [ISO\-8601 format](https://www.w3.org/TR/NOTE-datetime) \(YYYY\-MM\-DDThh:mm:ss\.sTZD\)\. Type: String ** [LastUpdateStatus](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-LastUpdateStatus"></a> The status of the last update that was performed on the function\. This is first set to `Successful` after function creation completes\. Type: String Valid Values:` Successful | Failed | InProgress` ** [LastUpdateStatusReason](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-LastUpdateStatusReason"></a> The reason for the last update that was performed on the function\. Type: String ** [LastUpdateStatusReasonCode](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-LastUpdateStatusReasonCode"></a> The reason code for the last update that was performed on the function\. Type: String
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
9975839529ac-4
The reason code for the last update that was performed on the function\. Type: String Valid Values:` EniLimitExceeded | InsufficientRolePermissions | InvalidConfiguration | InternalError | SubnetOutOfIPAddresses | InvalidSubnet | InvalidSecurityGroup` ** [Layers](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-Layers"></a> The function's [ layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html)\. Type: Array of [Layer](API_Layer.md) objects ** [MasterArn](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-MasterArn"></a> For Lambda@Edge functions, the ARN of the master 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-_]+))?` ** [MemorySize](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-MemorySize"></a>
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
9975839529ac-5
The memory that's allocated to the function\. Type: Integer Valid Range: Minimum value of 128\. Maximum value of 3008\. ** [RevisionId](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-RevisionId"></a> The latest updated revision of the function or alias\. Type: String ** [Role](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-Role"></a> The function's execution role\. Type: String Pattern: `arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+` ** [Runtime](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-Runtime"></a> The runtime environment for the Lambda function\. Type: String 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`
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
9975839529ac-6
** [State](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-State"></a> The current state of the function\. When the state is `Inactive`, you can reactivate the function by invoking it\. Type: String Valid Values:` Pending | Active | Inactive | Failed` ** [StateReason](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-StateReason"></a> The reason for the function's current state\. Type: String ** [StateReasonCode](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-StateReasonCode"></a> The reason code for the function's current state\. When the code is `Creating`, you can't invoke or modify the function\. Type: String Valid Values:` Idle | Creating | Restoring | EniLimitExceeded | InsufficientRolePermissions | InvalidConfiguration | InternalError | SubnetOutOfIPAddresses | InvalidSubnet | InvalidSecurityGroup` ** [Timeout](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-Timeout"></a> The amount of time in seconds that Lambda allows a function to run before stopping it\. Type: Integer
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
9975839529ac-7
The amount of time in seconds that Lambda allows a function to run before stopping it\. Type: Integer Valid Range: Minimum value of 1\. ** [TracingConfig](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-TracingConfig"></a> The function's AWS X\-Ray tracing configuration\. Type: [TracingConfigResponse](API_TracingConfigResponse.md) object ** [Version](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-Version"></a> The version of the Lambda function\. Type: String Length Constraints: Minimum length of 1\. Maximum length of 1024\. Pattern: `(\$LATEST|[0-9]+)` ** [VpcConfig](#API_PublishVersion_ResponseSyntax) ** <a name="SSS-PublishVersion-response-VpcConfig"></a> The function's networking configuration\. Type: [VpcConfigResponse](API_VpcConfigResponse.md) object
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
f0603443263c-0
**CodeStorageExceededException** You have exceeded your maximum total code size per account\. [Learn more](https://docs.aws.amazon.com/lambda/latest/dg/limits.html) HTTP Status Code: 400 **InvalidParameterValueException** One of the parameters in the request is invalid\. HTTP Status Code: 400 **PreconditionFailedException** The RevisionId provided does not match the latest RevisionId for the Lambda function or alias\. Call the `GetFunction` or the `GetAlias` API to retrieve the latest RevisionId for your resource\. HTTP Status Code: 412 **ResourceConflictException** The resource already exists, or another operation is in progress\. HTTP Status Code: 409 **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_PublishVersion.md
7ca3f3830532-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/PublishVersion) + [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/PublishVersion) + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/PublishVersion) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/PublishVersion) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/PublishVersion) + [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/PublishVersion) + [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/PublishVersion)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
7ca3f3830532-1
+ [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/PublishVersion) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/PublishVersion)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_PublishVersion.md
21f79ccb6c7e-0
When Lambda runs your function, it passes a context object to the [handler](python-handler.md)\. This object provides methods and properties that provide information about the invocation, function, and execution environment\. **Context methods** + `get_remaining_time_in_millis` – Returns the number of milliseconds left before the execution times out\. **Context properties** + `function_name` – The name of the Lambda function\. + `function_version` – The [version](configuration-versions.md) of the function\. + `invoked_function_arn` – The Amazon Resource Name \(ARN\) that's used to invoke the function\. Indicates if the invoker specified a version number or alias\. + `memory_limit_in_mb` – The amount of memory that's allocated for the function\. + `aws_request_id` – The identifier of the invocation request\. + `log_group_name` – The log group for the function\. + `log_stream_name` – The log stream for the function instance\. + `identity` – \(mobile apps\) Information about the Amazon Cognito identity that authorized the request\. + `cognito_identity_id` – The authenticated Amazon Cognito identity\. + `cognito_identity_pool_id` – The Amazon Cognito identity pool that authorized the invocation\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/python-context.md
21f79ccb6c7e-1
+ `cognito_identity_pool_id` – The Amazon Cognito identity pool that authorized the invocation\. + `client_context` – \(mobile apps\) Client context that's provided to Lambda by the client application\. + `client.installation_id` + `client.app_title` + `client.app_version_name` + `client.app_version_code` + `client.app_package_name` + `custom` – A `dict` of custom values set by the mobile client application\. + `env` – A `dict` of environment information provided by the AWS SDK\. The following example shows a handler function that logs context information\. **Example handler\.py** ``` import time def get_my_log_stream(event, context): print("Log stream name:", context.log_stream_name) print("Log group name:", context.log_group_name) print("Request ID:",context.aws_request_id) print("Mem. limits(MB):", context.memory_limit_in_mb)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/python-context.md
49fdea84bb1f-0
time.sleep(1) print("Time remaining (MS):", context.get_remaining_time_in_millis()) ``` In addition to the options listed above, you can also use the AWS X\-Ray SDK for [Instrumenting Python code in AWS Lambda](python-tracing.md) to identify critical code paths, trace their performance and capture the data for analysis\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/python-context.md
0f0feff98adb-0
The AWS global infrastructure is built around AWS Regions and Availability Zones\. AWS Regions provide multiple physically separated and isolated Availability Zones, which are connected with low\-latency, high\-throughput, and highly redundant networking\. With Availability Zones, you can design and operate applications and databases that automatically fail over between Availability Zones without interruption\. Availability Zones are more highly available, fault tolerant, and scalable than traditional single or multiple data center infrastructures\. For more information about AWS Regions and Availability Zones, see [AWS global infrastructure](http://aws.amazon.com/about-aws/global-infrastructure/)\. In addition to the AWS global infrastructure, Lambda offers several features to help support your data resiliency and backup needs\. + **Versioning** – You can use versioning in Lambda to save your function's code and configuration as you develop it\. Together with aliases, you can use versioning to perform blue/green and rolling deployments\. For details, see [Lambda function versions](configuration-versions.md)\. + **Scaling** – When your function receives a request while it's processing a previous request, Lambda launches another instance of your function to handle the increased load\. Lambda automatically scales to handle 1,000 concurrent executions per Region, a [quota](gettingstarted-limits.md) that can be increased if needed\. For details, see [AWS Lambda function scaling](invocation-scaling.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-resilience.md
0f0feff98adb-1
+ **High availability** – Lambda runs your function in multiple Availability Zones to ensure that it is available to process events in case of a service interruption in a single zone\. If you configure your function to connect to a virtual private cloud \(VPC\) in your account, specify subnets in multiple Availability Zones to ensure high availability\. For details, see [Configuring a Lambda function to access resources in a VPC](configuration-vpc.md)\. + **Reserved concurrency** – To make sure that your function can always scale to handle additional requests, you can reserve concurrency for it\. Setting reserved concurrency for a function ensures that it can scale to, but not exceed, a specified number of concurrent invocations\. This ensures that you don't lose requests due to other functions consuming all of the available concurrency\. For details, see [Managing concurrency for a Lambda function](configuration-concurrency.md)\. + **Retries** – For asynchronous invocations and a subset of invocations triggered by other services, Lambda automatically retries on error with delays between retries\. Other clients and AWS services that invoke functions synchronously are responsible for performing retries\. For details, see [Error handling and automatic retries in AWS Lambda](invocation-retries.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-resilience.md
0f0feff98adb-2
+ **Dead\-letter queue** – For asynchronous invocations, you can configure Lambda to send requests to a dead\-letter queue if all retries fail\. A dead\-letter queue is an Amazon SNS topic or Amazon SQS queue that receives events for troubleshooting or reprocessing\. For details, see [AWS Lambda function dead\-letter queues](invocation-async.md#dlq)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/security-resilience.md
63b8ab109065-0
When Lambda runs your function, it passes a context object to the [handler](java-handler.md)\. This object provides methods and properties that provide information about the invocation, function, and execution environment\. **Context methods** + `getRemainingTimeInMillis()` – Returns the number of milliseconds left before the execution times out\. + `getFunctionName()` – Returns the name of the Lambda function\. + `getFunctionVersion()` – Returns the [version](configuration-versions.md) of the function\. + `getInvokedFunctionArn()` – Returns the Amazon Resource Name \(ARN\) that's used to invoke the function\. Indicates if the invoker specified a version number or alias\. + `getMemoryLimitInMB()` – Returns the amount of memory that's allocated for the function\. + `getAwsRequestId()` – Returns the identifier of the invocation request\. + `getLogGroupName()` – Returns the log group for the function\. + `getLogStreamName()` – Returns the log stream for the function instance\. + `getIdentity()` – \(mobile apps\) Returns information about the Amazon Cognito identity that authorized the request\. + `getClientContext()` – \(mobile apps\) Returns the client context that's provided to Lambda by the client application\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-context.md
63b8ab109065-1
+ `getClientContext()` – \(mobile apps\) Returns the client context that's provided to Lambda by the client application\. + `getLogger()` – Returns the [logger object](java-logging.md) for the function\. The following example shows a function that uses the context object to access the Lambda logger\. **Example [Handler\.java](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/java-basic/src/main/java/example/Handler.java)** ``` package example; import [com\.amazonaws\.services\.lambda\.runtime\.Context](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/Context.java) import [com\.amazonaws\.services\.lambda\.runtime\.RequestHandler](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/RequestHandler.java)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-context.md
63b8ab109065-2
import [com\.amazonaws\.services\.lambda\.runtime\.LambdaLogger](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/LambdaLogger.java) ... // Handler value: example.Handler public class Handler implements RequestHandler<Map<String,String>, String>{ Gson gson = new GsonBuilder().setPrettyPrinting().create(); @Override public String handleRequest(Map<String,String> event, Context context) { LambdaLogger logger = context.getLogger(); String response = new String("200 OK"); // log execution details logger.log("ENVIRONMENT VARIABLES: " + gson.toJson(System.getenv())); logger.log("CONTEXT: " + gson.toJson(context)); // process event logger.log("EVENT: " + gson.toJson(event)); logger.log("EVENT TYPE: " + event.getClass().toString()); return response; } } ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-context.md
63b8ab109065-3
return response; } } ``` The function serializes the context object into JSON and records it in its log stream\. **Example log output** ``` START RequestId: 6bc28136-xmpl-4365-b021-0ce6b2e64ab0 Version: $LATEST ... CONTEXT: { "memoryLimit": 512, "awsRequestId": "6bc28136-xmpl-4365-b021-0ce6b2e64ab0", "functionName": "java-console", ... } ... END RequestId: 6bc28136-xmpl-4365-b021-0ce6b2e64ab0 REPORT RequestId: 6bc28136-xmpl-4365-b021-0ce6b2e64ab0 Duration: 198.50 ms Billed Duration: 200 ms Memory Size: 512 MB Max Memory Used: 90 MB Init Duration: 524.75 ms ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-context.md
63b8ab109065-4
``` The interface for the context object is available in the [aws\-lambda\-java\-core](https://github.com/aws/aws-lambda-java-libs/tree/master/aws-lambda-java-core) library\. You can implement this interface to create a context class for testing\. The following example shows a context class that returns dummy values for most properties and a working test logger\. **Example [src/test/java/example/TestContext\.java](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/java-basic/src/test/java/example/TestContext.java)** ``` package example; import [com\.amazonaws\.services\.lambda\.runtime\.Context](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/Context.java); import [com\.amazonaws\.services\.lambda\.runtime\.CognitoIdentity](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/CognitoIdentity.java);
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-context.md
63b8ab109065-5
import [com\.amazonaws\.services\.lambda\.runtime\.ClientContext](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/ClientContext.java); import [com\.amazonaws\.services\.lambda\.runtime\.LambdaLogger](https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/LambdaLogger.java) public class TestContext implements Context{ public TestContext() {} public String getAwsRequestId(){ return new String("495b12a8-xmpl-4eca-8168-160484189f99"); } public String getLogGroupName(){ return new String("/aws/lambda/my-function"); } ... public LambdaLogger getLogger(){ return new TestLogger(); } } ``` For more information on logging, see [AWS Lambda function logging in Java](java-logging.md)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-context.md
67d176472e2c-0
The GitHub repository for this guide includes sample applications that demonstrate the use of the context object\. Each sample application includes scripts for easy deployment and cleanup, an AWS Serverless Application Model \(AWS SAM\) 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-context.md
67d176472e2c-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\. All of the sample applications have a test context class for unit tests\. The `java-basic` application shows you how to use the context object to get a logger\. It uses SLF4J and Log4J 2 to provide a logger that works for local unit tests\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/java-context.md
e36881806e5a-0
In this tutorial, you create a Lambda function to consume events from an Amazon DynamoDB stream\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
3f930906348a-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\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
d12d301d27a6-0
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** – Lambda\. + **Permissions** – **AWSLambdaDynamoDBExecutionRole**\. + **Role name** – **lambda\-dynamodb\-role**\. The **AWSLambdaDynamoDBExecutionRole** has the permissions that the function needs to read items from DynamoDB and write logs to CloudWatch Logs\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
b012a982077c-0
The following example code receives a DynamoDB 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-ddb-create-package.md)\. **Example index\.js** ``` console.log('Loading function'); exports.handler = function(event, context, callback) { console.log(JSON.stringify(event, null, 2)); event.Records.forEach(function(record) { console.log(record.eventID); console.log(record.eventName); console.log('DynamoDB Record: %j', record.dynamodb); }); callback(null, "message"); }; ``` **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 ProcessDynamoDBRecords \
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
b012a982077c-1
``` $ aws lambda create-function --function-name ProcessDynamoDBRecords \ --zip-file fileb://function.zip --handler index.handler --runtime nodejs12.x \ --role arn:aws:iam::123456789012:role/lambda-dynamodb-role ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
4774dd79e9d2-0
In this step, you invoke your Lambda function manually using the `invoke` AWS Lambda CLI command and the following sample DynamoDB event\. **Example input\.txt** ``` { "Records":[ { "eventID":"1", "eventName":"INSERT", "eventVersion":"1.0", "eventSource":"aws:dynamodb", "awsRegion":"us-east-1", "dynamodb":{ "Keys":{ "Id":{ "N":"101" } }, "NewImage":{ "Message":{ "S":"New item!" }, "Id":{ "N":"101" } }, "SequenceNumber":"111", "SizeBytes":26, "StreamViewType":"NEW_AND_OLD_IMAGES" }, "eventSourceARN":"stream-ARN" }, { "eventID":"2", "eventName":"MODIFY", "eventVersion":"1.0",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
4774dd79e9d2-1
"eventID":"2", "eventName":"MODIFY", "eventVersion":"1.0", "eventSource":"aws:dynamodb", "awsRegion":"us-east-1", "dynamodb":{ "Keys":{ "Id":{ "N":"101" } }, "NewImage":{ "Message":{ "S":"This item has changed" }, "Id":{ "N":"101" } }, "OldImage":{ "Message":{ "S":"New item!" }, "Id":{ "N":"101" } }, "SequenceNumber":"222", "SizeBytes":59, "StreamViewType":"NEW_AND_OLD_IMAGES" }, "eventSourceARN":"stream-ARN" }, { "eventID":"3", "eventName":"REMOVE", "eventVersion":"1.0",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
4774dd79e9d2-2
"eventID":"3", "eventName":"REMOVE", "eventVersion":"1.0", "eventSource":"aws:dynamodb", "awsRegion":"us-east-1", "dynamodb":{ "Keys":{ "Id":{ "N":"101" } }, "OldImage":{ "Message":{ "S":"This item has changed" }, "Id":{ "N":"101" } }, "SequenceNumber":"333", "SizeBytes":38, "StreamViewType":"NEW_AND_OLD_IMAGES" }, "eventSourceARN":"stream-ARN" } ] } ``` Execute the following `invoke` command\. ``` $ aws lambda invoke --function-name ProcessDynamoDBRecords --payload file://input.txt outputfile.txt ``` The function returns the string `message` in the response body\. Verify the output in the `outputfile.txt` file\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
8117647dbf76-0
Create an Amazon DynamoDB table with a stream enabled\. **To create a DynamoDB table** 1. Open the [DynamoDB console](https://console.aws.amazon.com/dynamodb)\. 1. Choose **Create table**\. 1. Create a table with the following settings\. + **Table name** – **lambda\-dynamodb\-stream** + **Primary key** – **id** \(string\) 1. Choose **Create**\. **To enable streams** 1. Open the [DynamoDB console](https://console.aws.amazon.com/dynamodb)\. 1. Choose **Tables**\. 1. Choose the **lambda\-dynamodb\-stream** table\. 1. Under **Overview**, choose **Manage stream**\. 1. Choose **Enable**\. Write down the stream ARN\. You need this in the next step when you associate the stream with your Lambda function\. For more information on enabling streams, see [Capturing table activity with DynamoDB Streams](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
69bfcaf85d22-0
Create an event source mapping in AWS Lambda\. This event source mapping associates the DynamoDB stream with your Lambda function\. After you create this event source mapping, AWS Lambda starts polling the stream\. Run the following AWS CLI `create-event-source-mapping` command\. After the command executes, note down the UUID\. You'll need this UUID to refer to the event source mapping in any commands, for example, when deleting the event source mapping\. ``` $ aws lambda create-event-source-mapping --function-name ProcessDynamoDBRecords \ --batch-size 100 --starting-position LATEST --event-source DynamoDB-stream-arn ``` This creates a mapping between the specified DynamoDB stream and the Lambda function\. You can associate a DynamoDB stream with multiple Lambda functions, and associate the same Lambda function with multiple streams\. However, the Lambda functions will share the read throughput for the stream they share\. You can get the list of event source mappings by running the following command\. ``` $ aws lambda list-event-source-mappings ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
69bfcaf85d22-1
``` $ aws lambda list-event-source-mappings ``` The list returns all of the event source mappings you created, and for each mapping it shows the `LastProcessingResult`, among other things\. This field is used to provide an informative message if there are any problems\. Values such as `No records processed` \(indicates that AWS Lambda has not started polling or that there are no records in the stream\) and `OK` \(indicates AWS Lambda successfully read records from the stream and invoked your Lambda function\) indicate that there are no issues\. If there are issues, you receive an error message\. If you have a lot of event source mappings, use the function name parameter to narrow down the results\. ``` $ aws lambda list-event-source-mappings --function-name ProcessDynamoDBRecords ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
8f0718dbf6a5-0
Test the end\-to\-end experience\. As you perform table updates, DynamoDB writes event records to the stream\. As AWS Lambda polls the stream, it detects new records in the stream and executes your Lambda function on your behalf by passing events to the function\. 1. In the DynamoDB console, add, update, and delete items to the table\. DynamoDB writes records of these actions to the stream\. 1. AWS Lambda polls the stream and when it detects updates to the stream, it invokes your Lambda function by passing in the event data it finds in the stream\. 1. Your function executes and creates logs in Amazon CloudWatch\. You can verify the logs reported in the Amazon CloudWatch console\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
a2770d1a4c36-0
You can now delete the resources that you created for this tutorial, unless you want to retain them\. By deleting AWS resources that you are no longer using, you prevent unnecessary charges to your AWS account\. **To delete the Lambda function** 1. Open the [Functions page](https://console.aws.amazon.com/lambda/home#/functions) of the Lambda console\. 1. Select the function that you created\. 1. Choose **Actions**, **Delete**\. 1. Choose **Delete**\. **To delete the execution role** 1. Open the [Roles page](https://console.aws.amazon.com/iam/home#/roles) of the IAM console\. 1. Select the execution role that you created\. 1. Choose **Delete role**\. 1. Choose **Yes, delete**\. **To delete the DynamoDB table** 1. Open the [Tables page](https://console.aws.amazon.com/dynamodb/home#tables:) of the DynamoDB console\. 1. Select the table you created\. 1. Choose **Delete**\. 1. Enter **delete** in the text box\. 1. Choose **Delete**\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-ddb-example.md
63128554f215-0
Deletes a Lambda function\. To delete a specific function version, use the `Qualifier` parameter\. Otherwise, all versions and aliases are deleted\. To delete Lambda event source mappings that invoke a function, use [DeleteEventSourceMapping](API_DeleteEventSourceMapping.md)\. For AWS services and resources that invoke your function directly, delete the trigger in the service where you originally configured it\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunction.md
f833decc86fa-0
``` DELETE /2015-03-31/functions/FunctionName?Qualifier=Qualifier HTTP/1.1 ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunction.md
18909b27f994-0
The request uses the following URI parameters\. ** [FunctionName](#API_DeleteFunction_RequestSyntax) ** <a name="SSS-DeleteFunction-request-FunctionName"></a> The name of the Lambda function or version\. **Name formats** + **Function name** \- `my-function` \(name\-only\), `my-function:1` \(with version\)\. + **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\. 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_DeleteFunction.md
18909b27f994-1
Required: Yes ** [Qualifier](#API_DeleteFunction_RequestSyntax) ** <a name="SSS-DeleteFunction-request-Qualifier"></a> Specify a version to delete\. You can't delete a version that's referenced by an alias\. 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_DeleteFunction.md
cafb10b590c6-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_DeleteFunction.md
d6e568d651a9-0
``` HTTP/1.1 204 ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunction.md
08c30b125f29-0
If the action is successful, the service sends back an HTTP 204 response with an empty HTTP body\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunction.md
42d58b5d33fc-0
**InvalidParameterValueException** One of the parameters in the request is invalid\. HTTP Status Code: 400 **ResourceConflictException** The resource already exists, or another operation is in progress\. HTTP Status Code: 409 **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_DeleteFunction.md
b86aaa916127-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/DeleteFunction) + [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/DeleteFunction) + [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/DeleteFunction) + [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/DeleteFunction) + [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/DeleteFunction) + [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/DeleteFunction) + [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/DeleteFunction)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunction.md
b86aaa916127-1
+ [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/DeleteFunction) + [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/DeleteFunction)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunction.md
5e05694f6b88-0
You can use a Lambda function in one AWS account to subscribe to an Amazon SNS topic in a separate AWS account\. In this tutorial, you use the AWS Command Line Interface to perform AWS Lambda operations such as creating a Lambda function, creating an Amazon SNS topic and granting permissions to allow these two resources to access each other\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/with-sns-example.md