Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc_source/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ The following are recommended best practices for using AWS Lambda:
exports.myHandler = function(event, context, callback) {
var foo = event.foo;
var bar = event.bar;
var result = MyLambdaFunction (foo, bar);
var result = myCoreLogic(foo, bar);

callback(null, result);
}

function MyLambdaFunction (foo, bar) {
// MyLambdaFunction logic here
function myCoreLogic(foo, bar) {
// core logic here
}
```
+ **Take advantage of Execution Context reuse to improve the performance of your function\. ** Make sure any externalized configuration or dependencies that your code retrieves are stored and referenced locally after initial execution\. Limit the re\-initialization of variables/objects on every invocation\. Instead use static initialization/constructor, global/static variables and singletons\. Keep alive and reuse connections \(HTTP, database, etc\.\) that were established during a previous invocation\.
Expand Down Expand Up @@ -71,4 +71,4 @@ When there are not enough records to process, instead of waiting, the stream pro
+ **Lambda creates elastic network interfaces [\(ENIs\)](http://docs.aws.amazon.com/AmazonVPC/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\.
+ **Create dedicated Lambda subnets in your VPC: **
+ 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)
+ This also allows you to dedicate an address space to Lambda without sharing it with other resources\.
+ This also allows you to dedicate an address space to Lambda without sharing it with other resources\.