Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I am new to aws-cli and I am trying to export my dynamodb table as a CSV so that I can import it directly into postgresql. Is there a way to do that using aws-cli?

So far I have come across this command aws dynamodb scan --table-name . But this does not provide an option of a CSV export. Also, through this command, I can get the output on my command prompt but I am not sure how to write it in a file.

1 Answer

0 votes
by (44.4k points)
edited by

If all items have the same attributes, e.g. id and name both of which are strings, then run:

aws dynamodb scan \

    --table-name mytable \

    --query "Items[*].[id.S,name.S]" \

    --output text

That would give a tab-separated output. You can redirect this to file using > output.txt, and you could then easily convert tabs into commas for CSV.

Want to know more about AWS DynamoDB and master all AWS Skills? Go through AWS Certification Training!

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories