Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . lambda ]

create-event-source-mapping

Description

Identifies a poll-based event source for a Lambda function. It can be either an Amazon Kinesis or DynamoDB stream, or an Amazon SQS queue. AWS Lambda invokes the specified function when records are posted to the event source.

This association between a poll-based source and a Lambda function is called the event source mapping.

You provide mapping information (for example, which stream or SQS queue to read from and which Lambda function to invoke) in the request body.

Amazon Kinesis or DynamoDB stream event sources can be associated with multiple AWS Lambda functions and a given Lambda function can be associated with multiple AWS event sources. For Amazon SQS, you can configure multiple queues as event sources for a single Lambda function, but an SQS queue can be mapped only to a single Lambda function.

If you are using versioning, you can specify a specific function version or an alias via the function name parameter. For more information about versioning, see AWS Lambda Function Versioning and Aliases .

This operation requires permission for the lambda:CreateEventSourceMapping action.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  create-event-source-mapping
--event-source-arn <value>
--function-name <value>
[--enabled | --no-enabled]
[--batch-size <value>]
[--starting-position <value>]
[--starting-position-timestamp <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--event-source-arn (string)

The Amazon Resource Name (ARN) of the event source. Any record added to this source could cause AWS Lambda to invoke your Lambda function, it depends on the batch-size . AWS Lambda POSTs the event's records to your Lambda function as JSON.

--function-name (string)

The Lambda function to invoke when AWS Lambda detects an event on the stream.

You can specify the function name (for example, Thumbnail ) or you can specify Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail ).

If you are using versioning, you can also provide a qualified function ARN (ARN that is qualified with function version or alias name as suffix). For more information about versioning, see AWS Lambda Function Versioning and Aliases

AWS Lambda also allows you to specify only the function name with the account ID qualifier (for example, account-id:Thumbnail ).

Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 characters in length.

--enabled | --no-enabled (boolean)

Indicates whether AWS Lambda should begin polling the event source. By default, enabled is true.

--batch-size (integer)

The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default for Amazon Kinesis and Amazon DynamoDB is 100 records. For SQS, the default is 1.

--starting-position (string)

The position in the DynamoDB or Kinesis stream where AWS Lambda should start reading. For more information, see GetShardIterator in the Amazon Kinesis API Reference Guide or GetShardIterator in the Amazon DynamoDB API Reference Guide . The AT_TIMESTAMP value is supported only for Kinesis streams .

Possible values:

  • TRIM_HORIZON
  • LATEST
  • AT_TIMESTAMP

--starting-position-timestamp (timestamp)

The timestamp of the data record from which to start reading. Used with shard iterator type AT_TIMESTAMP. If a record with this exact timestamp does not exist, the iterator returned is for the next (later) record. If the timestamp is older than the current trim horizon, the iterator returned is for the oldest untrimmed data record (TRIM_HORIZON). Valid only for Kinesis streams .

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Output

UUID -> (string)

The AWS Lambda assigned opaque identifier for the mapping.

BatchSize -> (integer)

The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records.

EventSourceArn -> (string)

The Amazon Resource Name (ARN) of the Amazon Kinesis or DynamoDB stream or the SQS queue that is the source of events.

FunctionArn -> (string)

The Lambda function to invoke when AWS Lambda detects an event on the poll-based source.

LastModified -> (timestamp)

The UTC time string indicating the last time the event mapping was updated.

LastProcessingResult -> (string)

The result of the last AWS Lambda invocation of your Lambda function.

State -> (string)

The state of the event source mapping. It can be Creating , enabled , Disabled , Enabling , Disabling , Updating , or Deleting .

StateTransitionReason -> (string)

The reason the event source mapping is in its current state. It is either user-requested or an AWS Lambda-initiated state transition.