0
0
DynamodbHow-ToBeginner · 4 min read

How to Export DynamoDB Table Data to Amazon S3

You can export a DynamoDB table to Amazon S3 using the Export to S3 feature in the AWS Management Console or by using the AWS CLI command aws dynamodb export-table-to-point-in-time. This exports your table data as an S3 object in Parquet format without consuming read capacity on your table.
📐

Syntax

The main AWS CLI command to export a DynamoDB table to S3 is:

aws dynamodb export-table-to-point-in-time \
  --table-arn <table-arn> \
  --s3-bucket <bucket-name> \
  --s3-prefix <optional-prefix> \
  --export-format PARQUET \
  --export-time <optional-timestamp>

Explanation of parts:

  • --table-arn: The full Amazon Resource Name of your DynamoDB table.
  • --s3-bucket: The name of the S3 bucket where data will be exported.
  • --s3-prefix: (Optional) Folder path inside the bucket to store exported files.
  • --export-format: Format of exported data, usually PARQUET.
  • --export-time: (Optional) Timestamp to export data as of that point in time.
bash
aws dynamodb export-table-to-point-in-time \
  --table-arn arn:aws:dynamodb:us-west-2:123456789012:table/MyTable \
  --s3-bucket my-export-bucket \
  --s3-prefix exports/mytable \
  --export-format PARQUET
💻

Example

This example shows how to export a DynamoDB table named MyTable to an S3 bucket called my-export-bucket with a prefix exports/mytable. The export will be in Parquet format and use the current time as the export point.

bash
aws dynamodb export-table-to-point-in-time \
  --table-arn arn:aws:dynamodb:us-west-2:123456789012:table/MyTable \
  --s3-bucket my-export-bucket \
  --s3-prefix exports/mytable \
  --export-format PARQUET
Output
{ "ExportDescription": { "ExportArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MyTable/export/01567890123456-abcdef", "ExportStatus": "IN_PROGRESS", "TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/MyTable", "S3Bucket": "my-export-bucket", "S3Prefix": "exports/mytable", "ExportFormat": "PARQUET", "ExportCreationTime": "2024-06-01T12:00:00Z" } }
⚠️

Common Pitfalls

  • Missing permissions: Ensure your IAM role or user has dynamodb:ExportTableToPointInTime and s3:PutObject permissions.
  • Incorrect table ARN: Use the full ARN, not just the table name.
  • S3 bucket region mismatch: The S3 bucket must be in the same AWS region as the DynamoDB table.
  • Export time format: If specifying --export-time, use ISO 8601 format (e.g., 2024-06-01T12:00:00Z).
  • Export format: Currently, only PARQUET is supported.
bash
### Wrong: Missing table ARN
aws dynamodb export-table-to-point-in-time \
  --table-name MyTable \
  --s3-bucket my-export-bucket \
  --export-format PARQUET

### Right: Use table ARN
aws dynamodb export-table-to-point-in-time \
  --table-arn arn:aws:dynamodb:us-west-2:123456789012:table/MyTable \
  --s3-bucket my-export-bucket \
  --export-format PARQUET
📊

Quick Reference

  • Use aws dynamodb export-table-to-point-in-time to export data.
  • Exported data is saved in S3 in Parquet format.
  • Ensure IAM permissions for DynamoDB export and S3 write access.
  • Table ARN and S3 bucket must be in the same region.
  • Export does not consume table read capacity.

Key Takeaways

Use the AWS CLI command 'export-table-to-point-in-time' with the table ARN to export DynamoDB data to S3.
Exported data is stored in Parquet format in the specified S3 bucket and prefix.
Ensure your IAM permissions allow DynamoDB export and S3 write access.
The S3 bucket must be in the same AWS region as your DynamoDB table.
Exporting does not consume read capacity units on your DynamoDB table.