Docs / Contact / connectors/aws-lambda

AWS Lambda

Provider: aws | Service: lambda | Direction: Read / Write

Amazon Lambda connector for invoking a serverless function. Invocation is synchronous (request/response): the function's response is captured into the flow step.

Required Permissions

Operation Required IAM Permissions
Invoke lambda:InvokeFunction
Tip: Scope permissions to the specific function ARN to follow the principle of least privilege.

Operation

When a message reaches this connector, it invokes the configured function. The payload may supply:

Payload field Required Description
functionName No Function name or ARN to invoke. Overrides the connector's configured function.
payload Yes JSON string passed to the Lambda function as its event payload

Connector Configuration

The connector is created with type: "cloud", provider: "aws", service_type: "lambda", plus:

Field (config) Required Description
auth_type No api_key (default) or role for cross-account access. See below.
region No AWS region code. Derived automatically if function_name is a full function ARN.
access_key Conditional AWS access key. Required when auth_type is api_key.
secret_key Conditional AWS secret key. Required when auth_type is api_key.
function_name Yes The Lambda function name or ARN to invoke.
Role-based (cross-account) authentication

Set auth_type: "role" to assume an IAM role in your AWS account via STS. Provide role_arn (required) and optionally external_id. With role auth you do not supply access_key/secret_key.

Output

json

{
  "status": "completed",
  "statusCode": 200,
  "data": {
    "status": "invoked",
    "statusCode": 200,
    "method": "LAMBDA_INVOKE",
    "endpoint": "process-device-event",
    "duration": 120,
    "response": { "result": "value" }
  }
}

If the function returns a FunctionError, status is failed, statusCode is 500, and an error field is included. Access the function's parsed response in subsequent steps via payload.data.response.

Example

Connector config (API key):

json

{
  "type": "cloud",
  "provider": "aws",
  "service_type": "lambda",
  "region": "us-east-1",
  "access_key": "${secrets.aws_access_key}",
  "secret_key": "${secrets.aws_secret_key}",
  "function_name": "process-device-event"
}

Connector config (cross-account role):

json

{
  "type": "cloud",
  "provider": "aws",
  "service_type": "lambda",
  "auth_type": "role",
  "region": "us-east-1",
  "role_arn": "arn:aws:iam::123456789012:role/contact-lambda-invoker",
  "function_name": "process-device-event"
}