Skip to content
v2.275.0

ResultWriterV2 Class ​

Configuration for writing Distributed Map state results to S3 The ResultWriter field cannot be empty.

You must specify one of these sets of sub-fields. writerConfig - to preview the formatted output, without saving the results to Amazon S3. bucket and prefix - to save the results to Amazon S3 without additional formatting. All three fields: writerConfig, bucket and prefix - to format the output and save it to Amazon S3.

Example ​

ts
import * as s3 from 'aws-cdk-lib/aws-s3';

// create a bucket
const bucket = new s3.Bucket(this, 'Bucket');

// create a WriterConfig

const distributedMap = new sfn.DistributedMap(this, 'Distributed Map State', {
  resultWriterV2: new sfn.ResultWriterV2({
    bucket: bucket,
    prefix: 'my-prefix',
    writerConfig: {
      outputType: sfn.OutputType.JSONL,
      transformation: sfn.Transformation.NONE,
    },
  })
});
distributedMap.itemProcessor(new sfn.Pass(this, 'Pass State'));
python
import aws_cdk.aws_s3 as s3


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

# create a WriterConfig

distributed_map = sfn.DistributedMap(self, "Distributed Map State",
    result_writer_v2=sfn.ResultWriterV2(
        bucket=bucket,
        prefix="my-prefix",
        writer_config={
            "output_type": sfn.OutputType.JSONL,
            "transformation": sfn.Transformation.NONE
        }
    )
)
distributed_map.item_processor(sfn.Pass(self, "Pass State"))
java
import software.amazon.awscdk.services.s3.*;


// create a bucket
Bucket bucket = new Bucket(this, "Bucket");

// create a WriterConfig

DistributedMap distributedMap = DistributedMap.Builder.create(this, "Distributed Map State")
        .resultWriterV2(ResultWriterV2.Builder.create()
                .bucket(bucket)
                .prefix("my-prefix")
                .writerConfig(Map.of(
                        "outputType", OutputType.JSONL,
                        "transformation", Transformation.NONE))
                .build())
        .build();
distributedMap.itemProcessor(new Pass(this, "Pass State"));
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.S3;


// create a bucket
var bucket = new Bucket(this, "Bucket");

// create a WriterConfig

var distributedMap = new DistributedMap(this, "Distributed Map State", new DistributedMapProps {
    ResultWriterV2 = new ResultWriterV2(new ResultWriterV2Props {
        Bucket = bucket,
        Prefix = "my-prefix",
        WriterConfig = new Dictionary<string, object> {
            { "outputType", OutputType.JSONL },
            { "transformation", Transformation.NONE }
        }
    })
});
distributedMap.ItemProcessor(new Pass(this, "Pass State"));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import s3 "github.com/aws/aws-cdk-go/awscdk"


// create a bucket
bucket := s3.NewBucket(this, jsii.String("Bucket"))

// create a WriterConfig

distributedMap := sfn.NewDistributedMap(this, jsii.String("Distributed Map State"), &DistributedMapProps{
	ResultWriterV2: sfn.NewResultWriterV2(&ResultWriterV2Props{
		Bucket: bucket,
		Prefix: jsii.String("my-prefix"),
		WriterConfig: map[string]interface{}{
			"outputType": sfn.OutputType_JSONL,
			"transformation": sfn.Transformation_NONE,
		},
	}),
})
distributedMap.ItemProcessor(sfn.NewPass(this, jsii.String("Pass State")))

Initializer ​

ts
new ResultWriterV2(props: ResultWriterV2Props)
python
ResultWriterV2(props: ResultWriterV2Props)
java
new ResultWriterV2(ResultWriterV2Props props)
csharp
new ResultWriterV2(ResultWriterV2Props props)
go
NewResultWriterV2(Props ResultWriterV2Props)

Properties ​

bucketmay be undefinedIBucketbucketmay be undefinedIBucketbucketmay be undefinedIBucketBucketmay be undefinedIBucketBucketmay be undefinedIBucket#
S3 Bucket in which to save Map Run results.
bucketNamePathmay be undefinedstringbucket_name_pathmay be undefinedstrbucketNamePathmay be undefinedStringBucketNamePathmay be undefinedstringBucketNamePathmay be undefined*string#
S3 bucket name in which to save Map Run results, as JsonPath.
prefixmay be undefinedstringprefixmay be undefinedstrprefixmay be undefinedStringPrefixmay be undefinedstringPrefixmay be undefined*string#
S3 prefix in which to save Map Run results.

Default: No prefix

writerConfigmay be undefinedWriterConfigwriter_configmay be undefinedWriterConfigwriterConfigmay be undefinedWriterConfigWriterConfigmay be undefinedWriterConfigWriterConfigmay be undefinedWriterConfig#
Configuration to format the output of the Child Workflow executions.

Methods ​

providePolicyStatements(): PolicyStatement[]def provide_policy_statements(self, ) -> typing.List[PolicyStatement]public List<PolicyStatement> providePolicyStatements()public PolicyStatement[] ProvidePolicyStatements()func ProvidePolicyStatements() *[]PolicyStatement#
Compile policy statements to provide relevent permissions to the state machine.
render(queryLanguage?: QueryLanguage): anydef render(self, query_language: typing.Optional[QueryLanguage] = None) -> Anypublic Object render(QueryLanguage queryLanguage)public object Render(QueryLanguage? queryLanguage = null)func Render(QueryLanguage QueryLanguage) interface{}#
Render ResultWriter in ASL JSON format.
validateResultWriter(): string[]def validate_result_writer(self, ) -> typing.List[str]public List<String> validateResultWriter()public string[] ValidateResultWriter()func ValidateResultWriter() *[]*string#
Validate that ResultWriter contains exactly either.