Skip to content

Cost-Effective ETL for DynamoDb tables with sizes more than 3 terabytes & export to s3

0

Hello, I’m seeking guidance and suggestions on cost-effective methods for scanning a couple of DynamoDB tables, each with sizes of up to 3 TB and 5 TB.

Our goal is to join these tables based on certain column values, after filtering them using the response from a REST API call that utilizes an ID stored in a column. We also want to transfer the resulting data to an S3 bucket so it can be queried later using Athena or a locally running Python script.

I would appreciate any suggestions on the best approach for this ETL process. I found these articles helpful:

The latter article suggests that using a Glue job is more cost-effective for scanning large tables since it doesn’t consume read capacity units of the source DynamoDB tables. However, would it still be cost-effective if I add REST API calls for each ID value in a table column? Additionally, is it feasible to update the Glue job script to include these REST API calls and save the response as an additional column?

Alternatively, would it be cheaper to scan the entire tables through a script running in ECS, process the data, and then transfer it?

I would appreciate your guidance on this. Thank you!

2 Answers
1

Using the export to S3 connector with Glue is convenient and does not consume capacity from the table (protects any prod traffic on the table), but Scanning the table directly is the most cost-effective approach.

Its not clear if this is a one-time job or not.

Glue is purpose built for this type of ETL process, easy connections to DynamoDB and using Spark to do transformations with ease. You can leverage Glue to do a Scan also, which would be as cost-effective as doing it from ECS.

However, if this is not a one time thing, you may benefit from exporting the data to S3, and using it as the source for subsequent invocations to your API, that would mean 1 table dump per N invocations, instead of a Scan for each invocation.

AWS
EXPERT

answered 2 years ago

-1

For your scenario involving large DynamoDB tables (3 TB and 5 TB) and the need to join, filter, and export data to S3, I can provide some guidance on cost-effective methods and best practices.

First, it's important to note that performing frequent scans on large DynamoDB tables can be inefficient and expensive. Instead, a better approach would be to use the DynamoDB Export to S3 feature. This feature allows you to export data from your DynamoDB table to an S3 bucket without consuming any read capacity units (RCUs) and without impacting the table's performance or availability.

Here's a suggested approach:

  1. Use DynamoDB Export to S3 to export your large tables to S3. This is a fully managed solution that can handle tables of your size efficiently.

  2. Once the data is in S3, you can use AWS Glue to create a data catalog and transform the data. Glue can handle the joining of tables and applying filters based on your requirements.

  3. For the REST API calls, you have a couple of options: a. You could use AWS Lambda in combination with Glue to make the API calls for each ID. This would allow you to process the data in parallel. b. Alternatively, you could use a Glue ETL job with custom code to make the API calls. While this is feasible, it might be slower for large datasets.

  4. After processing, store the resulting data back in S3.

  5. Use Athena to query the processed data in S3 as needed.

This approach has several advantages:

  • It doesn't consume any read capacity from your DynamoDB tables.
  • It's scalable and can handle your large data volumes.
  • It's serverless, so you only pay for the resources you use.
  • It allows for complex transformations and joins using Glue.

Regarding your question about using a script running in ECS to scan the tables: while this is possible, it's generally not recommended for such large tables. It would consume a significant amount of read capacity and could impact the performance of your DynamoDB tables.

In terms of cost-effectiveness, the DynamoDB Export to S3 feature combined with Glue and Athena is likely to be more cost-effective than running large scans on your DynamoDB tables, especially considering the size of your data.

Remember to enable compression and use efficient file formats (like Parquet) when storing data in S3 to optimize for Athena queries. Also, consider using Glue's bookmarking feature if you need to process incremental data changes over time.

Lastly, always test your solution with a subset of data before running it on your full dataset to ensure it meets your performance and cost expectations.
Sources
DynamoDB data export to Amazon S3: how it works - Amazon DynamoDB
Using DynamoDB with Amazon S3 to export and import table data - AWS Prescriptive Guidance
Evaluate your DynamoDB table usage patterns - Amazon DynamoDB
Scanning tables in DynamoDB - Amazon DynamoDB

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.