Class CfnEventSourceMapping
A CloudFormation AWS::Lambda::EventSourceMapping
.
Inherited Members
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.AWS.Lambda.dll
Syntax (csharp)
public class CfnEventSourceMapping : CfnResource, IConstruct, IDependable, IInspectable
Syntax (vb)
Public Class CfnEventSourceMapping
Inherits CfnResource
Implements IConstruct, IDependable, IInspectable
Remarks
The AWS::Lambda::EventSourceMapping
resource creates a mapping between an event source and an AWS Lambda function. Lambda reads items from the event source and triggers the function.
For details about each event source type, see the following topics. In particular, each of the topics describes the required and optional parameters for the specific event source.
CloudformationResource: AWS::Lambda::EventSourceMapping
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lambda;
var cfnEventSourceMapping = new CfnEventSourceMapping(this, "MyCfnEventSourceMapping", new CfnEventSourceMappingProps {
FunctionName = "functionName",
// the properties below are optional
AmazonManagedKafkaEventSourceConfig = new AmazonManagedKafkaEventSourceConfigProperty {
ConsumerGroupId = "consumerGroupId"
},
BatchSize = 123,
BisectBatchOnFunctionError = false,
DestinationConfig = new DestinationConfigProperty {
OnFailure = new OnFailureProperty {
Destination = "destination"
}
},
DocumentDbEventSourceConfig = new DocumentDBEventSourceConfigProperty {
CollectionName = "collectionName",
DatabaseName = "databaseName",
FullDocument = "fullDocument"
},
Enabled = false,
EventSourceArn = "eventSourceArn",
FilterCriteria = new FilterCriteriaProperty {
Filters = new [] { new FilterProperty {
Pattern = "pattern"
} }
},
FunctionResponseTypes = new [] { "functionResponseTypes" },
MaximumBatchingWindowInSeconds = 123,
MaximumRecordAgeInSeconds = 123,
MaximumRetryAttempts = 123,
ParallelizationFactor = 123,
Queues = new [] { "queues" },
ScalingConfig = new ScalingConfigProperty {
MaximumConcurrency = 123
},
SelfManagedEventSource = new SelfManagedEventSourceProperty {
Endpoints = new EndpointsProperty {
KafkaBootstrapServers = new [] { "kafkaBootstrapServers" }
}
},
SelfManagedKafkaEventSourceConfig = new SelfManagedKafkaEventSourceConfigProperty {
ConsumerGroupId = "consumerGroupId"
},
SourceAccessConfigurations = new [] { new SourceAccessConfigurationProperty {
Type = "type",
Uri = "uri"
} },
StartingPosition = "startingPosition",
StartingPositionTimestamp = 123,
Topics = new [] { "topics" },
TumblingWindowInSeconds = 123
});
Synopsis
Constructors
CfnEventSourceMapping(Construct, String, ICfnEventSourceMappingProps) | Create a new |
CfnEventSourceMapping(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnEventSourceMapping(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
AmazonManagedKafkaEventSourceConfig | Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source. |
AttrId | The event source mapping's ID. |
BatchSize | The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. |
BisectBatchOnFunctionError | (Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
DestinationConfig | (Kinesis and DynamoDB Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records. |
DocumentDbEventSourceConfig | Specific configuration settings for a DocumentDB event source. |
Enabled | When true, the event source mapping is active. When false, Lambda pauses polling and invocation. |
EventSourceArn | The Amazon Resource Name (ARN) of the event source. |
FilterCriteria | An object that defines the filter criteria that determine whether Lambda should process an event. |
FunctionName | The name of the Lambda function. |
FunctionResponseTypes | (Streams and SQS) A list of current response type enums applied to the event source mapping. |
MaximumBatchingWindowInSeconds | The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. |
MaximumRecordAgeInSeconds | (Kinesis and DynamoDB Streams only) Discard records older than the specified age. |
MaximumRetryAttempts | (Kinesis and DynamoDB Streams only) Discard records after the specified number of retries. |
ParallelizationFactor | (Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard. |
Queues | (Amazon MQ) The name of the Amazon MQ broker destination queue to consume. |
ScalingConfig | (Amazon SQS only) The scaling configuration for the event source. |
SelfManagedEventSource | The self-managed Apache Kafka cluster for your event source. |
SelfManagedKafkaEventSourceConfig | Specific configuration settings for a self-managed Apache Kafka event source. |
SourceAccessConfigurations | An array of the authentication protocol, VPC components, or virtual host to secure and define your event source. |
StartingPosition | The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB. |
StartingPositionTimestamp | With |
Topics | The name of the Kafka topic. |
TumblingWindowInSeconds | (Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnEventSourceMapping(Construct, String, ICfnEventSourceMappingProps)
Create a new AWS::Lambda::EventSourceMapping
.
public CfnEventSourceMapping(Construct scope, string id, ICfnEventSourceMappingProps props)
Parameters
- scope Construct
- scope in which this resource is defined.
- id System.String
- scoped id of the resource.
- props ICfnEventSourceMappingProps
- resource properties.
CfnEventSourceMapping(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnEventSourceMapping(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnEventSourceMapping(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnEventSourceMapping(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
AmazonManagedKafkaEventSourceConfig
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
public virtual object AmazonManagedKafkaEventSourceConfig { get; set; }
Property Value
System.Object
Remarks
AttrId
The event source mapping's ID.
public virtual string AttrId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Id
BatchSize
The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function.
public virtual Nullable<double> BatchSize { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).
BisectBatchOnFunctionError
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry.
public virtual object BisectBatchOnFunctionError { get; set; }
Property Value
System.Object
Remarks
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
DestinationConfig
(Kinesis and DynamoDB Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.
public virtual object DestinationConfig { get; set; }
Property Value
System.Object
Remarks
DocumentDbEventSourceConfig
Specific configuration settings for a DocumentDB event source.
public virtual object DocumentDbEventSourceConfig { get; set; }
Property Value
System.Object
Remarks
Enabled
When true, the event source mapping is active. When false, Lambda pauses polling and invocation.
public virtual object Enabled { get; set; }
Property Value
System.Object
Remarks
EventSourceArn
The Amazon Resource Name (ARN) of the event source.
public virtual string EventSourceArn { get; set; }
Property Value
System.String
Remarks
FilterCriteria
An object that defines the filter criteria that determine whether Lambda should process an event.
public virtual object FilterCriteria { get; set; }
Property Value
System.Object
Remarks
FunctionName
The name of the Lambda function.
public virtual string FunctionName { get; set; }
Property Value
System.String
Remarks
Name formats - Function name – MyFunction
.
The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.
FunctionResponseTypes
(Streams and SQS) A list of current response type enums applied to the event source mapping.
public virtual string[] FunctionResponseTypes { get; set; }
Property Value
System.String[]
Remarks
Valid Values: ReportBatchItemFailures
MaximumBatchingWindowInSeconds
The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function.
public virtual Nullable<double> MaximumBatchingWindowInSeconds { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default ( Kinesis , DynamoDB , Amazon SQS event sources) : 0
Default ( Amazon MSK , Kafka, Amazon MQ , Amazon DocumentDB event sources) : 500 ms
Related setting: For Amazon SQS event sources, when you set BatchSize
to a value greater than 10, you must set MaximumBatchingWindowInSeconds
to at least 1.
MaximumRecordAgeInSeconds
(Kinesis and DynamoDB Streams only) Discard records older than the specified age.
public virtual Nullable<double> MaximumRecordAgeInSeconds { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.
The minimum valid value for maximum record age is 60s. Although values less than 60 and greater than -1 fall within the parameter's absolute range, they are not allowed
MaximumRetryAttempts
(Kinesis and DynamoDB Streams only) Discard records after the specified number of retries.
public virtual Nullable<double> MaximumRetryAttempts { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.
ParallelizationFactor
(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard.
public virtual Nullable<double> ParallelizationFactor { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Queues
(Amazon MQ) The name of the Amazon MQ broker destination queue to consume.
public virtual string[] Queues { get; set; }
Property Value
System.String[]
Remarks
ScalingConfig
(Amazon SQS only) The scaling configuration for the event source.
public virtual object ScalingConfig { get; set; }
Property Value
System.Object
Remarks
SelfManagedEventSource
The self-managed Apache Kafka cluster for your event source.
public virtual object SelfManagedEventSource { get; set; }
Property Value
System.Object
Remarks
SelfManagedKafkaEventSourceConfig
Specific configuration settings for a self-managed Apache Kafka event source.
public virtual object SelfManagedKafkaEventSourceConfig { get; set; }
Property Value
System.Object
Remarks
SourceAccessConfigurations
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
public virtual object SourceAccessConfigurations { get; set; }
Property Value
System.Object
Remarks
StartingPosition
The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB.
public virtual string StartingPosition { get; set; }
Property Value
System.String
Remarks
StartingPositionTimestamp
With StartingPosition
set to AT_TIMESTAMP
, the time from which to start reading, in Unix time seconds.
public virtual Nullable<double> StartingPositionTimestamp { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Topics
The name of the Kafka topic.
public virtual string[] Topics { get; set; }
Property Value
System.String[]
Remarks
TumblingWindowInSeconds
(Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources.
public virtual Nullable<double> TumblingWindowInSeconds { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
A value of 0 seconds indicates no tumbling window.
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
- tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>