Skip to main content

Export to AWS S3

View Markdown

Prerequisites​

Before configuring the Export Sink, ensure you have the following:

  • An AWS S3 bucket.
    • The S3 bucket must reside in the same region as your Namespace.
  • (Optional) An IAM role that has write permission to the above S3 bucket.
    • You can follow the automation in the UI to create the IAM role. Please pre-create the role if setting up Export via Terraform or the CLI.
  • (Optional) A KMS ARN associated with the S3 bucket.

Configure export​

There are multiple ways to configure export: through the Temporal Cloud UI, the CLI, or terraform.

See export timing and delivery guarantees.

An export sink exports closed Workflow Executions and closed Standalone Activity Executions by default. To export Workflow Executions only, disable Standalone Activity export on the sink. See Choose which executions to export.

Using Temporal Cloud UI​

You can use the Temporal Cloud UI to configure Export.

The Temporal Cloud UI provides two ways for configuring Export:

  • Automated setup (recommended): The Cloud UI launches the AWS CloudFormation Console to create a stack with write permission to the S3 bucket.
  • Manual setup: The Cloud UI provides a CloudFormation template for users to manually configure a CloudFormation stack.
Why does Temporal Cloud provision multiple internal IAM roles to trust for Export?

Temporal Cloud creates multiple intermediary IAM roles for export operations for security purposes. The system randomly selects from these roles when writing to your storage sink, which provides several benefits:

  • Security isolation: If one IAM role is compromised or needs to be decommissioned, other IAM roles remain available
  • Load distribution: Avoids relying on a single IAM role, reducing security risk
  • Warm standby: Keeps multiple IAM roles active to avoid potential throttling when switching between IAM roles
  • Reliability: Provides resilience against cloud provider account-level issues that could affect a single IAM role

This approach prioritizes security and availability, ensuring robust export operations even if individual IAM roles encounter issues.

The following steps guide you through setting up Export using the Temporal Cloud UI.

Tip

Don't forget to click Create at the end of your setup to confirm your export.

Automated setup​

You can use the automated setup to create a CloudFormation stack with write permission to your S3 bucket. Make sure to verify the export setup before you save the configuration.

  1. Open the Temporal Cloud UI and navigate to the Namespace you want to configure.
  2. Select Configure from the Export card.
  3. Provide the following information to configure the export sink and then select Create and launch stack:
    • Name: A name for the export sink.
    • AWS S3 Bucket Name: The name of the configured AWS S3 bucket to send closed executions to.
    • AWS Account ID: The AWS account ID.
    • Role Name: The name of the AWS IAM role to use for the CloudFormation stack that has write permission to the S3 bucket.
    • KMS ARN: (optional) The ARN of the AWS KMS key to use for encryption of the exported data.
    • Standalone Activity export: On by default. Turn it off to export Workflow Executions only.
  4. You will be taken to the CloudFormation Console to create the stack with pre-populated information.
    • Review the information and then select Create stack.

To change Standalone Activity export on an existing sink, edit the sink from the Export card and turn Standalone Activity export on or off. Workflow export continues either way.

Manual setup​

You can manually configure a CloudFormation stack using the provided template.

  1. Open the Temporal Cloud UI and navigate to the Namespace you want to configure.
  2. Select Configure from the Export card.
  3. Select Manual from Access method.
    • Enter the Template URL into your web browser to download your copy of the CloudFormation template.
    • Configure the CloudFormation template for your export sink.
    • Follow the steps in the AWS documentation by uploading the template to the CloudFormation console.

Using the CLI​

Run the temporal cloud namespace export s3 create command and provide the following information:

  • --namespace: The Namespace to configure export for.
  • --sink-name: The name of the export sink.
  • --role-arn: The ARN of the AWS IAM role to use for the CloudFormation stack that has write permission to the S3 bucket.
  • --bucket-name: The name of the AWS S3 bucket.
  • --region: The AWS region the S3 bucket is in.
  • --disable-standalone-activity-export: (optional) Export Workflow Executions only. Standalone Activity Executions are exported by default.

For example:

temporal cloud namespace export s3 create \
--namespace "your-namespace.your-account" \
--sink-name "your-sink-name" \
--role-arn "arn:aws:iam::123456789012:role/test-sink" \
--bucket-name "your-aws-s3-bucket-name" \
--region "us-east-1"

Retrieve the status of this command by running the temporal cloud namespace export get command.

For example:

temporal cloud namespace export get \
--namespace "your-namespace.your-account" \
--sink-name "your-sink-name"

To stop exporting Standalone Activity Executions from an existing sink, update the sink:

temporal cloud namespace export s3 update \
--namespace "your-namespace.your-account" \
--sink-name "your-sink-name" \
--disable-standalone-activity-export

To resume, run the same command with --disable-standalone-activity-export=false.

The following is an example of the output:

{
"name": "your-sink-name",
"resourceVersion": "a6442895-1c07-4da4-aaca-58d57d338345",
"state": "Active",
"spec": {
"name": "your-sink-name",
"enabled": true,
"destinationType": "S3",
"s3Sink": {
"roleName": "your-export-test",
"bucketName": "your-export-test",
"region": "us-east-1",
"kmsArn": "",
"awsAccountId": "123456789012"
}
},
"health": "Ok",
"errorMessage": "",
"latestDataExportTime": "0001-01-01T00:00:00Z",
"lastHealthCheckTime": "2023-08-14T21:30:02Z"
}

Using terraform​

See the terraform export support for setup instructions. To export Workflow Executions only, set filter.disable_standalone_activity_export = true on the temporalcloud_namespace_export_sink resource.

Next steps​