- Newest
- Most votes
- Most comments
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.
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:
-
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.
-
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.
-
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.
-
After processing, store the resulting data back in S3.
-
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
Relevant content
asked a year ago
asked 4 years ago
asked 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 4 years ago
