S3JsonItemReader

class aws_cdk.aws_stepfunctions.S3JsonItemReader(*, key, bucket, max_items=None)

Bases: object

Item Reader configuration for iterating over items in a JSON array stored in a S3 file.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_s3 as s3


# create a bucket
bucket = s3.Bucket(self, "Bucket")

distributed_map = sfn.DistributedMap(self, "Distributed Map State",
    item_reader=sfn.S3JsonItemReader(
        bucket=bucket,
        key="my-key.json"
    ),
    result_writer=sfn.ResultWriter(
        bucket=bucket,
        prefix="my-prefix"
    )
)
distributed_map.item_processor(sfn.Pass(self, "Pass State"))
Parameters:
  • key (str) – Key of file stored in S3 bucket containing an array to iterate over.

  • bucket (IBucket) – S3 Bucket containing objects to iterate over or a file with a list to iterate over.

  • max_items (Union[int, float, None]) – Limits the number of items passed to the Distributed Map state. Default: - Distributed Map state will iterate over all items provided by the ItemReader

Methods

provide_policy_statements()

Compile policy statements to provide relevent permissions to the state machine.

Return type:

List[PolicyStatement]

render()

Renders the ItemReader configuration as JSON object.

Return type:

Any

Returns:

  • JSON object

Attributes

bucket

S3 Bucket containing a file with a list to iterate over.

key

S3 key of a file with a list to iterate over.

max_items

Limits the number of items passed to the Distributed Map state.

Default:
  • No maxItems

resource

ARN for the getObject method of the S3 API This API method is used to iterate all objects in the S3 bucket/prefix.