I created a database on my local ubuntu machine.
How can I transfer it to my remote server (ec2 Ubuntu)
Use mongodump
and mongorestore
to take (and restore) a full binary backup of your MongoDB database. Compress the backup dump
directory to make it faster to copy to your Amazon instance (BSON tends to compress very well).
Rather than following adhoc instructions, I would strongly recommend reading the standard Backup and Restore with MongoDB Tools tutorial in the MongoDB manual.
You can also use a Filesystem snapshot, but mongodump
and mongorestore
only export the data so your backup will be smaller (i.e. your remote server will not inherit any excessive storage allocation due to preallocation).