Synchronous & Asynchronous Lambda

  • Several AWS services, such as S3 and SNS, invoke functions asynchronously to process events.

  • When you invoke a function asynchronously, you don't wait for a response from the function code.

  • You hand off the event to Lambda and Lambda handles the rest.

  • You can configure how Lambda handles errors, and can send invocation records to a downstream resource to chain together components of your application.

  • Lambda supports the synchronous and asynchronous invocation of a Lambda function.

  • You can control the invocation type only when you invoke a Lambda function.

  • When you use an AWS service as a trigger, the invocation type is predetermined for each service.

  • You have no control over the invocation type that these event sources use when they invoke your Lambda function.

  • For short-term, Lambda is a very cost-effective choice.

  • You can use a Lambda function to process messages in an SQS queue.

    • Lambda event source mappings support standard queues and FIFO queues.

  • With SQS, you can offload tasks from one component of your application by sending them to a queue and processing them asynchronously.

  • Kinesis Data Streams is a real-time data streaming service that requires the provisioning of shards.

    • With SQS only pay for what you use, so it is a cheaper alternative.

  • If you don't need real-time processing, replacing Kinesis Data Streams with SQS would lower costs.

Last updated

Was this helpful?