Amazon Lambda · Arazzo Workflow

Amazon Lambda Provision Event Source Mapping

Version 1.0.0

Create an event source mapping and poll it until it reaches the Enabled state.

1 workflow 1 source API 1 provider
View Spec View on GitHub ComputeEvent-DrivenFaaSFunctionsServerlessArazzoWorkflows

Provider

amazon-lambda

Workflows

provision-event-source-mapping
Create an event source mapping and wait until it is Enabled.
Creates a mapping between an event source and a Lambda function, then polls GetEventSourceMapping using the returned UUID until the State reported by Lambda is Enabled.
2 steps inputs: BatchSize, Enabled, EventSourceArn, FunctionName outputs: functionArn, state, uuid
1
createMapping
CreateEventSourceMapping
Create the event source mapping. Lambda returns the generated UUID and the initial State, usually Creating.
2
waitForEnabled
GetEventSourceMapping
Poll the mapping by UUID until Lambda finishes provisioning it and reports the Enabled state.

Source API Descriptions

Arazzo Workflow Specification

amazon-lambda-provision-event-source-mapping-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Amazon Lambda Provision Event Source Mapping
  summary: Create an event source mapping and poll it until it reaches the Enabled state.
  description: >-
    Wires an event source — such as an SQS queue, Kinesis stream, or DynamoDB
    stream — to a Lambda function. The workflow creates the mapping, captures the
    generated UUID, and polls GetEventSourceMapping until the mapping leaves the
    Creating and Enabling states and reports Enabled. Every step spells out its
    request inline so the flow can be read and executed without opening the
    underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: amazonLambdaApi
  url: ../openapi/amazon-lambda-openapi.yml
  type: openapi
workflows:
- workflowId: provision-event-source-mapping
  summary: Create an event source mapping and wait until it is Enabled.
  description: >-
    Creates a mapping between an event source and a Lambda function, then polls
    GetEventSourceMapping using the returned UUID until the State reported by
    Lambda is Enabled.
  inputs:
    type: object
    required:
    - EventSourceArn
    - FunctionName
    properties:
      EventSourceArn:
        type: string
        description: The ARN of the event source (e.g. an SQS queue or Kinesis stream).
      FunctionName:
        type: string
        description: The name or ARN of the Lambda function to invoke.
      BatchSize:
        type: integer
        description: The maximum number of records in each batch.
      Enabled:
        type: boolean
        description: Whether the mapping should be enabled when created.
  steps:
  - stepId: createMapping
    description: >-
      Create the event source mapping. Lambda returns the generated UUID and the
      initial State, usually Creating.
    operationId: CreateEventSourceMapping
    requestBody:
      contentType: application/json
      payload:
        EventSourceArn: $inputs.EventSourceArn
        FunctionName: $inputs.FunctionName
        BatchSize: $inputs.BatchSize
        Enabled: $inputs.Enabled
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      uuid: $response.body#/UUID
      initialState: $response.body#/State
  - stepId: waitForEnabled
    description: >-
      Poll the mapping by UUID until Lambda finishes provisioning it and reports
      the Enabled state.
    operationId: GetEventSourceMapping
    parameters:
    - name: UUID
      in: path
      value: $steps.createMapping.outputs.uuid
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      state: $response.body#/State
      functionArn: $response.body#/FunctionArn
    onSuccess:
    - name: mappingEnabled
      type: end
      criteria:
      - context: $response.body
        condition: $.State == "Enabled"
        type: jsonpath
    onFailure:
    - name: retryGet
      type: retry
      retryAfter: 5
      retryLimit: 20
      stepId: waitForEnabled
  outputs:
    uuid: $steps.createMapping.outputs.uuid
    state: $steps.waitForEnabled.outputs.state
    functionArn: $steps.waitForEnabled.outputs.functionArn