Backing Up Your Website’s Files: A Quickie How-to Guide


This one thing could save your buns thousands of dollars!!! How’s that for a clickbait-y title?

Avoid this feeling by backing up your files. Guaranteed to work every time …60% of the time


Ransomeware… this has become something that has come to the forefront of mainstream attention. If you’re a business owner, especially one that deals with valuable data, then undoubtedly this concern has crossed your mind.

Anyway, I’ll skip the fear-mongering part and just get to the point: backing up important data in several locations can put you in a position to not cave-in to the demands of any would-be data kidnappers. If they hold your files hostage, then you can just use the backups. Hooray!!! We have thwarted their attempts!

Now, that’s enough nonsense from me. This will cover how to backup the files from/to a website running on an AWS EC2 instance to/from a local computer.

There’s a few ways one can backup their files. One can use software such as pUTTY or filezilla. These are good choices and industry standard. One could also login to their account where their website is being hosted and use the cPanel dashboard provided to customers. However, we’re going to be using another approach. Below will cover a process that I believe is the simplest to do out of the possible options mentioned above. It uses the scp command. We’ll also compress the files before backing them up, because sometimes big folders need to be backed up, too. Let’s begin:

  1. Connect to your remote server

2. Navigate to the directory holding your website’s files

cd /path/to/your/targetFiles/

3. Copy and compress the folder. I used the tar cfz command like so:

tar cfz copy_of_targetFiles.tgz /path/to/your/targetFiles/

You can rename the copied targetFile anything. The names do not have to match.

4. Now, go to the terminal on your local computer. We’re done working in the remote server. We’re going to use scp to create a secure connection and copy the compressed files to the local computer. You’ll likely need a keyPair file handy, which is what the -i flag identifies. Edit the command below to suit your needs and then it will start copying once you run it.

scp -i "yourKeyPair.pem" ubuntu@yourSitesIPaddress:/path/to/the/copy_of_targetFile.tgz
  • You have many options on where to backup your files, USB drives and cloud storage to name a couple others

5. After backing up the files, there is the final option to encrypt the backed up files. This is optional but encouraged. I won’t go into the process of encrypting files because there are several different ways to do it.

I hope you found this mildly helpful.


Thanks for reading!

If you enjoyed reading this article, support my writing by signing up for a Medium subscription.

Medium is a writing platform where writers from all over the world showcase their writing, covering any topic you can think of.

With a subscription you'll have unlimited access to all these writers and email notifications for my newly posted articles.

...but never fear, if you really enjoy my cybersecurity articles, then they will always be available here to read for free, for you!