Skip to content

Commit 2a45dd9

Browse files
authored
Merge pull request #56 from kennyk65/patch-3
Update best-practices.md
2 parents d2164b3 + ff56d94 commit 2a45dd9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc_source/best-practices.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The following are recommended best practices for using AWS Lambda:
3030
+ **Use [AWS Lambda Environment Variables](env_variables.md) to pass operational parameters to your function\.** For example, if you are writing to an Amazon S3 bucket, instead of hard\-coding the bucket name you are writing to, configure the bucket name as an environment variable\.
3131
+ **Control the dependencies in your function's deployment package\. ** The AWS Lambda execution environment contains a number of libraries such as the AWS SDK for the Node\.js and Python runtimes \(a full list can be found here: [AWS Lambda Runtimes](lambda-runtimes.md)\)\. To enable the latest set of features and security updates, Lambda will periodically update these libraries\. These updates may introduce subtle changes to the behavior of your Lambda function\. To have full control of the dependencies your function uses, we recommend packaging all your dependencies with your deployment package\.
3232
+ **Minimize your deployment package size to its runtime necessities\. ** This will reduce the amount of time that it takes for your deployment package to be downloaded and unpacked ahead of invocation\. For functions authored in Java or \.NET Core, avoid uploading the entire AWS SDK library as part of your deployment package\. Instead, selectively depend on the modules which pick up components of the SDK you need \(e\.g\. DynamoDB, Amazon S3 SDK modules and [Lambda core libraries](https://github.com/aws/aws-lambda-java-libs)\)\.
33-
+ **Reduce the time it takes Lambda to unpack deployment packages** authored in Java by putting your dependency `.jar` files in a separate /lib directory\. This is faster than putting all your function’s code in a single jar with a large number of `.class` files\.
33+
+ **Reduce the time it takes Lambda to unpack deployment packages** authored in Java by putting your dependency `.jar` files in a separate /lib directory\. This is faster than putting all your function’s code in a single jar with a large number of `.class` files\. See [Creating a Java Deployment Package(lambda-java-how-to-create-deployment-package.html)]\.
3434
+ **Minimize the complexity of your dependencies\.** Prefer simpler frameworks that load quickly on [Execution Context](http://docs.aws.amazon.com/lambda/latest/dg/running-lambda-code.html) 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)\.
3535
+ **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\.
3636

@@ -71,4 +71,4 @@ When there are not enough records to process, instead of waiting, the stream pro
7171
+ **Lambda creates elastic network interfaces [\(ENIs\)](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_ElasticNetworkInterfaces.html)** in your VPC to access your internal resources\. Before requesting a concurrency increase, ensure you have enough ENI capacity \(the formula for this can be found here: [Configuring a Lambda Function to Access Resources in an Amazon VPC](vpc.md)\) and IP address space\. If you do not have enough ENI capacity, you will need to request an increase\. If you do not have enough IP address space, you may need to create a larger subnet\.
7272
+ **Create dedicated Lambda subnets in your VPC: **
7373
+ This will make it easier to apply a custom route table for NAT Gateway traffic without changing your other private/public subnets\. For more information, see [Configuring a Lambda Function to Access Resources in an Amazon VPC](vpc.md)
74-
+ This also allows you to dedicate an address space to Lambda without sharing it with other resources\.
74+
+ This also allows you to dedicate an address space to Lambda without sharing it with other resources\.

0 commit comments

Comments
 (0)