Amazon LightSail + WordPress Deployment – The Definitive Guide
If you’re like me, you’re always looking for better, faster, web hosting and you don’t want to pay for expensive managed WordPress hosting like WP Engine and Siteground. So you’ve been considering Amazon Lightsail. Not too long ago I was in the same position and want to share my experience with moving a client’s local development project you’ve been working on to Lightsail.
Let’s get into it!
The following steps assume you’ve already signed up for an Amazon Lightsail account.
It also assumes you have experience manually moving a WordPress site from your localhost to a remote web host like GoDaddy, Hostgator, WPEngine, etc….
This means you should know how to export / import your database, connect with FTP to upload your files to the web host and everything else that goes along with setting up a WordPress website.
- Step 1. – Create an Instance
Select the plan you want and give your instance a name. I usually use
my domain name for easy reference but you can use whatever you want. Step 2. – Create a static IP
Click the Networking Link /Tab
Click “Create Static IP”In this section you will select the instance you just created and attach the IP to the instance and you give your IP address a name: Again, I am choosing to use my domain name but this time I am using the full name with .com at the end.
You could call it whatever you want but it’s easier if you keep instance name and the IP name coupled together.
Step 3 – Create SSH Keys & Download PEM File
The PEM file contains the necessary security credentials to allow your computer to connect to Amazon’s servers. You are creating what is called an SSH-Tunnel. This will
allow you access your database manager: PHPMYADMIN.In the upper right corner, click on account and then click “Create New”.Again, I would name your SSH Key Pair the same name as your domain name.
After you click create, you can click the Download link. This will download your
PEM file to your PC.Get your application’s password.
Click the Connect using SSH button. This will launch a terminal in the browser window. At this point you’re using your server’s terminal.
With the terminal window open, click the clipboard icon. With the clipboard window open, copy and paste this command into the window:
cat bitnami_application_password
Enter this command to disable the Bitnami banner on your wordpress site.
sudo /opt/bitnami/apps/wordpress/bnconfig –disable_banner 1
After you have pasted this command into the window. Click the in the terminal window. This will close the clipboard area. Then RIGHT CLICK in the terminal window. This will paster the command in. Now press enter.
Next you will see your application’s password. This password give you access to
FTP, PHPMYADMIN and the WordPress Admin. In the terminal, highlight the password and click the clipboard icon. Now you have your application’s password.Step 4 Connect to PHPMYADMIN
In this step you’re going to create an SSH Tunnel and it’s going to require the use of a terminal (Mac) / command line (Windows). The step is going to require the use of the PEM file you downloaded. Open a terminal / command line and change directories to where your PEM file is. Then you enter this command: make sure you replace the colored text with the name of your pem file and the ip of your instance.
ssh -N -L 8888:127.0.0.1:80 -i mydomain.pem bitnami@18.214.93.114
Once you have entered this in the terminal and pressed enter you will notice nothing
happens but your terminal / command line will look like the screenshot below.Even though it looks like nothing has happened, if you don’t see an error you’ve successfully created and SSH tunnel. Now leave the terminal window open and go to your browser window. In your browser window go to the following address:
http://127.0.0.1:8888/phpmyadmin
The user is: root and the password is your application password.
At this point you should know what to do with PHPMYADMIN. The point of this post is how to connect to PHPMYADMIN so you can import your DB.Step 5. Move your theme and plugins up to your instance via FTP.
In your FTP client, use your server IP in the HOST field.
You need to use SFTP. Username is bitnami. You will need to use your PEM file.
Please see the screen shot below. I am using FileZilla but you can use another FTP client.After you’ve connected navigate to your instance’s WordPress install.
If you have any trouble with permissions and transferring files via FTP, go back to your terminal (See step 3) and in following the copy – paste instractions, enter the following
commands in the terminal:sudo chown -R bitnami:daemon /home3/athlon76/comfychair.biz/wp-content
sudo chmod -R g+w /home3/athlon76/comfychair.biz/wp-content
From this point you should be able to handle the rest. Again, the point of this article was to help you transfer your database and files to Amazon Lighsail and save you the frustration I went through getting this setup. Please feel free to email me with any questions you might have. Happy coding. boardley@gmail.com
P.S., If you are using contact forms or want to send any form from your site, you need this free plugin.
This plugin is easy to configure and works like a charm.