capabilities.work

Deploy Function With Event Source

A 5-step recipe with Amazon Lambda. We can help you get access.

Recipe · 5 steps

Deploy Function With Event Source

Create a function, wait for Active, then attach and enable an event source mapping.

  1. Create the Lambda function. It is typically returned in the Pending state.
  2. Poll the function until Lambda reports it Active. A Failed state branches to the failure handler.
  3. Create an event source mapping that wires the supplied event source to the now-Active function.
  4. Poll the mapping by UUID until it finishes provisioning and reports the Enabled state.
  5. Re-read the function when it has entered the Failed state so the caller can surface the terminal state before any mapping is created.
What you'll need to have ready
  • FunctionName: The name of the Lambda function to create.
  • Runtime: The function's runtime identifier (e.g. nodejs20.x).
  • Role: The execution role ARN the function assumes.
  • Handler: The handler Lambda calls to begin execution.
  • EventSourceArn: The ARN of the event source to wire to the function.
  • BatchSize: The maximum number of records in each batch.
For your developer

Arazzo workflow amazon-lambda:deploy-with-event-source, 5 operations: CreateFunction → GetFunction → CreateEventSourceMapping → GetEventSourceMapping → GetFunction. Specs on APIs.io.