In need of exporting dynamodb table into csv

0

Hi,

I want to automate the csv exporting so my team can access the csv file which i would store into an S3 bukkit. I find many solutions about how to import csv files into dynamo but none of them are giving me the answer for exporting to csv. I know there is a "export to csv" button in dynamodb and that's exactly how i want it but then automated. I've been trying with lambda , glue , Exports and streams ,... None of them seem to work or getting stuck because can't find any good documentation. Can somebody pleas help me out?

Thanks

1 個回答
6

One such way to do it programmatically is doing a Scan operation and formatting the data to CSV:

   aws dynamodb scan \
  --table-name <table_name> \
  --select ALL_ATTRIBUTES \
  --page-size 500 \
  --max-items 10000 \
  --output json | jq -r '.Items' | jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ][]?])[] | @csv' > my-table-3.csv

Another way is using AWS Datapipeline to export the table to CSV and stores it directly on S3:

https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-template-exportddbtos3.html


And finally you can use AWS Glue to read the DynamoDB table and write to S3 in CSV format:

https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-format-csv-home.html#aws-glue-programming-etl-format-csv-write


There is also third party options available, many of which you must pay for such as DynoBase:

https://dynobase.dev/export-dynamodb-to-csv/

profile pictureAWS
專家
已回答 1 年前
profile pictureAWS
專家
已審閱 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南