id
stringlengths 14
16
| text
stringlengths 1
2.43k
| source
stringlengths 99
229
|
|---|---|---|
da714071cd95-0
|
**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
**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_RemovePermission.md
|
bd0b1bdabff4-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/RemovePermission)
+ [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/RemovePermission)
+ [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/RemovePermission)
+ [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/RemovePermission)
+ [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/RemovePermission)
+ [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/RemovePermission)
+ [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/RemovePermission)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemovePermission.md
|
bd0b1bdabff4-1
|
+ [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/RemovePermission)
+ [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/RemovePermission)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemovePermission.md
|
5bf4db77d321-0
|
You can use AWS Lambda to process event notifications from an Amazon Relational Database Service \(Amazon RDS\) database\. Amazon RDS sends notifications to an Amazon Simple Notification Service \(Amazon SNS\) topic, which you can configure to invoke a Lambda function\. Amazon SNS wraps the message from Amazon RDS in its own event document and sends it to your function\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-rds.md
|
ba7579caca19-0
|
**Example Amazon RDS message in an Amazon SNS event**
```
{
"Records": [
{
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:us-east-2:123456789012:rds-lambda:21be56ed-a058-49f5-8c98-aedd2564c486",
"EventSource": "aws:sns",
"Sns": {
"SignatureVersion": "1",
"Timestamp": "2019-01-02T12:45:07.000Z",
"Signature": "tcc6faL2yUC6dgZdmrwh1Y4cGa/ebXEkAi6RibDsvpi+tE/1+82j...65r==",
"SigningCertUrl": "https://sns.us-east-2.amazonaws.com/SimpleNotificationService-ac565b8b1a6c5d002d285f9598aa1d9b.pem",
"MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e",
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-rds.md
|
ba7579caca19-1
|
"MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e",
"Message": "{\"Event Source\":\"db-instance\",\"Event Time\":\"2019-01-02 12:45:06.000\",\"Identifier Link\":\"https://console.aws.amazon.com/rds/home?region=eu-west-1#dbinstance:id=dbinstanceid\",\"Source ID\":\"dbinstanceid\",\"Event ID\":\"http://docs.amazonwebservices.com/AmazonRDS/latest/UserGuide/USER_Events.html#RDS-EVENT-0002\",\"Event Message\":\"Finished DB Instance backup\"}",
"MessageAttributes": {},
"Type": "Notification",
"UnsubscribeUrl": "https://sns.us-east-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-2:123456789012:test-lambda:21be56ed-a058-49f5-8c98-aedd2564c486",
"TopicArn":"arn:aws:sns:us-east-2:123456789012:sns-lambda",
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-rds.md
|
ba7579caca19-2
|
"TopicArn":"arn:aws:sns:us-east-2:123456789012:sns-lambda",
"Subject": "RDS Notification Message"
}
}
]
}
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-rds.md
|
056c3265e9ce-0
|
**Configuring the maximum concurrency of a function**
If too many function instances run concurrently, one or more instances may fail to obtain a database connection\. You can use reserved concurrency to limit the maximum concurrency of the function\. Set the reserved concurrency to be less than the number of database connections\. Reserved concurrency also reserves those instances for this function, which may not be ideal\. If you are invoking the Lambda functions from your application, we recommend you write code that limits the number of concurrent instances\. For more information, see [Managing concurrency for a Lambda function](https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html)\.
**Sending notifications from a database**
For instructions on configuring an Amazon RDS database to send notifications, see [Using Amazon RDS event notification](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html) in the Amazon RDS User Guide\.
**Using Amazon SNS as a trigger**
For details on using Amazon SNS as trigger, see [Using AWS Lambda with Amazon SNS](with-sns.md)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-rds.md
|
e4a0a7dddb61-0
|
**Topics**
+ [Tutorial: Configuring a Lambda function to access Amazon RDS in an Amazon VPC](services-rds-tutorial.md)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-rds.md
|
f062ebf2b226-0
|
Deletes the configuration for asynchronous invocation for a function, version, or alias\.
To configure options for asynchronous invocation, use [PutFunctionEventInvokeConfig](API_PutFunctionEventInvokeConfig.md)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunctionEventInvokeConfig.md
|
0f2552818031-0
|
```
DELETE /2019-09-25/functions/FunctionName/event-invoke-config?Qualifier=Qualifier HTTP/1.1
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunctionEventInvokeConfig.md
|
036ee8f93351-0
|
The request uses the following URI parameters\.
** [FunctionName](#API_DeleteFunctionEventInvokeConfig_RequestSyntax) ** <a name="SSS-DeleteFunctionEventInvokeConfig-request-FunctionName"></a>
The name of the Lambda function, version, or alias\.
**Name formats**
+ **Function name** \- `my-function` \(name\-only\), `my-function:v1` \(with alias\)\.
+ **Function ARN** \- `arn:aws:lambda:us-west-2:123456789012:function:my-function`\.
+ **Partial ARN** \- `123456789012:function:my-function`\.
You can append a version number or alias to any of the formats\. The length constraint applies only to the full ARN\. If you specify only the function name, it is limited to 64 characters in length\.
Length Constraints: Minimum length of 1\. Maximum length of 140\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunctionEventInvokeConfig.md
|
036ee8f93351-1
|
Length Constraints: Minimum length of 1\. Maximum length of 140\.
Pattern: `(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?`
Required: Yes
** [Qualifier](#API_DeleteFunctionEventInvokeConfig_RequestSyntax) ** <a name="SSS-DeleteFunctionEventInvokeConfig-request-Qualifier"></a>
A version number or alias name\.
Length Constraints: Minimum length of 1\. Maximum length of 128\.
Pattern: `(|[a-zA-Z0-9$_-]+)`
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunctionEventInvokeConfig.md
|
5b28be6702da-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_DeleteFunctionEventInvokeConfig.md
|
068b98dbf2ff-0
|
```
HTTP/1.1 204
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunctionEventInvokeConfig.md
|
79646339690e-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_DeleteFunctionEventInvokeConfig.md
|
924c8bb71fa6-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_DeleteFunctionEventInvokeConfig.md
|
e6a5352f3d30-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/DeleteFunctionEventInvokeConfig)
+ [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/DeleteFunctionEventInvokeConfig)
+ [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/DeleteFunctionEventInvokeConfig)
+ [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/DeleteFunctionEventInvokeConfig)
+ [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/DeleteFunctionEventInvokeConfig)
+ [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/DeleteFunctionEventInvokeConfig)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunctionEventInvokeConfig.md
|
e6a5352f3d30-1
|
+ [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/DeleteFunctionEventInvokeConfig)
+ [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/DeleteFunctionEventInvokeConfig)
+ [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/DeleteFunctionEventInvokeConfig)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_DeleteFunctionEventInvokeConfig.md
|
c0ecf37b95f3-0
|
When Lambda runs your function, it passes a context object to the [handler](nodejs-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\.
**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\.
+ `identity` β \(mobile apps\) Information about the Amazon Cognito identity that authorized the request\.
+ `cognitoIdentityId` β The authenticated Amazon Cognito identity\.
+ `cognitoIdentityPoolId` β The Amazon Cognito identity pool that authorized the invocation\.
+ `clientContext` β \(mobile apps\) 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/nodejs-context.md
|
c0ecf37b95f3-1
|
+ `clientContext` β \(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`
+ `env.platform_version`
+ `env.platform`
+ `env.make`
+ `env.model`
+ `env.locale`
+ `Custom` β Custom values that are set by the mobile application\.
+ `callbackWaitsForEmptyEventLoop` β Set to false to send the response right away when the [callback](nodejs-handler.md#nodejs-handler-sync) executes, instead of waiting for the Node\.js event loop to be empty\. If this is false, any outstanding events continue to run during the next invocation\.
The following example function logs context information and returns the location of the logs\.
**Example index\.js file**
```
exports.handler = async function(event, context) {
console.log('Remaining time: ', context.getRemainingTimeInMillis())
console.log('Function name: ', context.functionName)
return context.logStreamName
}
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/nodejs-context.md
|
467047fb4d32-0
|
You can create a trigger for an AWS CodeCommit repository so that events in the repository will invoke a Lambda function\. For example, you can invoke a Lambda function when a branch or tag is created or when a push is made to an existing branch\.
**Example AWS CodeCommit message event**
```
{
"Records": [
{
"awsRegion": "us-east-2",
"codecommit": {
"references": [
{
"commit": "5e493c6f3067653f3d04eca608b4901eb227078",
"ref": "refs/heads/master"
}
]
},
"eventId": "31ade2c7-f889-47c5-a937-1cf99e2790e9",
"eventName": "ReferenceChanges",
"eventPartNumber": 1,
"eventSource": "aws:codecommit",
"eventSourceARN": "arn:aws:codecommit:us-east-2:123456789012:lambda-pipeline-repo",
"eventTime": "2019-03-12T20:58:25.400+0000",
"eventTotalParts": 1,
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-codecommit.md
|
467047fb4d32-1
|
"eventTime": "2019-03-12T20:58:25.400+0000",
"eventTotalParts": 1,
"eventTriggerConfigId": "0d17d6a4-efeb-46f3-b3ab-a63741badeb8",
"eventTriggerName": "index.handler",
"eventVersion": "1.0",
"userIdentityARN": "arn:aws:iam::123456789012:user/intern"
}
]
}
```
For more information, see [Manage triggers for an AWS CodeCommit repository](https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-notify.html)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-codecommit.md
|
06c0ce04d36e-0
|
You can use Amazon Lex to integrate a conversation bot into your application\. The Amazon Lex bot provides a conversational interface with your users\. Amazon Lex provides prebuilt integration with Lambda, which enables you to use a Lambda function with your Amazon Lex bot\.
When you configure an Amazon Lex bot, you can specify a Lambda function to perform validation, fulfillment, or both\. For validation, Amazon Lex invokes the Lambda function after each response from the user\. The Lambda function can validate the response and provide corrective feedback to the user, if necessary\. For fulfillment, Amazon Lex invokes the Lambda function to fulfill the user request after the bot successfully collects all of the required information and receives confirmation from the user\.
You can [manage the concurrency](configuration-concurrency.md) of your Lambda function to control the maximum number of simultaneous bot conversations that you serve\. The Amazon Lex API returns an HTTP 429 status code \(Too Many Requests\) if the function is at maximum concurrency\.
The API returns an HTTP 424 status code \(Dependency Failed Exception\) if the Lambda function throws an exception\.
The Amazon Lex bot invokes your Lambda function [synchronously](invocation-sync.md)\. The event parameter contains information about the bot and the value of each slot in the dialog\. The `invocationSource` parameter indicates whether the Lambda function should validate the inputs \(DialogCodeHook\) or fulfill the intent \(FulfillmentCodeHook\)\.
**Example Amazon Lex message event**
```
{
"messageVersion": "1.0",
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-lex.md
|
06c0ce04d36e-1
|
**Example Amazon Lex message event**
```
{
"messageVersion": "1.0",
"invocationSource": "FulfillmentCodeHook",
"userId": "ABCD1234",
"sessionAttributes": {
"key1": "value1",
"key2": "value2",
},
"bot": {
"name": "OrderFlowers",
"alias": "prod",
"version": "1"
},
"outputDialogMode": "Text",
"currentIntent": {
"name": "OrderFlowers",
"slots": {
"FlowerType": "lilies",
"PickupDate": "2030-11-08",
"PickupTime": "10:00"
},
"confirmationStatus": "Confirmed"
}
}
```
Amazon Lex expects a response from a Lambda function in the following format\. The `dialogAction` field is required\. The `sessionAttributes` and the `recentIntentSummaryView` fields are optional\.
**Example Amazon Lex message event**
```
{
"sessionAttributes": {
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-lex.md
|
06c0ce04d36e-2
|
**Example Amazon Lex message event**
```
{
"sessionAttributes": {
"key1": "value1",
"key2": "value2"
...
},
"recentIntentSummaryView": [
{
"intentName": "Name",
"checkpointLabel": "Label",
"slots": {
"slot name": "value",
"slot name": "value"
},
"confirmationStatus": "None, Confirmed, or Denied (intent confirmation, if configured)",
"dialogActionType": "ElicitIntent, ElicitSlot, ConfirmIntent, Delegate, or Close",
"fulfillmentState": "Fulfilled or Failed",
"slotToElicit": "Next slot to elicit
}
],
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled",
"message": {
"contentType": "PlainText",
"content": "Thanks, your pizza has been ordered."
},
"responseCard": {
"version": integer-value,
"contentType": "application/vnd.amazonaws.card.generic",
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-lex.md
|
06c0ce04d36e-3
|
"version": integer-value,
"contentType": "application/vnd.amazonaws.card.generic",
"genericAttachments": [
{
"title":"card-title",
"subTitle":"card-sub-title",
"imageUrl":"URL of the image to be shown",
"attachmentLinkUrl":"URL of the attachment to be associated with the card",
"buttons":[
{
"text":"button-text",
"value":"Value sent to server on button click"
}
]
}
]
}
}
}
```
Note that the additional fields required for `dialogAction` vary based on the value of the `type` field\. For more information about the event and response fields, see [Lambda event and response format](https://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html) in the *Amazon Lex Developer Guide*\. For an example tutorial that shows how to use Lambda with Amazon Lex, see [Exercise 1: Create Amazon Lex bot using a blueprint](https://docs.aws.amazon.com/lex/latest/dg/gs-bp.html) in the *Amazon Lex Developer Guide*\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-lex.md
|
532eecd4dbdc-0
|
You need to configure a service\-linked role as your function's [execution role](lambda-intro-execution-role.md)\. Amazon Lex defines the service\-linked role with predefined permissions\. When you create an Amazon Lex bot using the console, the service\-linked role is created automatically\. To create a service\-linked role with the AWS CLI, use the `create-service-linked-role` command\.
```
$ aws iam create-service-linked-role --aws-service-name lex.amazonaws.com
```
This command creates the following role\.
```
{
"Role": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lex.amazonaws.com"
}
}
]
},
"RoleName": "AWSServiceRoleForLexBots",
"Path": "/aws-service-role/lex.amazonaws.com/",
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-lex.md
|
532eecd4dbdc-1
|
"Path": "/aws-service-role/lex.amazonaws.com/",
"Arn": "arn:aws:iam::account-id:role/aws-service-role/lex.amazonaws.com/AWSServiceRoleForLexBots"
}
```
If your Lambda function uses other AWS services, you need to add the corresponding permissions to the service\-linked role\.
You use a resource\-based permissions policy to allow the Amazon Lex intent to invoke your Lambda function\. If you use the Amazon Lex console, the permissions policy is created automatically\. From the AWS CLI, use the Lambda `add-permission` command to set the permission\. The following example sets permission for the `OrderFlowers` intent\.
```
aws lambda add-permission \
--function-name OrderFlowersCodeHook \
--statement-id LexGettingStarted-OrderFlowersBot \
--action lambda:InvokeFunction \
--principal lex.amazonaws.com \
--source-arn "arn:aws:lex:us-east-1:123456789012 ID:intent:OrderFlowers:*"
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-lex.md
|
43cf38d273c7-0
|
When you use Amazon SES to receive messages, you can configure Amazon SES to call your Lambda function when messages arrive\. The service can then invoke your Lambda function by passing in the incoming email event, which in reality is an Amazon SES message in an Amazon SNS event, as a parameter\.
**Example Amazon SES message event**
```
{
"Records": [
{
"eventVersion": "1.0",
"ses": {
"mail": {
"commonHeaders": {
"from": [
"Jane Doe <janedoe@example.com>"
],
"to": [
"johndoe@example.com"
],
"returnPath": "janedoe@example.com",
"messageId": "<0123456789example.com>",
"date": "Wed, 7 Oct 2015 12:34:56 -0700",
"subject": "Test Subject"
},
"source": "janedoe@example.com",
"timestamp": "1970-01-01T00:00:00.000Z",
"destination": [
"johndoe@example.com"
],
"headers": [
{
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-ses.md
|
43cf38d273c7-1
|
"johndoe@example.com"
],
"headers": [
{
"name": "Return-Path",
"value": "<janedoe@example.com>"
},
{
"name": "Received",
"value": "from mailer.example.com (mailer.example.com [203.0.113.1]) by inbound-smtp.us-west-2.amazonaws.com with SMTP id o3vrnil0e2ic for johndoe@example.com; Wed, 07 Oct 2015 12:34:56 +0000 (UTC)"
},
{
"name": "DKIM-Signature",
"value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=example; h=mime-version:from:date:message-id:subject:to:content-type; bh=jX3F0bCAI7sIbkHyy3mLYO28ieDQz2R0P8HwQkklFj4=; b=sQwJ+LMe9RjkesGu+vqU56asvMhrLRRYrWCbV"
},
{
"name": "MIME-Version",
"value": "1.0"
},
{
"name": "From",
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-ses.md
|
43cf38d273c7-2
|
"value": "1.0"
},
{
"name": "From",
"value": "Jane Doe <janedoe@example.com>"
},
{
"name": "Date",
"value": "Wed, 7 Oct 2015 12:34:56 -0700"
},
{
"name": "Message-ID",
"value": "<0123456789example.com>"
},
{
"name": "Subject",
"value": "Test Subject"
},
{
"name": "To",
"value": "johndoe@example.com"
},
{
"name": "Content-Type",
"value": "text/plain; charset=UTF-8"
}
],
"headersTruncated": false,
"messageId": "o3vrnil0e2ic28tr"
},
"receipt": {
"recipients": [
"johndoe@example.com"
],
"timestamp": "1970-01-01T00:00:00.000Z",
"spamVerdict": {
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-ses.md
|
43cf38d273c7-3
|
"timestamp": "1970-01-01T00:00:00.000Z",
"spamVerdict": {
"status": "PASS"
},
"dkimVerdict": {
"status": "PASS"
},
"processingTimeMillis": 574,
"action": {
"type": "Lambda",
"invocationType": "Event",
"functionArn": "arn:aws:lambda:us-west-2:012345678912:function:Example"
},
"spfVerdict": {
"status": "PASS"
},
"virusVerdict": {
"status": "PASS"
}
}
},
"eventSource": "aws:ses"
}
]
}
```
For more information, see [Lambda action](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda.html) in the *Amazon SES Developer Guide*\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-ses.md
|
93e7d48887e8-0
|
When AWS Lambda executes your Lambda function, it provisions and manages the resources needed to run your Lambda function\. When you create a Lambda function, you specify configuration information, such as the amount of memory and maximum execution time that you want to allow for your Lambda function\. When a Lambda function is invoked, AWS Lambda launches an execution context based on the configuration settings you provide\. The execution context is a temporary runtime environment that initializes any external dependencies of your Lambda function code, such as database connections or HTTP endpoints\. This affords subsequent invocations better performance because there is no need to "cold\-start" or initialize those external dependencies, as explained below\.
It takes time to set up an execution context and do the necessary "bootstrapping", which adds some latency each time the Lambda function is invoked\. You typically see this latency when a Lambda function is invoked for the first time or after it has been updated because AWS Lambda tries to reuse the execution context for subsequent invocations of the Lambda function\.
After a Lambda function is executed, AWS Lambda maintains the execution context for some time in anticipation of another Lambda function invocation\. In effect, the service freezes the execution context after a Lambda function completes, and thaws the context for reuse, if AWS Lambda chooses to reuse the context when the Lambda function is invoked again\. This execution context reuse approach has the following implications:
+ Objects declared outside of the function's handler method remain initialized, providing additional optimization when the function is invoked again\. For example, if your Lambda function establishes a database connection, instead of reestablishing the connection, the original connection is used in subsequent invocations\. We suggest adding logic in your code to check if a connection exists before creating one\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/runtimes-context.md
|
93e7d48887e8-1
|
+ Each execution context provides 512 MB of additional disk space in the `/tmp` directory\. The directory content remains when the execution context is frozen, providing transient cache that can be used for multiple invocations\. You can add extra code to check if the cache has the data that you stored\. For information on deployment limits, see [AWS Lambda quotas](gettingstarted-limits.md)\.
+ Background processes or callbacks initiated by your Lambda function that did not complete when the function ended resume if AWS Lambda chooses to reuse the execution context\. You should make sure any background processes or callbacks in your code are complete before the code exits\.
When you write your Lambda function code, do not assume that AWS Lambda automatically reuses the execution context for subsequent function invocations\. Other factors may dictate a need for AWS Lambda to create a new execution context, which can lead to unexpected results, such as database connection failures\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/runtimes-context.md
|
7ca5ba410f18-0
|
Lambda integrates with AWS X\-Ray to enable you to trace, debug, and optimize Lambda applications\. You can use X\-Ray to trace a request as it traverses resources in your application, from the frontend API to storage and database on the backend\. By simply adding the X\-Ray SDK library to your build configuration, you can record errors and latency for any call that your function makes to an AWS service\.
The X\-Ray *service map* shows the flow of requests through your application\. The following example from the [error processor](samples-errorprocessor.md) sample application shows an application with two functions\. The primary function processes events and sometimes returns errors\. The second function processes errors that appear in the first's log group and uses the AWS SDK to call X\-Ray, Amazon S3 and Amazon CloudWatch Logs\.
[images/sample-errorprocessor-servicemap-l.png](images/sample-errorprocessor-servicemap-l.png)
To trace requests that don't have a tracing header, enable active tracing in your function's configuration\.
**To enable active tracing**
1. Open the Lambda console [Functions page](https://console.aws.amazon.com/lambda/home#/functions)\.
1. Choose a function\.
1. Under **AWS X\-Ray**, choose **Active tracing**\.
1. Choose **Save**\.
**Pricing**
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
7ca5ba410f18-1
|
1. Choose **Save**\.
**Pricing**
X\-Ray has a perpetual free tier\. Beyond the free tier threshold, X\-Ray charges for trace storage and retrieval\. For details, see [AWS X\-Ray pricing](https://aws.amazon.com/xray/pricing/)\.
Your function needs permission to upload trace data to X\-Ray\. When you enable active tracing in the Lambda console, Lambda adds the required permissions to your function's [execution role](lambda-intro-execution-role.md)\. Otherwise, add the [AWSXRayDaemonWriteAccess](https://console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess) policy to the execution role\.
X\-Ray applies a sampling algorithm to ensure that tracing is efficient, while still providing a representative sample of the requests that your application serves\. The default sampling rule is 1 request per second and 5 percent of additional requests\. This sampling rate cannot be configured for Lambda functions\.
When active tracing is enabled, Lambda records a trace for a subset of invocations\. Lambda records two *segments*, which creates two nodes on the service map\. The first node represents the Lambda service that receives the invocation request\. The second node is recorded by the function's [runtime](gettingstarted-concepts.md#gettingstarted-concepts-runtimes)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
7ca5ba410f18-2
|
![\[\]](http://docs.aws.amazon.com/lambda/latest/dg/images/xray-servicemap-function.png)
You can instrument your function code to record metadata and trace downstream calls\. To record detail about calls that your function makes to other resources and services, use the X\-Ray SDK for \.NET\. To get the SDK, add the `AWSXRayRecorder` packages to your project file\.
**Example [src/blank\-csharp/blank\-csharp\.csproj](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-csharp/src/blank-csharp/blank-csharp.csproj)**
```
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
7ca5ba410f18-3
|
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.7.0" />
<PackageReference Include="AWSSDK.Core" Version="3.3.104.38" />
<PackageReference Include="AWSSDK.Lambda" Version="3.3.108.11" />
<PackageReference Include="AWSXRayRecorder.Core" Version="2.6.2" />
<PackageReference Include="AWSXRayRecorder.Handlers.AwsSdk" Version="2.7.2" />
</ItemGroup>
</Project>
```
To instrument AWS SDK clients, call the `RegisterXRayForAllServices` method in your initilization code\.
**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) β Initialize X\-Ray**
```
static async void initialize() {
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
7ca5ba410f18-4
|
```
static async void initialize() {
AWSSDKHandler.RegisterXRayForAllServices();
lambdaClient = new AmazonLambdaClient();
await callLambda();
}
```
The following example shows a trace with 2 segments\. Both are named **my\-function**, but one is type `AWS::Lambda` and the other is `AWS::Lambda::Function`\. The function segment is expanded to show its subsegments\.
![\[Image NOT FOUND\]](http://docs.aws.amazon.com/lambda/latest/dg/images/nodejs-xray-timeline.png)
The first segment represents the invocation request processed by the Lambda service\. The second segment records the work done by your function\. The function segment has 3 subsegments\.
+ **Initialization** β Represents time spent loading your function and running [initialization code](gettingstarted-features.md#gettingstarted-features-programmingmodel)\. This subsegment only appears for the first event processed by each instance of your function\.
+ **Invocation** β Represents the work done by your handler code\. By instrumenting your code, you can extend this subsegment with additional subsegments\.
+ **Overhead** β Represents the work done by the Lambda runtime to prepare to handle the next event\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
7ca5ba410f18-5
|
+ **Overhead** β Represents the work done by the Lambda runtime to prepare to handle the next event\.
You can also instrument HTTP clients, record SQL queries, and create custom subsegments with annotations and metadata\. For more information, see [The X\-Ray SDK for \.NET](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-dotnet.html) in the AWS X\-Ray Developer Guide\.
**Topics**
+ [Enabling active tracing with the Lambda API](#csharp-tracing-api)
+ [Enabling active tracing with AWS CloudFormation](#csharp-tracing-cloudformation)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
41db85a209f1-0
|
To manage tracing configuration with the AWS CLI or AWS SDK, use the following API operations:
+ [UpdateFunctionConfiguration](API_UpdateFunctionConfiguration.md)
+ [GetFunctionConfiguration](API_GetFunctionConfiguration.md)
+ [CreateFunction](API_CreateFunction.md)
The following example AWS CLI command enables active tracing on a function named my\-function\.
```
$ aws lambda update-function-configuration --function-name my-function \
--tracing-config Mode=Active
```
Tracing mode is part of the version\-specific configuration that is locked when you publish a version of your function\. You can't change the tracing mode on a published version\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
a666cb7096d1-0
|
To enable active tracing on an `AWS::Lambda::Function` resource in an AWS CloudFormation template, use the `TracingConfig` property\.
**Example [function\-inline\.yml](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/templates/function-inline.yml) β Tracing configuration**
```
Resources:
function:
Type: [AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)
Properties:
TracingConfig:
Mode: Active
...
```
For an AWS Serverless Application Model \(AWS SAM\) `AWS::Serverless::Function` resource, use the `Tracing` property\.
**Example [template\.yml](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/template.yml) β Tracing configuration**
```
Resources:
function:
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
Properties:
Tracing: Active
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
a666cb7096d1-1
|
Properties:
Tracing: Active
...
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/csharp-tracing.md
|
84871cd7a2d0-0
|
When your code raises an error, Lambda generates a JSON representation of the error\. This error document appears in the invocation log and, for synchronous invocations, in the output\.
**Example function\.rb**
```
def handler(event:, context:)
puts "Processing event..."
[1, 2, 3].first("two")
"Success"
end
```
This code results in a type error\. Lambda catches the error and generates a JSON document with fields for the error message, the type, and the stack trace\.
```
{
"errorMessage": "no implicit conversion of String into Integer",
"errorType": "Function<TypeError>",
"stackTrace": [
"/var/task/function.rb:3:in `first'",
"/var/task/function.rb:3:in `handler'"
]
}
```
When you invoke the function from the command line, the AWS CLI splits the response into two documents\. To indicate that a function error occurred, the response displayed in the terminal includes a `FunctionError` field\. The response or error returned by the function is written to the output file\.
```
$ aws lambda invoke --function-name my-function out.json
{
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/ruby-exceptions.md
|
84871cd7a2d0-1
|
```
$ aws lambda invoke --function-name my-function out.json
{
"StatusCode": 200,
"FunctionError": "Unhandled",
"ExecutedVersion": "$LATEST"
}
```
View the output file to see the error document\.
```
$ cat out.json
{"errorMessage":"no implicit conversion of String into Integer","errorType":"Function<TypeError>","stackTrace":["/var/task/function.rb:3:in `first'","/var/task/function.rb:3:in `handler'"]}
```
**Note**
The 200 \(success\) status code in the response from Lambda indicates that there wasn't an error with the request that you sent to Lambda\. For issues that result in an error status code, see [Errors](API_Invoke.md#API_Invoke_Errors)\.
Lambda also records up to 256 KB of the error object in the function's logs\. To view logs when you invoke the function from the command line, use the `--log-type` option and decode the base64 string in the response\.
```
$ aws lambda invoke --function-name my-function out.json --log-type Tail \
--query 'LogResult' --output text | base64 -d
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/ruby-exceptions.md
|
84871cd7a2d0-2
|
--query 'LogResult' --output text | base64 -d
START RequestId: 5ce6a15a-f156-11e8-b8aa-25371a5ca2a3 Version: $LATEST
Processing event...
Error raised from handler method
{
"errorMessage": "no implicit conversion of String into Integer",
"errorType": "Function<TypeError>",
"stackTrace": [
"/var/task/function.rb:3:in `first'",
"/var/task/function.rb:3:in `handler'"
]
}
END RequestId: 5ce6a15a-f156-11e8-b8aa-25371a5ca2a3
REPORT RequestId: 5ce6a15a-f156-11e8-b8aa-25371a5ca2a3 Duration: 22.74 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 18 MB
```
For more information about logs, see [AWS Lambda function logging in Ruby](ruby-logging.md)\.
Depending on the event source, AWS Lambda might retry the failed Lambda function\. For example, if Kinesis is the event source, AWS Lambda retries the failed invocation until the Lambda function succeeds or the records in the stream expire\. For more information on retries, 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/ruby-exceptions.md
|
2310dd6b96e2-0
|
In addition to the Lambda console, you can use the following tools to manage and invoke Lambda resources\.
**Topics**
+ [AWS Command Line Interface](#gettingstarted-tools-awscli)
+ [AWS Serverless Application Model](#gettingstarted-tools-awssam)
+ [SAM CLI](#gettingstarted-tools-samcli)
+ [Code authoring tools](#lambda-app-author)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-tools.md
|
5c2e23932d9d-0
|
Install the AWS Command Line Interface to manage and use Lambda functions from the command line\. Tutorials in this guide use the AWS CLI, which has commands for all Lambda API actions\. Some functionality is not available in the Lambda console and can only be accessed with the AWS CLI or the AWS SDK\.
To set up the AWS CLI, see the following topics in the *AWS Command Line Interface User Guide*\.
+ [Getting set up with the AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html)
+ [Configuring the AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)
To verify that the AWS CLI is configured correctly, run the `list-functions` command to see a list of your Lambda functions in the current region\.
```
$ aws lambda list-functions
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-tools.md
|
486772a482e2-0
|
AWS SAM is an extension for the AWS CloudFormation template language that lets you define serverless applications at a higher level\. It abstracts away common tasks such as function role creation, which makes it easier to write templates\. AWS SAM is supported directly by AWS CloudFormation, and includes additional functionality through the AWS CLI and AWS SAM CLI\.
For more information about AWS SAM templates, see [ AWS SAM template basics](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-template-basics.html) in the *AWS Serverless Application Model Developer Guide*\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-tools.md
|
0ef1e72f3b99-0
|
The AWS SAM CLI is a separate command line tool that you can use to manage and test AWS SAM applications\. In addition to commands for uploading artifacts and launching AWS CloudFormation stacks that are also available in the AWS CLI, the SAM CLI provides additional commands for validating templates and running applications locally in a Docker container\.
To set up the AWS SAM CLI, see [Installing the AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) in the *AWS Serverless Application Model Developer Guide*\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-tools.md
|
f118afddf76b-0
|
You can author your Lambda function code in the languages that are supported by AWS Lambda\. For a list of supported languages, see [AWS Lambda runtimes](lambda-runtimes.md)\. There are tools for authoring code, such as the AWS Lambda console, Eclipse IDE, and Visual Studio IDE\. But the available tools and options depend on the following:
+ Language you choose to write your Lambda function code\.
+ Libraries that you use in your code\. AWS Lambda runtime provides some of the libraries and you must upload any additional libraries that you use\.
The following table lists languages, and the available tools and options that you can use\.
****
| Language | Tools and options for authoring code |
| --- | --- |
| Node\.js | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-tools.html) |
| Java | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-tools.html) |
| C\# | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-tools.html) |
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-tools.md
|
f118afddf76b-1
|
| Python | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-tools.html) |
| Ruby | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-tools.html) |
| Go | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-tools.html) |
| PowerShell | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-tools.html) |
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/gettingstarted-tools.md
|
09a561027069-0
|
Removes a statement from the permissions policy for a version of an [AWS Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html)\. For more information, see [AddLayerVersionPermission](API_AddLayerVersionPermission.md)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemoveLayerVersionPermission.md
|
0a650844450a-0
|
```
DELETE /2018-10-31/layers/LayerName/versions/VersionNumber/policy/StatementId?RevisionId=RevisionId HTTP/1.1
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemoveLayerVersionPermission.md
|
98b40f75f255-0
|
The request uses the following URI parameters\.
** [LayerName](#API_RemoveLayerVersionPermission_RequestSyntax) ** <a name="SSS-RemoveLayerVersionPermission-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
** [RevisionId](#API_RemoveLayerVersionPermission_RequestSyntax) ** <a name="SSS-RemoveLayerVersionPermission-request-RevisionId"></a>
Only update the policy if the revision ID matches the ID specified\. Use this option to avoid modifying a policy that has changed since you last read it\.
** [StatementId](#API_RemoveLayerVersionPermission_RequestSyntax) ** <a name="SSS-RemoveLayerVersionPermission-request-StatementId"></a>
The identifier that was specified when the statement was added\.
Length Constraints: Minimum length of 1\. Maximum length of 100\.
Pattern: `([a-zA-Z0-9-_]+)`
Required: Yes
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemoveLayerVersionPermission.md
|
98b40f75f255-1
|
Pattern: `([a-zA-Z0-9-_]+)`
Required: Yes
** [VersionNumber](#API_RemoveLayerVersionPermission_RequestSyntax) ** <a name="SSS-RemoveLayerVersionPermission-request-VersionNumber"></a>
The version number\.
Required: Yes
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemoveLayerVersionPermission.md
|
f3f64d9ae934-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_RemoveLayerVersionPermission.md
|
e0b9c2606f73-0
|
```
HTTP/1.1 204
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemoveLayerVersionPermission.md
|
7c2c95f1baa1-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_RemoveLayerVersionPermission.md
|
d959d9c5375a-0
|
**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
**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_RemoveLayerVersionPermission.md
|
3b95d9bf229e-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/RemoveLayerVersionPermission)
+ [AWS SDK for \.NET](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/RemoveLayerVersionPermission)
+ [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/RemoveLayerVersionPermission)
+ [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/RemoveLayerVersionPermission)
+ [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/RemoveLayerVersionPermission)
+ [AWS SDK for JavaScript](https://docs.aws.amazon.com/goto/AWSJavaScriptSDK/lambda-2015-03-31/RemoveLayerVersionPermission)
+ [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/RemoveLayerVersionPermission)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemoveLayerVersionPermission.md
|
3b95d9bf229e-1
|
+ [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/RemoveLayerVersionPermission)
+ [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/RemoveLayerVersionPermission)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_RemoveLayerVersionPermission.md
|
a75bbf0d62e4-0
|
The blank function sample application is a starter application that demonstrates common operations in Lambda with a function that calls the Lambda API\. It shows the use of logging, environment variables, AWS X\-Ray tracing, layers, unit tests and the AWS SDK\. Explore this application to learn about building Lambda functions in your programming language, or use it as a starting point for your own projects\.
![\[\]](http://docs.aws.amazon.com/lambda/latest/dg/images/sample-blank.png)
Variants of this sample application are available for the following languages:
**Variants**
+ Node\.js β [blank\-nodejs](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-nodejs)\.
+ Python β [blank\-python](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-python)\.
+ Ruby β [blank\-ruby](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-ruby)\.
+ Java β [blank\-java](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-java)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
a75bbf0d62e4-1
|
+ Go β [blank\-go](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-go)\.
+ C\# β [blank\-csharp](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-csharp)\.
+ PowerShell β [blank\-powershell](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-powershell)\.
The examples in this topic highlight code from the Node\.js version, but the details are generally applicable to all variants\.
You can deploy the sample in a few minutes with the AWS CLI and AWS CloudFormation\. Follow the instructions in the [README](https://github.com/awsdocs/aws-lambda-developer-guide/tree/master/sample-apps/blank-nodejs) to download, configure, and deploy it in your account\.
**Topics**
+ [Architecture and handler code](#samples-blank-architecture)
+ [Deployment automation with AWS CloudFormation and the AWS CLI](#samples-blank-automation)
+ [Instrumentation with the AWS X\-Ray](#samples-blank-instrumentation)
+ [Dependency management with layers](#samples-blank-dependencies)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
f6e63ee0cf28-0
|
The sample application consists of function code, an AWS CloudFormation template, and supporting resources\. When you deploy the sample, you use the following AWS services:
+ AWS Lambda β Runs function code, sends logs to CloudWatch Logs, and sends trace data to X\-Ray\. The function also calls the Lambda API to get details about the account's quotas and usage in the current Region\.
+ [AWS X\-Ray](https://aws.amazon.com/xray) β Collects trace data, indexes traces for search, and generates a service map\.
+ [Amazon CloudWatch](https://aws.amazon.com/cloudwatch) β Stores logs and metrics\.
+ [AWS Identity and Access Management \(IAM\)](https://aws.amazon.com/iam) β Grants permission\.
+ [Amazon Simple Storage Service \(Amazon S3\)](https://aws.amazon.com/s3) β Stores the function's deployment package during deployment\.
+ [AWS CloudFormation](https://aws.amazon.com/cloudformation) β Creates application resources and deploys function code\.
Standard charges apply for each service\. For more information, see [AWS Pricing](https://aws.amazon.com/pricing)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
f6e63ee0cf28-1
|
Standard charges apply for each service\. For more information, see [AWS Pricing](https://aws.amazon.com/pricing)\.
The function code shows a basic workflow for processing an event\. The handler takes an Amazon Simple Queue Service \(Amazon SQS\) event as input and iterates through the records that it contains, logging the contents of each message\. It logs the contents of the event, the context object, and environment variables\. Then it makes a call with the AWS SDK and passes the response back to the Lambda runtime\.
**Example [blank\-nodejs/function/index\.js](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/function/index.js) β Handler code**
```
// Handler
exports.handler = async function(event, context) {
event.Records.forEach(record => {
console.log(record.body)
})
console.log('## ENVIRONMENT VARIABLES: ' + serialize(process.env))
console.log('## CONTEXT: ' + serialize(context))
console.log('## EVENT: ' + serialize(event))
return getAccountSettings()
}
// Use SDK client
var getAccountSettings = function(){
return lambda.getAccountSettings().promise()
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
f6e63ee0cf28-2
|
var getAccountSettings = function(){
return lambda.getAccountSettings().promise()
}
var serialize = function(object) {
return JSON.stringify(object, null, 2)
}
```
The input/output types for the handler and support for asynchronous programming vary per runtime\. In this example, the handler method is `async`, so in Node\.js this means that it must return a promise back to the runtime\. The Lambda runtime waits for the promise to be resolved and returns the response to the invoker\. If the function code or AWS SDK client return an error, the runtime formats the error into a JSON document and returns that\.
The sample application doesn't include an Amazon SQS queue to send events, but uses an event from Amazon SQS \([event\.json](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/event.json)\) to illustrate how events are processed\. To add an Amazon SQS queue to your application, see [Using AWS Lambda with Amazon SQS](with-sqs.md)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
21365579bbf6-0
|
The sample application's resources are defined in an AWS CloudFormation template and deployed with the AWS CLI\. The project includes simple shell scripts that automate the process of setting up, deploying, invoking, and tearing down the application\.
![\[\]](http://docs.aws.amazon.com/lambda/latest/dg/images/sample-blank-stack.png)
The application template uses an AWS Serverless Application Model \(AWS SAM\) resource type to define the model\. AWS SAM simplifies template authoring for serverless applications by automating the definition of execution roles, APIs, and other resources\.
The template defines the resources in the application *stack*\. This includes the function, its execution role, and a Lambda layer that provides the function's library dependencies\. The stack does not include the bucket that the AWS CLI uses during deployment or the CloudWatch Logs log group\.
**Example [blank\-nodejs/template\.yml](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/template.yml) β Serverless resources**
```
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An AWS Lambda application that calls the Lambda API.
Resources:
function:
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
21365579bbf6-1
|
Description: An AWS Lambda application that calls the Lambda API.
Resources:
function:
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
CodeUri: function/.
Description: Call the AWS Lambda API
Timeout: 10
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
4b9a7535c742-0
|
Policies:
- AWSLambdaBasicExecutionRole
- AWSLambdaReadOnlyAccess
- AWSXrayWriteOnlyAccess
Tracing: Active
Layers:
- !Ref libs
libs:
Type: [AWS::Serverless::LayerVersion](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-layerversion.html)
Properties:
LayerName: blank-nodejs-lib
Description: Dependencies for the blank sample app.
ContentUri: lib/.
CompatibleRuntimes:
- nodejs12.x
```
When you deploy the application, AWS CloudFormation applies the AWS SAM transform to the template to generate an AWS CloudFormation template with standard types such as `AWS::Lambda::Function` and `AWS::IAM::Role`\.
**Example processed template**
```
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "An AWS Lambda application that calls the Lambda API.",
"Resources": {
"function": {
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
4b9a7535c742-1
|
"Description": "An AWS Lambda application that calls the Lambda API.",
"Resources": {
"function": {
"Type": "[AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html)",
"Properties": {
"Layers": [
{
"Ref": "libs32xmpl61b2"
}
],
"TracingConfig": {
"Mode": "Active"
},
"Code": {
"S3Bucket": "lambda-artifacts-6b000xmpl1e9bf2a",
"S3Key": "3d3axmpl473d249d039d2d7a37512db3"
},
"Description": "Call the AWS Lambda API",
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
```
In this example, the `Code` property specifies an object in an Amazon S3 bucket\. This corresponds to the local path in the `CodeUri` property in the project template:
```
CodeUri: function/.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
4b9a7535c742-2
|
```
CodeUri: function/.
```
To upload the project files to Amazon S3, the deployment script uses commands in the AWS CLI\. The `cloudformation package` command preprocesses the template, uploads artifacts, and replaces local paths with Amazon S3 object locations\. The `cloudformation deploy` command deploys the processed template with a AWS CloudFormation change set\.
**Example [blank\-nodejs/3\-deploy\.sh](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/3-deploy.sh) β Package and deploy**
```
#!/bin/bash
set -eo pipefail
ARTIFACT_BUCKET=$(cat bucket-name.txt)
aws cloudformation package --template-file template.yml --s3-bucket $ARTIFACT_BUCKET --output-template-file out.yml
aws cloudformation deploy --template-file out.yml --stack-name blank-nodejs --capabilities CAPABILITY_NAMED_IAM
```
The first time you run this script, it creates a AWS CloudFormation stack named `blank-nodejs`\. If you make changes to the function code or template, you can run it again to update the stack\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
4b9a7535c742-3
|
The cleanup script \([blank\-nodejs/5\-cleanup\.sh](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/5-cleanup.sh)\) deletes the stack and optionally deletes the deployment bucket and function logs\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
1226531d7b6b-0
|
The sample function is configured for tracing with [AWS X\-Ray](https://console.aws.amazon.com/xray/home)\. With the tracing mode set to active, Lambda records timing information for a subset of invocations and sends it to X\-Ray\. X\-Ray processes the data to generate a *service map* that shows a client node and two service nodes:
![\[\]](http://docs.aws.amazon.com/lambda/latest/dg/images/blank-servicemap-basic.png)
The first service node \(`AWS::Lambda`\) represents the Lambda service, which validates the invocation request and sends it to the function\. The second node, `AWS::Lambda::Function`, represents the function itself\.
To record additional detail, the sample function uses the X\-Ray SDK\. With minimal changes to the function code, the X\-Ray SDK records details about calls made with the AWS SDK to AWS services\.
**Example [blank\-nodejs/function/index\.js](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/function/index.js) β Instrumentation**
```
const AWSXRay = require('aws-xray-sdk-core')
const AWS = AWSXRay.captureAWS(require('aws-sdk'))
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
1226531d7b6b-1
|
const AWS = AWSXRay.captureAWS(require('aws-sdk'))
// Create client outside of handler to reuse
const lambda = new AWS.Lambda()
```
Instrumenting the AWS SDK client adds an additional node to the service map and more detail in traces\. In this example, the service map shows the sample function calling the Lambda API to get details about storage and concurrency usage in the current Region\.
![\[\]](http://docs.aws.amazon.com/lambda/latest/dg/images/blank-servicemap.png)
The trace shows timing details for the invocation, with subsegments for function initialization, invocation, and overhead\. The invocation subsegment has a subsegment for the AWS SDK call to the `GetAccountSettings` API operation\.
![\[\]](http://docs.aws.amazon.com/lambda/latest/dg/images/blank-trace.png)
You can include the X\-Ray SDK and other libraries in your function's deployment package, or deploy them separately in a Lambda layer\. For Node\.js, Ruby, and Python, the Lambda runtime includes the AWS SDK in the execution environment\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
8856f77d743a-0
|
You can install libraries locally and include them in the deployment package that you upload to Lambda, but this has its drawbacks\. Larger file sizes cause increased deployment times and can prevent you from testing changes to your function code in the Lambda console\. To keep the deployment package small and avoid uploading dependencies that haven't changed, the sample app creates a [Lambda layer](configuration-layers.md) and associates it with the function\.
**Example [blank\-nodejs/template\.yml](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/template.yml) β Dependency layer**
```
Resources:
function:
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
CodeUri: function/.
Description: Call the AWS Lambda API
Timeout: 10
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
86a57b174941-0
|
Policies:
- AWSLambdaBasicExecutionRole
- AWSLambdaReadOnlyAccess
- AWSXrayWriteOnlyAccess
Tracing: Active
Layers:
- !Ref libs
libs:
Type: [AWS::Serverless::LayerVersion](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-layerversion.html)
Properties:
LayerName: blank-nodejs-lib
Description: Dependencies for the blank sample app.
ContentUri: lib/.
CompatibleRuntimes:
- nodejs12.x
```
The `2-build-layer.sh` script installs the function's dependencies with npm and places them in a folder with the [structure required by the Lambda runtime](configuration-layers.md#configuration-layers-path)\.
**Example [2\-build\-layer\.sh](https://github.com/awsdocs/aws-lambda-developer-guide/blob/master/sample-apps/blank-nodejs/2-build-layer.sh) β Preparing the layer**
```
#!/bin/bash
set -eo pipefail
mkdir -p lib/nodejs
rm -rf node_modules lib/nodejs/node_modules
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
86a57b174941-1
|
mkdir -p lib/nodejs
rm -rf node_modules lib/nodejs/node_modules
npm install --production
mv node_modules lib/nodejs/
```
The first time that you deploy the sample application, the AWS CLI packages the layer separately from the function code and deploys both\. For subsequent deployments, the layer archive is only uploaded if the contents of the `lib` folder have changed\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/samples-blank.md
|
1324d8274497-0
|
When your function finishes processing an event, Lambda sends metrics about the invocation to Amazon CloudWatch\. You can build graphs and dashboards with these metrics in the CloudWatch console, and set alarms to respond to changes in utilization, performance, or error rates\. Use dimensions to filter and sort function metrics by function name, alias, or version\.
**To view metrics in the CloudWatch console**
1. Open the [Amazon CloudWatch console Metrics page](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#metricsV2:graph=~();namespace=~'AWS*2fLambda) \(`AWS/Lambda` namespace\)\.
1. Choose a dimension\.
+ **By Function Name** \(`FunctionName`\) β View aggregate metrics for all versions and aliases of a function\.
+ **By Resource** \(`Resource`\) β View metrics for a version or alias of a function\.
+ **By Executed Version** \(`ExecutedVersion`\) β View metrics for a combination of alias and version\. Use the `ExecutedVersion` dimension to compare error rates for two versions of a function that are both targets of a [weighted alias](configuration-aliases.md)\.
+ **Across All Functions** \(none\) β View aggregate metrics for all functions in the current AWS Region\.
1. Choose metrics to add them to the graph\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/monitoring-metrics.md
|
1324d8274497-1
|
1. Choose metrics to add them to the graph\.
By default, graphs use the `Sum` statistic for all metrics\. To choose a different statistic and customize the graph, use the options on the **Graphed metrics** tab\.
The timestamp on a metric reflects when the function was invoked\. Depending on the duration of the execution, this can be several minutes before the metric is emitted\. If, for example, your function has a 10\-minute timeout, look more than 10 minutes in the past for accurate metrics\.
For more information about CloudWatch, see the [https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/](https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/)\.
**Topics**
+ [Using invocation metrics](#monitoring-metrics-invocation)
+ [Using performance metrics](#monitoring-metrics-performance)
+ [Using concurrency metrics](#monitoring-metrics-concurrency)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/monitoring-metrics.md
|
54f9c8b87809-0
|
Invocation metrics are binary indicators of the outcome of an invocation\. For example, if the function returns an error, Lambda sends the `Errors` metric with a value of 1\. To get a count of the number of function errors that occurred each minute, view the `Sum` of the `Errors` metric with a period of one minute\.
You should view the following metrics with the `Sum` statistic\.
**Invocation metrics**
+ `Invocations` β The number of times your function code is executed, including successful executions and executions that result in a function error\. Invocations aren't recorded if the invocation request is throttled or otherwise resulted in an [invocation error](API_Invoke.md#API_Invoke_Errors)\. This equals the number of requests billed\.
+ `Errors` β The number of invocations that result in a function error\. Function errors include exceptions thrown by your code and exceptions thrown by the Lambda runtime\. The runtime returns errors for issues such as timeouts and configuration errors\. To calculate the error rate, divide the value of `Errors` by the value of `Invocations`\.
+ `DeadLetterErrors` β For [asynchronous invocation](invocation-async.md), the number of times Lambda attempts to send an event to a dead\-letter queue but fails\. Dead\-letter errors can occur due to permissions errors, misconfigured resources, or size limits\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/monitoring-metrics.md
|
54f9c8b87809-1
|
+ `DestinationDeliveryFailures` β For asynchronous invocation, the number of times Lambda attempts to send an event to a [destination](gettingstarted-features.md#gettingstarted-features-destinations) but fails\. Delivery errors can occur due to permissions errors, misconfigured resources, or size limits\.
+ `Throttles` β The number of invocation requests that are throttled\. When all function instances are processing requests and no concurrency is available to scale up, Lambda rejects additional requests with [TooManyRequestsException](API_Invoke.md#API_Invoke_Errors)\. Throttled requests and other invocation errors don't count as `Invocations` or `Errors`\.
+ `ProvisionedConcurrencyInvocations` β The number of times your function code is executed on [provisioned concurrency](configuration-concurrency.md)\.
+ `ProvisionedConcurrencySpilloverInvocations` β The number of times your function code is executed on standard concurrency when all provisioned concurrency is in use\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/monitoring-metrics.md
|
8ead7fc36ae1-0
|
Performance metrics provide performance details about a single invocation\. For example, the `Duration` metric indicates the amount of time in milliseconds that your function spends processing an event\. To get a sense of how fast your function processes events, view these metrics with the `Average` or `Max` statistic\.
**Performance metrics**
+ `Duration` β The amount of time that your function code spends processing an event\. For the first event processed by an instance of your function, this includes [initialization time](gettingstarted-features.md#gettingstarted-features-programmingmodel)\. The billed duration for an invocation is the value of `Duration` rounded up to the nearest 100 milliseconds\.
+ `IteratorAge` β For [event source mappings](invocation-eventsourcemapping.md) that read from streams, the age of the last record in the event\. The age is the amount of time between when the stream receives the record and when the event source mapping sends the event to the function\.
`Duration` also supports [percentile statistics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Percentiles)\. Use percentiles to exclude outlier values that skew average and maximum statistics\. For example, the P95 statistic shows the maximum duration of 95 percent of executions, excluding the slowest 5 percent\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/monitoring-metrics.md
|
9a251075b768-0
|
Lambda reports concurrency metrics as an aggregate count of the number of instances processing events across a function, version, alias, or AWS Region\. To see how close you are to hitting concurrency limits, view these metrics with the `Max` statistic\.
**Concurrency metrics**
+ `ConcurrentExecutions` β The number of function instances that are processing events\. If this number reaches your [concurrent executions quota](gettingstarted-limits.md) for the Region, or the [reserved concurrency limit](configuration-concurrency.md) that you configured on the function, additional invocation requests are throttled\.
+ `ProvisionedConcurrentExecutions` β The number of function instances that are processing events on [provisioned concurrency](configuration-concurrency.md)\. For each invocation of an alias or version with provisioned concurrency, Lambda emits the current count\.
+ `ProvisionedConcurrencyUtilization` β For a version or alias, the value of `ProvisionedConcurrentExecutions` divided by the total amount of provisioned concurrency allocated\. For example, `.5` indicates that 50 percent of allocated provisioned concurrency is in use\.
+ `UnreservedConcurrentExecutions` β For an AWS Region, the number of events that are being processed by functions that don't have reserved concurrency\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/monitoring-metrics.md
|
6d084b6727b5-0
|
Limits that are related to concurrency and storage\. All file and storage sizes are in bytes\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_AccountLimit.md
|
682356c15c02-0
|
**CodeSizeUnzipped** <a name="SSS-Type-AccountLimit-CodeSizeUnzipped"></a>
The maximum size of a function's deployment package and layers when they're extracted\.
Type: Long
Required: No
**CodeSizeZipped** <a name="SSS-Type-AccountLimit-CodeSizeZipped"></a>
The maximum size of a deployment package when it's uploaded directly to AWS Lambda\. Use Amazon S3 for larger files\.
Type: Long
Required: No
**ConcurrentExecutions** <a name="SSS-Type-AccountLimit-ConcurrentExecutions"></a>
The maximum number of simultaneous function executions\.
Type: Integer
Required: No
**TotalCodeSize** <a name="SSS-Type-AccountLimit-TotalCodeSize"></a>
The amount of storage space that you can use for all deployment packages and layer archives\.
Type: Long
Required: No
**UnreservedConcurrentExecutions** <a name="SSS-Type-AccountLimit-UnreservedConcurrentExecutions"></a>
The maximum number of simultaneous function executions, minus the capacity that's reserved for individual functions with [PutFunctionConcurrency](API_PutFunctionConcurrency.md)\.
Type: Integer
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_AccountLimit.md
|
682356c15c02-1
|
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_AccountLimit.md
|
0f8af7179166-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/AccountLimit)
+ [AWS SDK for Go](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/AccountLimit)
+ [AWS SDK for Java](https://docs.aws.amazon.com/goto/SdkForJava/lambda-2015-03-31/AccountLimit)
+ [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/AccountLimit)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/API_AccountLimit.md
|
3020fb9b5847-0
|
Lambda integrates with Amazon Elastic File System \(Amazon EFS\) to support secure, shared file system access for Lambda applications\. You can configure functions to mount a file system during initialization with the NFS protocol over the local network within a VPC\. Lambda manages the connection and encrypts all traffic to and from the file system\.
The file system and the Lambda function must be in the same region\. A Lambda function in one account can mount a file system in a different account\. For this scenario, you configure VPC peering between the function VPC and the file system VPC\.
**Note**
To configure a function to connect to a file system, see [Configuring file system access for Lambda functions](configuration-filesystem.md)\.
Amazon EFS supports [file locking](https://docs.aws.amazon.com/efs/latest/ug/how-it-works.html#consistency) to prevent corruption if multiple functions try to write to the same file system at the same time\. Locking in Amazon EFS follows the NFS v4\.1 protocol for advisory locking, and enables your applications to use both whole file and byte range locks\.
Amazon EFS provides options to customize your file system based on your application's need to maintain high performance at scale\. There are three primary factors to consider: the number of connections, throughput \(in MiB per second\), and IOPS\.
**Quotas**
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-efs.md
|
3020fb9b5847-1
|
**Quotas**
For detail on file system quotas and limits, see [Quotas for Amazon EFS file systems](https://docs.aws.amazon.com/efs/latest/ug/limits.html#limits-fs-specific) in the *Amazon Elastic File System User Guide*\.
To avoid issues with scaling, throughput, and IOPS, monitor the [metrics](https://docs.aws.amazon.com/efs/latest/ug/monitoring-cloudwatch.html) that Amazon EFS sends to Amazon CloudWatch\. For an overview of monitoring in Amazon EFS, see [Monitoring Amazon EFS](https://docs.aws.amazon.com/efs/latest/ug/monitoring_overview.html) in the *Amazon Elastic File System User Guide*\.
**Topics**
+ [Connections](#services-efs-connections)
+ [Throughput](#services-efs-throughput)
+ [IOPS](#services-efs-iops)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-efs.md
|
08cf6bc72fea-0
|
Amazon EFS supports up to 25,000 connections per file system\. During initialization, each instance of a function creates a single connection to its file system that persists across invocations\. This means that you can reach 25,000 concurrency across one or more functions connected to a file system\. To limit the number of connections a function creates, use [reserved concurrency](configuration-concurrency.md)\.
However, when you make changes to your function's code or configuration at scale, there is a temporary increase in the number of function instances beyond the current concurrency\. Lambda provisions new instances to handle new requests and there is some delay before old instances close their connections to the file system\. To avoid hitting the maximum connections limit during a deployment, use [rolling deployments](lambda-rolling-deployments.md)\. With rolling deployments, you gradually shift traffic to the new version each time you make a change\.
If you connect to the same file system from other services such as Amazon EC2, you should also be aware of the scaling behavior of connections in Amazon EFS\. A file system supports the creation of up to 3,000 connections in a burst, after which it supports 500 new connections per minute\. This matches [burst scaling](invocation-scaling.md) behavior in Lambda, which applies across all functions in a Region\. But if you are creating connections outside of Lambda, your functions may not be able to scale at full speed\.
To monitor and trigger an alarm on connections, use the `ClientConnections` metric\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-efs.md
|
03681fb8c312-0
|
At scale, it is also possible to exceed the maximum *throughput* for a file system\. In *bursting mode* \(the default\), a file system has a low baseline throughput that scales linearly with its size\. To allow for bursts of activity, the file system is granted burst credits that allow it to use 100 MiB/s or more of throughput\. Credits accumulate continually and are expended with every read and write operation\. If the file system runs out of credits, it throttles read and write operations beyond the baseline throughput, which can cause invocations to time out\.
**Note**
If you use [provisioned concurrency](configuration-concurrency.md), your function can consume burst credits even when idle\. With provisioned concurrency, Lambda initializes instances of your function before it is invoked, and recycles instances every few hours\. If you use files on an attached file system during initialization, this activity can use all of your burst credits\.
To monitor and trigger an alarm on throughput, use the `BurstCreditBalance` metric\. It should increase when your function's concurrency is low and decrease when it is high\. If it always decreases or does not accumulate enough during low activity to cover peak traffic, you may need to limit your function's concurrency or enable [provisioned throughput](https://docs.aws.amazon.com/efs/latest/ug/performance.html#throughput-modes)\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-efs.md
|
f65bca85fb64-0
|
Input/output operations per second \(IOPS\) is a measurement of the number of read and write operations processed by the file system\. In general purpose mode, IOPS is limited in favor of lower latency, which is beneficial for most applications\.
To monitor and alarm on IOPS in general purpose mode, use the `PercentIOLimit` metric\. If this metric reaches 100%, your function can time out waiting for read and write operations to complete\.
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/services-efs.md
|
32bfb00e2c35-0
|
A deployment package is a ZIP archive that contains your function code and dependencies\. You need to create a deployment package if you use the Lambda API to manage functions, or if you need to include libraries and dependencies other than the AWS SDK\. You can upload the package directly to Lambda, or you can use an Amazon S3 bucket, and then upload it to Lambda\. If the deployment package is larger than 50 MB, you must use Amazon S3\.
If you use the Lambda [console editor](code-editor.md) to author your function, the console manages the deployment package\. You can use this method as long as you don't need to add any libraries\. You can also use it to update a function that already has libraries in the deployment package, as long as the total size doesn't exceed 3 MB\.
**Note**
To keep your deployment package size small, package your function's dependencies in layers\. Layers let you manage your dependencies independently, can be used by multiple functions, and can be shared with other accounts\. For details, see [AWS Lambda layers](configuration-layers.md)\.
**Topics**
+ [Updating a function with no dependencies](#ruby-package-codeonly)
+ [Updating a function with additional dependencies](#ruby-package-dependencies)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/ruby-package.md
|
b00677569c2e-0
|
To update a function by using the Lambda API, use the [UpdateFunctionCode](API_UpdateFunctionCode.md) operation\. Create an archive that contains your function code, and upload it using the AWS CLI\.
**To update a Ruby function with no dependencies**
1. Create a ZIP archive\.
```
~/my-function$ zip function.zip function.rb
```
1. Use the `update-function-code` command to upload the package\.
```
~/my-function$ aws lambda update-function-code --function-name my-function --zip-file fileb://function.zip
{
"FunctionName": "my-function",
"FunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:my-function",
"Runtime": "ruby2.5",
"Role": "arn:aws:iam::123456789012:role/lambda-role",
"Handler": "function.handler",
"CodeSha256": "Qf0hMc1I2di6YFMi9aXm3JtGTmcDbjniEuiYonYptAk=",
"Version": "$LATEST",
"TracingConfig": {
"Mode": "Active"
},
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/ruby-package.md
|
b00677569c2e-1
|
"Version": "$LATEST",
"TracingConfig": {
"Mode": "Active"
},
"RevisionId": "983ed1e3-ca8e-434b-8dc1-7d72ebadd83d",
...
}
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/ruby-package.md
|
4c225331d499-0
|
If your function depends on libraries other than the AWS SDK for Ruby, install them to a local directory with [Bundler](https://bundler.io/), and include them in your deployment package\.
**To update a Ruby function with dependencies**
1. Install libraries in the vendor directory with the `bundle` command\.
```
~/my-function$ bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/..............
Resolving dependencies...
Fetching aws-eventstream 1.0.1
Installing aws-eventstream 1.0.1
...
```
The `--path` installs the gems in the project directory instead of the system location, and sets this as the default path for future installations\. To later install gems globally, use the `--system` option\.
1. Create a ZIP archive\.
```
package$ zip -r function.zip function.rb vendor
adding: function.rb (deflated 37%)
adding: vendor/ (stored 0%)
adding: vendor/bundle/ (stored 0%)
adding: vendor/bundle/ruby/ (stored 0%)
adding: vendor/bundle/ruby/2.7.0/ (stored 0%)
adding: vendor/bundle/ruby/2.7.0/build_info/ (stored 0%)
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/ruby-package.md
|
4c225331d499-1
|
adding: vendor/bundle/ruby/2.7.0/build_info/ (stored 0%)
adding: vendor/bundle/ruby/2.7.0/cache/ (stored 0%)
adding: vendor/bundle/ruby/2.7.0/cache/aws-eventstream-1.0.1.gem (deflated 36%)
...
```
1. Update the function code\.
```
~/my-function$ aws lambda update-function-code --function-name my-function --zip-file fileb://function.zip
{
"FunctionName": "my-function",
"FunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:my-function",
"Runtime": "ruby2.5",
"Role": "arn:aws:iam::123456789012:role/lambda-role",
"Handler": "function.handler",
"CodeSize": 300,
"CodeSha256": "Qf0hMc1I2di6YFMi9aXm3JtGTmcDbjniEuiYonYptAk=",
"Version": "$LATEST",
"RevisionId": "983ed1e3-ca8e-434b-8dc1-7d72ebadd83d",
...
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/ruby-package.md
|
4c225331d499-2
|
...
}
```
|
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-lambda-developer-guide/doc_source/ruby-package.md
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.