You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+**Separate the Lambda handler from your core logic\.** This allows you to make a more unit\-testable function\. In Node\.js this may look like:
13
13
14
14
```
@@ -34,7 +34,7 @@ The following are recommended best practices for using AWS Lambda:
34
34
+**Minimize the complexity of your dependencies\.** Prefer simpler frameworks that load quickly on [execution context](runtimes-context.md) startup\. For example, prefer simpler Java dependency injection \(IoC\) frameworks like [Dagger](https://google.github.io/dagger/) or [Guice](https://github.com/google/guice), over more complex ones like [Spring Framework](https://github.com/spring-projects/spring-framework)\.
35
35
+**Avoid using recursive code** in your Lambda function, wherein the function automatically calls itself until some arbitrary criteria is met\. This could lead to unintended volume of function invocations and escalated costs\. If you do accidentally do so, set the function concurrent execution limit to `0` immediately to throttle all invocations to the function, while you update the code\.
36
36
37
-
## Function Configuration<aname="function-configuration"></a>
37
+
## Function configuration<aname="function-configuration"></a>
38
38
+**Performance testing your Lambda function** is a crucial part in ensuring you pick the optimum memory size configuration\. Any increase in memory size triggers an equivalent increase in CPU available to your function\. The memory usage for your function is determined per\-invoke and can be viewed in [AWS CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatchLogs.html)\. On each invoke a `REPORT:` entry will be made, as shown below:
39
39
40
40
```
@@ -50,11 +50,11 @@ The following are recommended best practices for using AWS Lambda:
50
50
+ In the case of **CreateFunction**, AWS Lambda will fail the function creation process\.
51
51
+ In the case of **UpdateFunctionConfiguration**, it could result in duplicate invocations of the function\.
52
52
53
-
## Alarming and Metrics<aname="alarming-metrics"></a>
53
+
## Metrics and alarms<aname="alarming-metrics"></a>
54
54
+**Use [Working with AWS Lambda function metrics](monitoring-metrics.md) and [ CloudWatch Alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html)** instead of creating or updating a metric from within your Lambda function code\. It's a much more efficient way to track the health of your Lambda functions, allowing you to catch issues early in the development process\. For instance, you can configure an alarm based on the expected duration of your Lambda function execution time in order to address any bottlenecks or latencies attributable to your function code\.
55
55
+**Leverage your logging library and [AWS Lambda Metrics and Dimensions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/lam-metricscollected.html)** to catch app errors \(e\.g\. ERR, ERROR, WARNING, etc\.\)
## Working with streams<aname="stream-events"></a>
58
58
+**Test with different batch and record sizes **so that the polling frequency of each event source is tuned to how quickly your function is able to complete its task\.[BatchSize](API_CreateEventSourceMapping.md#SSS-CreateEventSourceMapping-request-BatchSize) controls the maximum number of records that can be sent to your function with each invoke\. A larger batch size can often more efficiently absorb the invoke overhead across a larger set of records, increasing your throughput\.
59
59
60
60
By default, Lambda invokes your function as soon as records are available in the stream\. If the batch it reads from the stream only has one record in it, Lambda only sends 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 5 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\.
Copy file name to clipboardExpand all lines: doc_source/lambda-releases.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ The following table describes the important changes to the *AWS Lambda Developer
4
4
5
5
| Change | Description | Date |
6
6
| --- |--- |--- |
7
-
|[AWS CDK sample applications in the Lambda console](https://docs.aws.amazon.com/lambda/latest/dg/applications-tutorial.html?icmpid=docs_lambda_rss)| The Lambda console now includes sample applications that use the AWS Cloud Development Kit \(AWS CDK\) for TypeScript\. The AWS CDK is a framework that enables you to define your application resources in TypeScript, Python, Java, or \.NET\. For details, see [Creating an application with continuous delivery in the Lambda console](https://docs.aws.amazon.com/lambda/latest/dg/applications-tutorial.html?icmpid=docs_lambda_rss)\.| June 1, 2020 |
7
+
|[AWS CDK sample applications in the Lambda console](https://docs.aws.amazon.com/lambda/latest/dg/applications-tutorial.html?icmpid=docs_lambda_rss)| The Lambda console now includes sample applications that use the AWS Cloud Development Kit \(AWS CDK\) for TypeScript\. The AWS CDK is a framework that enables you to define your application resources in TypeScript, Python, Java, or \.NET\. For a tutorial on creating applications, see [Creating an application with continuous delivery in the Lambda console](https://docs.aws.amazon.com/lambda/latest/dg/applications-tutorial.html?icmpid=docs_lambda_rss)\.| June 1, 2020 |
8
8
|[Support for \.NET Core 3\.1\.0 runtime in AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/csharp-package-cli.html?icmpid=docs_lambda_rss)| AWS Lambda now supports the \.NET Core 3\.1\.0 runtime\. For details, see [\.NET Core CLI](https://docs.aws.amazon.com/lambda/latest/dg/csharp-package-cli.html?icmpid=docs_lambda_rss)\.| March 31, 2020 |
9
9
|[Support for API Gateway HTTP APIs](https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html?icmpid=docs_lambda_rss)| Updated and expanded documentation for using Lambda with API Gateway, including support for HTTP APIs\. Added a sample application that creates an API and function with AWS CloudFormation\. For details, see [Using AWS Lambda with Amazon API Gateway](https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html?icmpid=docs_lambda_rss)\.| March 23, 2020 |
10
10
|[Ruby 2\.7](https://docs.aws.amazon.com/lambda/latest/dg/lambda-ruby.html?icmpid=docs_lambda_rss)| A new runtime is available for Ruby 2\.7, ruby2\.7, which is the first Ruby runtime to use Amazon Linux 2\. For details, see [Building Lambda functions with Ruby](https://docs.aws.amazon.com/lambda/latest/dg/lambda-ruby.html?icmpid=docs_lambda_rss)\.| February 19, 2020 |
0 commit comments