Question

How to migrate the Live project from AWS to DigitalOcean's new droplet?

How to migrate the Live project from AWS to DigitalOcean’s new droplet?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
December 16, 2024

Hey there! 👋

To transfer your website over to a DigitalOcean Droplet, the exact steps can vary depending on your setup. Are you using Docker, or is your project deployed directly on the server? Let me know more about your setup so I can give you specific guidance.

Overall, the process typically looks like this:


1. Set Up Your Droplet

Create a new Droplet in your DigitalOcean account and install the necessary software stack (LAMP, LEMP, etc.) that your project needs.


2. Copy Your Files with rsync

You can use rsync to transfer your project files from your AWS server to the Droplet:

rsync -avz /path/to/your/project/ user@your_droplet_ip:/path/to/destination/
  • -a: Archive mode (preserves permissions).
  • -v: Verbose output.
  • -z: Compress data during transfer.

For more details, check out this rsync guide.


3. Export and Import Your Database

On the AWS server, export your database:

mysqldump -u username -p database_name > db_backup.sql

Transfer the dump file to your Droplet:

rsync -avz db_backup.sql user@your_droplet_ip:/path/to/destination/

On the Droplet, import the database:

mysql -u username -p new_database_name < /path/to/destination/db_backup.sql

4. Update Configuration Files

Update your application’s configuration files with the new database credentials, server paths, and any other settings specific to the new environment.


5. Test Using /etc/hosts

Before updating DNS, you can test your site by editing your local /etc/hosts file. This file allows you to map a domain name to a specific IP address for your machine only.

Steps to update /etc/hosts on your local machine:

  1. Open the file with a text editor (you need admin/sudo permissions):

    sudo nano /etc/hosts
    
  2. Add a line mapping your domain to the new Droplet’s IP:

    your_droplet_ip yourdomain.com
    
  3. Save and exit the file (CTRL + O to save, CTRL + X to exit).

Now when you visit yourdomain.com in your browser, it will point to the new Droplet for testing purposes.

To revert the change, simply remove the line or comment it out.


6. Update DNS

Once you’ve tested everything and it works, update your DNS records to point to the new Droplet’s IP. This makes your site live on the new server.


Let me know how it goes! 🚀

Feel free to share more details about your current project and the setup that you have and I will be happy to give you more details on how you could transfer everything over.

- Bobby

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.