Skip to content
v2.278.0

Experimental

@aws-cdk/aws-pipes-sources-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

DynamoDBSource Class ​

A source that reads from an DynamoDB stream.

Example ​

ts
const table = new ddb.TableV2(this, 'MyTable', {
  partitionKey: {
    name: 'id',
    type: ddb.AttributeType.STRING,
  },
  dynamoStream: ddb.StreamViewType.NEW_IMAGE,
});
declare const targetQueue: sqs.Queue;

const pipeSource = new sources.DynamoDBSource(table, {
  startingPosition: sources.DynamoDBStartingPosition.LATEST,
});

const pipe = new pipes.Pipe(this, 'Pipe', {
  source: pipeSource,
  target: new SqsTarget(targetQueue)
});
python
# target_queue: sqs.Queue
table = ddb.TableV2(self, "MyTable",
    partition_key=ddb.Attribute(
        name="id",
        type=ddb.AttributeType.STRING
    ),
    dynamo_stream=ddb.StreamViewType.NEW_IMAGE
)

pipe_source = sources.DynamoDBSource(table,
    starting_position=sources.DynamoDBStartingPosition.LATEST
)

pipe = pipes.Pipe(self, "Pipe",
    source=pipe_source,
    target=SqsTarget(target_queue)
)
java
Queue targetQueue;
TableV2 table = TableV2.Builder.create(this, "MyTable")
        .partitionKey(Attribute.builder()
                .name("id")
                .type(AttributeType.STRING)
                .build())
        .dynamoStream(StreamViewType.NEW_IMAGE)
        .build();

DynamoDBSource pipeSource = DynamoDBSource.Builder.create(table)
        .startingPosition(DynamoDBStartingPosition.LATEST)
        .build();

Pipe pipe = Pipe.Builder.create(this, "Pipe")
        .source(pipeSource)
        .target(new SqsTarget(targetQueue))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Pipes.Sources.Alpha
Queue targetQueue;
var table = new TableV2(this, "MyTable", new TablePropsV2 {
    PartitionKey = new Attribute {
        Name = "id",
        Type = AttributeType.STRING
    },
    DynamoStream = StreamViewType.NEW_IMAGE
});

var pipeSource = new DynamoDBSource(table, new DynamoDBSourceParameters {
    StartingPosition = DynamoDBStartingPosition.LATEST
});

var pipe = new Pipe(this, "Pipe", new PipeProps {
    Source = pipeSource,
    Target = new SqsTarget(targetQueue)
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkpipessourcesalpha/v2
var targetQueue Queue
table := ddb.NewTableV2(this, jsii.String("MyTable"), &TablePropsV2{
	PartitionKey: &Attribute{
		Name: jsii.String("id"),
		Type: ddb.AttributeType_STRING,
	},
	DynamoStream: ddb.StreamViewType_NEW_IMAGE,
})

pipeSource := sources.NewDynamoDBSource(table, &DynamoDBSourceParameters{
	StartingPosition: sources.DynamoDBStartingPosition_LATEST,
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: pipeSource,
	Target: awscdkpipestargetsalpha.NewSqsTarget(targetQueue),
})

Initializer ​

ts
new DynamoDBSource(table: ITableV2, parameters: DynamoDBSourceParameters)
python
DynamoDBSource(table: ITableV2, parameters: DynamoDBSourceParameters)
java
new DynamoDBSource(ITableV2 table, DynamoDBSourceParameters parameters)
csharp
new DynamoDBSource(ITableV2 table, DynamoDBSourceParameters parameters)
go
NewDynamoDBSource(Table ITableV2, Parameters DynamoDBSourceParameters)

Properties ​

deadLetterTargetmay be undefinedIQueue | ITopicdead_letter_targetmay be undefinedtyping.Union[IQueue, ITopic]deadLetterTargetmay be undefinedIQueueDeadLetterTargetmay be undefinedIQueueDeadLetterTargetmay be undefinedinterface{} #
The dead-letter SQS queue or SNS topic.
sourceArnstringsource_arnstrsourceArnStringSourceArnstringSourceArn*string #
The ARN of the source resource.
sourceParametersStreamSourceParameterssource_parametersStreamSourceParameterssourceParametersStreamSourceParametersSourceParametersStreamSourceParametersSourceParametersStreamSourceParameters #
Base parameters for streaming sources.

Methods ​

bind(_pipe: IPipe): SourceConfigdef bind(self, _pipe: IPipe) -> SourceConfigpublic SourceConfig bind(IPipe _pipe)public SourceConfig Bind(IPipe _pipe)func Bind(_pipe IPipe) SourceConfig #
Bind the source to a pipe.
grantPush(grantee: IRole, deadLetterTarget?: IQueue | ITopic): voiddef grant_push(self, grantee: IRole, dead_letter_target: typing.Optional[typing.Union[IQueue, ITopic]] = None) -> Nonepublic void grantPush(IRole grantee, IQueue deadLetterTarget)public void GrantPush(IRole grantee, IQueue? deadLetterTarget = null)func GrantPush(Grantee IRole, DeadLetterTarget interface{}) #
Grants the pipe role permission to publish to the dead-letter target.

[disable-awslint:no-grants]

grantRead(grantee: IRole): voiddef grant_read(self, grantee: IRole) -> Nonepublic void grantRead(IRole grantee)public void GrantRead(IRole grantee)func GrantRead(Grantee IRole) #
Grant the pipe role read access to the source.
isSourceWithDeadLetterTarget(source: ISource): boolean@staticmethod def is_source_with_dead_letter_target(source: ISource) -> boolpublic static Boolean isSourceWithDeadLetterTarget(ISource source)public static bool IsSourceWithDeadLetterTarget(ISource source)func IsSourceWithDeadLetterTarget(Source ISource) *bool static #
Determines if the source is an instance of SourceWithDeadLetterTarget.