Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion doc_source/nodejs-prog-model-handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The following example function logs the contents of the event object and returns
**Example index\.js**

```

exports.handler = async function(event, context) {
console.log("EVENT: \n" + JSON.stringify(event, null, 2))
return context.logStreamName
Expand Down Expand Up @@ -96,4 +97,4 @@ exports.handler = function(event, context, callback) {
console.log('Timeout complete.')
}, 5000)
}
```
```
1 change: 1 addition & 0 deletions doc_source/programming-model-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ You write code for your Lambda function in one of the languages AWS Lambda suppo

Logging is subject to [CloudWatch Logs limits](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html)\. Log data can be lost due to throttling or, in some cases, when the [execution context](running-lambda-code.md) is terminated\.
+ **Exceptions** – Your Lambda function needs to communicate the result of the function execution to AWS Lambda\. Depending on the language you author your Lambda function code, there are different ways to end a request successfully or to notify AWS Lambda an error occurred during execution\. If you invoke the function synchronously, then AWS Lambda forwards the result back to the client\.

+ **Concurrency** – When your function is invoked more quickly than a single instance of your function can process events, Lambda scales by running additional instances\. Each instance of your function handles only one request at a time, so you don't need to worry about synchronizing threads or processes\. You can, however, use asynchronous language features to process batches of events in parallel, and save data to the `/tmp` directory for use in future invocations on the same instance\.

Your Lambda function code must be written in a stateless style, and have no affinity with the underlying compute infrastructure\. Your code should expect local file system access, child processes, and similar artifacts to be limited to the lifetime of the request\. Persistent state should be stored in Amazon S3, Amazon DynamoDB, or another cloud storage service\. Requiring functions to be stateless enables AWS Lambda to launch as many copies of a function as needed to scale to the incoming rate of events and requests\. These functions may not always run on the same compute instance from request to request, and a given instance of your Lambda function may be used more than once by AWS Lambda\. For more information, see [Best Practices for Working with AWS Lambda Functions](best-practices.md)\.
Expand Down