Web

Connect Vaultpress AWS EC2 instance

Learn how to connect vaultpress AWS EC2 instance for backing up your Wordpress site that resides on Amazon's EC2 cloud instance

For those that blog with WordPress and want to consider a good backup solution for their blog, there are a few options out there. ย However, one that is pretty straightforward and seamless is Vaultpress. ย It takes the heavy lifting out of backing up your WordPress files and database. ย However, when it comes to information on how to get it configured with a site running on an AWS EC2 instance and SSH access, the details are a bit thin. ย The following post will detail how to connect Vaultpress AWS EC2 instance via SSH that has WordPress running. ย Vaultpress can backup a site without SSH or other connectivity running just by having the plugin installed and your API key configured. ย However, for restore functionality you will need to have SSH or other protocol connectivity configured.

Connect Vaultpress AWS EC2 instance

There are a few steps that need to be worked through to get Vaultpress up and running:

  • First, you need to signup
  • Install the plugin and your API key
  • Connect Vaultpress via SSH or other means to EC2
    • Add a vaultpress specific user (don’t have to do this, but it is good practice, along with very strong password)

Adding a user

The particular environment I am using is an Ubuntu based VM in AWS. ย So below are the steps I used to get a new user added as well as the SSH key provided by Vaultpress added to the new user. ย Typically, you would have to generate a new keypair for the new user. ย However, when you signup with Vaultpress, it will create a keypair for you and will display the public key you need for using with the new user setup.

Login as yourย ubuntuย user and add a new user of your choosing for Vaultpress to connect with.

ubuntu@ec-2:$  sudo adduser backup

Follow the prompts. ย It will ask you to add a password as well as firstname, phone number, office number etc. ย Besides the password, you can just hit ENTER past these prompts.

Add your new userย to theย sudoersย file:

ubuntu@ec-2:$ sudo visudo

Add the following line toย after the comment line, โ€œUser privilege specificationโ€:

backup   ALL=(ALL:ALL) ALL

Change to our new user:

ubuntu@ec-2:$ sudo su backup

We need to create aย .ssh/authorized_keysย file for our new user. ย Make sure you are in your home directory:

ubuntu@ec-2:$ mkdir .ssh
ubuntu@ec-2:$ chmod 700 .ssh
ubuntu@ec-2:$ touch .ssh/authorized_keys
ubuntu@ec-2:$ chmod 600 .ssh/authorized_keys

Now, we need to get theย public key that Vaultpress has generated for us and plug it into the .ssh/authorized_keys file that we just created. ย Go to yourย settings page in Vaultpress and select SSH and hit theย Show Public Keyย button. ย Copy all the text, including theย ssh-rsa in the beginning, butย excludeย the “Vaultpress” text at the end.

vault01

AWS EC2 Network Security

You will need to allow Vaultpress to connect in your AWS EC2 security group if you are restricting SSH – and you should be. ย Add a new rule to allow SSH access to Vaultpress CIDR range. ย Take a look at the Vaultpress post here on those rangesย https://help.vaultpress.com/connection-issues/

If you are not familiar with security groups or how to add rules to them, check out the detailed post here on how to get the groups setup and add rules: ย https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html#security-group-rules

Testing

After you get the user name, password and public key setup on the EC2 side, you should be able to test your connection and save your credentials. ย You will see the “green” status on SSH and that you are connected:

vault02

Permissions

Make sure the user you create for Vaultpress has both read and write permissions on the files you want to backup/restore.

Final Thoughts

After gettingย the user to connect Vaultpress AWS EC2 instance, the plugin and service is pretty hands off. ย The Lite version which is the cheapest solution is $5 a month and is quite a bit of security for that price – daily backups, offsite backups, 30 day history of backups, etc. ย Hopefully, the above post will help any who run WordPress on EC2 to be able to connect Vaultpress up with AWS.

 

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.