Class EventSourceMapping
Provides a Lambda event source mapping. This allows Lambda functions to get events from Kinesis, DynamoDB and SQS.
For information about Lambda and how to use it, see What is AWS Lambda?. For information about event source mappings, see CreateEventSourceMapping in the API docs.
Example Usage
DynamoDB
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.Lambda.EventSourceMapping("example", new Aws.Lambda.EventSourceMappingArgs
{
EventSourceArn = aws_dynamodb_table.Example.Stream_arn,
FunctionName = aws_lambda_function.Example.Arn,
StartingPosition = "LATEST",
});
}
}
Kinesis
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.Lambda.EventSourceMapping("example", new Aws.Lambda.EventSourceMappingArgs
{
EventSourceArn = aws_kinesis_stream.Example.Arn,
FunctionName = aws_lambda_function.Example.Arn,
StartingPosition = "LATEST",
});
}
}
SQS
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.Lambda.EventSourceMapping("example", new Aws.Lambda.EventSourceMappingArgs
{
EventSourceArn = aws_sqs_queue.Sqs_queue_test.Arn,
FunctionName = aws_lambda_function.Example.Arn,
});
}
}
Inherited Members
Namespace: Pulumi.Aws.Lambda
Assembly: Pulumi.Aws.dll
Syntax
public class EventSourceMapping : CustomResource
Constructors
View SourceEventSourceMapping(String, EventSourceMappingArgs, CustomResourceOptions)
Create a EventSourceMapping resource with the given unique name, arguments, and options.
Declaration
public EventSourceMapping(string name, EventSourceMappingArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| EventSourceMappingArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceBatchSize
The largest number of records that Lambda will retrieve from your event source at the time of invocation. Defaults to 100 for DynamoDB and Kinesis, 10 for SQS.
Declaration
public Output<int?> BatchSize { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
BisectBatchOnFunctionError
Declaration
public Output<bool?> BisectBatchOnFunctionError { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
DestinationConfig
Declaration
public Output<EventSourceMappingDestinationConfig> DestinationConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<EventSourceMappingDestinationConfig> |
Enabled
Determines if the mapping will be enabled on creation. Defaults to true.
Declaration
public Output<bool?> Enabled { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
EventSourceArn
The event source ARN - can be a Kinesis stream, DynamoDB stream, or SQS queue.
Declaration
public Output<string> EventSourceArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
FunctionArn
The the ARN of the Lambda function the event source mapping is sending events to. (Note: this is a computed value that differs from function_name above.)
Declaration
public Output<string> FunctionArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
FunctionName
The name or the ARN of the Lambda function that will be subscribing to events.
Declaration
public Output<string> FunctionName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
LastModified
The date this resource was last modified.
Declaration
public Output<string> LastModified { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
LastProcessingResult
The result of the last AWS Lambda invocation of your Lambda function.
Declaration
public Output<string> LastProcessingResult { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
MaximumBatchingWindowInSeconds
The maximum amount of time to gather records before invoking the function, in seconds. Records will continue to buffer until either maximum_batching_window_in_seconds expires or batch_size has been met. Defaults to as soon as records are available in the stream. If the batch it reads from the stream only has one record in it, Lambda only sends one record to the function.
Declaration
public Output<int?> MaximumBatchingWindowInSeconds { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
MaximumRecordAgeInSeconds
Declaration
public Output<int> MaximumRecordAgeInSeconds { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
MaximumRetryAttempts
Declaration
public Output<int> MaximumRetryAttempts { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
ParallelizationFactor
Declaration
public Output<int> ParallelizationFactor { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
StartingPosition
The position in the stream where AWS Lambda should start reading. Must be one of AT_TIMESTAMP (Kinesis only), LATEST or TRIM_HORIZON if getting events from Kinesis or DynamoDB. Must not be provided if getting events from SQS. More information about these positions can be found in the AWS DynamoDB Streams API Reference and AWS Kinesis API Reference.
Declaration
public Output<string> StartingPosition { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
StartingPositionTimestamp
A timestamp in RFC3339 format of the data record which to start reading when using starting_position set to AT_TIMESTAMP. If a record with this exact timestamp does not exist, the next later record is chosen. If the timestamp is older than the current trim horizon, the oldest available record is chosen.
parallelization_factor: - (Optional) The number of batches to process from each shard concurrently. Only available for stream sources (DynamoDB and Kinesis). Minimum and default of 1, maximum of 10.maximum_retry_attempts: - (Optional) The maximum number of times to retry when the function returns an error. Only available for stream sources (DynamoDB and Kinesis). Minimum of 0, maximum and default of 10000.maximum_record_age_in_seconds: - (Optional) The maximum age of a record that Lambda sends to a function for processing. Only available for stream sources (DynamoDB and Kinesis). Minimum of 60, maximum and default of 604800.bisect_batch_on_function_error: - (Optional) If the function returns an error, split the batch in two and retry. Only available for stream sources (DynamoDB and Kinesis). Defaults tofalse.destination_config: - (Optional) An Amazon SQS queue or Amazon SNS topic destination for failed records. Only available for stream sources (DynamoDB and Kinesis). Detailed below.
Declaration
public Output<string> StartingPositionTimestamp { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
State
The state of the event source mapping.
Declaration
public Output<string> State { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
StateTransitionReason
The reason the event source mapping is in its current state.
Declaration
public Output<string> StateTransitionReason { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Uuid
The UUID of the created event source mapping.
Declaration
public Output<string> Uuid { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, EventSourceMappingState, CustomResourceOptions)
Get an existing EventSourceMapping resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static EventSourceMapping Get(string name, Input<string> id, EventSourceMappingState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| EventSourceMappingState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| EventSourceMapping |