General Information
- By default, lambda execution time is up to 29 seconds invoked . In function settings, it can be increased to 15 minutes. Lambda invoked via API gateway is limited to 30 seconds and cannot be overwritten by cloudformation code.
- By default, 128M RAM, can be increased to 3GB
- stateless
- cold start – container needs to be created and initialized before function can be run
- worm start – container is already up and running
- Compare lambda invokation modes
- In synchronous invocations, if the Lambda function fails, retries are the responsibility of the trigger.
- Synchronous invocations are well suited for short-lived Lambda functions
- The Lambda service scales up the concurrency of the processing function as this internal queue grows.
- If an error occurs in the Lambda function, the retry behavior is determined by the Lambda service
Asynchronous invocation
-
-
-
- Destination:
functions: asyncHello: handler: handler.asyncHello destinations: onSuccess: otherFunctionInService onFailure: arn:aws:sns:us-east-1:xxxx:some-topic-name
- Stream-based lambdas have an entirely different way of creating the onFailure destination. You do not configure them on the function destination configuration, rather you do so in the AWS::Lambda::EventSourceMapping. In fact, you cannot even set an onSuccess destination. Presumably, because of scale reasons, AWS doesn’t want to give you the ability to run over the destination services with massively scaled stream infrastructure.
- Your EventSourceMapping onFailure destination can only be one of SNS or SQS
- For testing, you cannot use the console or CLI. It must be an event coming from the actual stream source. You’ll need to change or create records in DynamoDB or push stuff through Kinesis.
- When a function is asynchronously invoked, Lambda sends the event to a queue before it is processed by your function. Invocations that result in an exception in the function code are retried twice with a delay of one minute before the first retry and two minutes before the second. Some invocations may never run due to a throttle or service fault: these are retried with exponential back off until the invocation is six hours old.
- New AWS Lambda controls for stream processing and asynchronous invocations
- When processing data from event sources such as Amazon Kinesis Data Streams, and Amazon DynamoDB Streams, Lambda reads records in batches via shards. A shard is a uniquely identified sequence of data records. Your function is then invoked to process records from the batch “in order.” If an error is returned, Lambda retries the batch until processing succeeds or the data expires.
- Destination:
-
-
- Lambda invokation event filtering
- cloud formation example
- supported since November, 2021