Best practices

This page was generated from content adapted from the AWS Developer Guide

Use timeouts to avoid stuck executions

  • Note You can set a timeout for your state machine using the TimeoutSeconds field in your Amazon States Language definition. For more information, see State Machine Structure.

Use Amazon S3 ARNs instead of passing large payloads

  • Note After you create this Lambda function, make sure you provide its IAM role the appropriate permission to read from an Amazon S3 bucket. For example, attach the AmazonS3ReadOnlyAccess permission to the Lambda function's role.

Handle Lambda service exceptions

  • Note Unhandled errors in Lambda are reported as Lambda.Unknown in the error output. These include out-of-memory errors and function timeouts. You can match on Lambda.Unknown, States.ALL, or States.TaskFailed to handle these errors. When Lambda hits the maximum number of invocations, the error is Lambda.TooManyRequestsException. For more information about Lambda function errors, see Error handling and automatic retries in the AWS Lambda Developer Guide.

Last updated