# ResultWriter

Configuration for writing Distributed Map state results to S3.

- Source: [`aws-stepfunctions/lib/states/distributed-map/result-writer.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map/result-writer.ts#L173)
- Type last changed: v2.190.0 · 17 Apr 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';

declare const bucket: s3.Bucket;
const resultWriter = new stepfunctions.ResultWriter({
  bucket: bucket,

  // the properties below are optional
  prefix: 'prefix',
});
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_s3 as s3
from aws_cdk import aws_stepfunctions as stepfunctions

# bucket: s3.Bucket

result_writer = stepfunctions.ResultWriter(
    bucket=bucket,

    # the properties below are optional
    prefix="prefix"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.s3.*;
import software.amazon.awscdk.services.stepfunctions.*;

Bucket bucket;

ResultWriter resultWriter = ResultWriter.Builder.create()
        .bucket(bucket)

        // the properties below are optional
        .prefix("prefix")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3;
using Amazon.CDK.AWS.StepFunctions;

Bucket bucket;

var resultWriter = new ResultWriter(new ResultWriterProps {
    Bucket = bucket,

    // the properties below are optional
    Prefix = "prefix"
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var bucket Bucket

resultWriter := awscdk.Aws_stepfunctions.NewResultWriter(&ResultWriterProps{
	Bucket: bucket,

	// the properties below are optional
	Prefix: jsii.String("prefix"),
})
```

## Initializer

TypeScript:

```ts
new ResultWriter(props: ResultWriterProps)
```

Python:

```python
ResultWriter(props: ResultWriterProps)
```

Java:

```java
new ResultWriter(ResultWriterProps props)
```

C# / .NET:

```csharp
new ResultWriter(ResultWriterProps props)
```

Golang:

```go
NewResultWriter(Props ResultWriterProps)
```

## Properties

- `bucket`: [IBucket](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html) — S3 Bucket in which to save Map Run results.

- `prefix`: string — S3 prefix in which to save Map Run results.

  **Default:** No prefix

## Methods

- `providePolicyStatements(): PolicyStatement[]` — Compile policy statements to provide relevent permissions to the state machine.

- `render(queryLanguage?: QueryLanguage): any` — Render ResultWriter in ASL JSON format.
