DocumentDB
The object describing a DocumentDB event source type. For more information, see
Using AWS Lambda with Amazon DocumentDB in the
AWS Lambda Developer Guide.
Syntax
To declare this entity in your AWS SAM template, use the following syntax.
YAML
BatchSize:IntegerCluster:StringCollectionName:StringDatabaseName:StringEnabled:BooleanFilterCriteria:FilterCriteriaFullDocument:StringKmsKeyArn:StringMaximumBatchingWindowInSeconds:IntegerSecretsManagerKmsKeyId:StringSourceAccessConfigurations:ListStartingPosition:StringStartingPositionTimestamp:Double
Properties
-
BatchSize -
The maximum number of items to retrieve in a single batch.
Type: Integer
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
BatchSizeproperty of anAWS::Lambda::EventSourceMappingresource. -
Cluster -
The Amazon Resource Name (ARN) of the Amazon DocumentDB cluster.
Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
EventSourceArnproperty of anAWS::Lambda::EventSourceMappingresource. -
CollectionName -
The name of the collection to consume within the database. If you do not specify a collection, Lambda consumes all collections.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
CollectionNameproperty of anAWS::Lambda::EventSourceMappingDocumentDBEventSourceConfigdata type. -
DatabaseName -
The name of the database to consume within the Amazon DocumentDB cluster.
Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
DatabaseNameproperty of anAWS::Lambda::EventSourceMappingDocumentDBEventSourceConfigdata type. -
Enabled -
If
true, the event source mapping is active. To pause polling and invocation, set tofalse.Type: Boolean
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
Enabledproperty of anAWS::Lambda::EventSourceMappingresource. -
FilterCriteria -
An object that defines the criteria that determines whether Lambda should process an event. For more information, see Lambda event filtering in the AWS Lambda Developer Guide.
Type: FilterCriteria
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
FilterCriteriaproperty of anAWS::Lambda::EventSourceMappingresource. -
FullDocument -
Determines what Amazon DocumentDB sends to your event stream during document update operations. If set to
UpdateLookup, Amazon DocumentDB sends a delta describing the changes, along with a copy of the entire document. Otherwise, Amazon DocumentDB sends only a partial document that contains the changes.Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
FullDocumentproperty of anAWS::Lambda::EventSourceMappingDocumentDBEventSourceConfigdata type. -
KmsKeyArn -
The Amazon Resource Name (ARN) of the key to encrypt information related to this event.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
KmsKeyArnproperty of anAWS::Lambda::EventSourceMappingresource. -
MaximumBatchingWindowInSeconds -
The maximum amount of time to gather records before invoking the function, in seconds.
Type: Integer
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
MaximumBatchingWindowInSecondsproperty of anAWS::Lambda::EventSourceMappingresource. -
SecretsManagerKmsKeyId -
The AWS Key Management Service (AWS KMS) key ID of a customer managed key from AWS Secrets Manager. Required when you use a customer managed key from Secrets Manager with a Lambda execution role that doesn’t include the
kms:Decryptpermission.The value of this property is a UUID. For example:
1abc23d4-567f-8ab9-cde0-1fab234c5d67.Type: String
Required: Conditional
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn’t have an AWS CloudFormation equivalent.
-
SourceAccessConfigurations -
An array of the authentication protocol or virtual host. Specify this using the SourceAccessConfigurations data type.
For the
DocumentDBevent source type, the only valid configuration type isBASIC_AUTH.-
BASIC_AUTH– The Secrets Manager secret that stores your broker credentials. For this type, the credential must be in the following format:{"username": "your-username", "password": "your-password"}. Only one object of typeBASIC_AUTHis allowed.
Type: List
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
SourceAccessConfigurationsproperty of anAWS::Lambda::EventSourceMappingresource. -
-
StartingPosition -
The position in a stream from which to start reading.
-
AT_TIMESTAMP– Specify a time from which to start reading records. -
LATEST– Read only new records. -
TRIM_HORIZON– Process all available records.
Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
StartingPositionproperty of anAWS::Lambda::EventSourceMappingresource. -
-
StartingPositionTimestamp -
The time from which to start reading, in Unix time seconds. Define
StartingPositionTimestampwhenStartingPositionis specified asAT_TIMESTAMP.Type: Double
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
StartingPositionTimestampproperty of anAWS::Lambda::EventSourceMappingresource.
Examples
Amazon DocumentDB event source
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 ... Resources: MyFunction: Type: AWS::Serverless::Function Properties: ... Events: MyDDBEvent: Type: DocumentDB Properties: Cluster: "arn:aws:rds:us-west-2:123456789012:cluster:docdb-2023-01-01" BatchSize: 10 MaximumBatchingWindowInSeconds: 5 DatabaseName: "db1" CollectionName: "collection1" FullDocument: "UpdateLookup" SourceAccessConfigurations: - Type: BASIC_AUTH URI: "arn:aws:secretsmanager:us-west-2:123456789012:secret:doc-db"