Synchronous vs Asynchronous Invocations

When you manually invoke a lambda function or when your custom-built application invokes it, you have the ability to use the ‘invoke’ option which allows you to specify if the function should be invoked synchronously or asynchronously.

When a function is invoked synchronously, it enables you to assess the result before moving onto the next operation required. You may need to know the outcome of one function before using the value or result within another function.

If you want to control the flow of your functions, then synchronous invocations can help you maintain order.

Asynchronous invocations can be used when there is no need to maintain an order of function execution.

When event sources are used to call and invoke your function the invocation type is dependent on the service:

  1. For poll-based event sources, the invocation type is always synchronous
  2. For push-based event sources, it varies on the service