Amazon Lightsail is an intriguing new product from Amazon Web Services that I’ve been meaning to sit down a play around with for some time. This weekend, I took the opportunity to spin up a test instance and play around with getting a WordPress site migrated over.
A little background first on Amazon Lightsail. For starters, it is basically a really simplistic version of an EC2 instance that has become famous with Amazon. Rather than having to do a lot of the management and server provisioning yourself, Amazon Lightsail lets you get up and running very quickly with minimum server management skills. This tutorial will walk you through a very simplistic guide of spinning up a new Lightsail instance, getting in via SSH and then gaining access to PHPMyAdmin to upload your exported database.
Let’s jump in:
- Our first step is heading over to Lightsail and getting logged in. This is done at https://aws.amazon.com/lightsail/.
- Once we get logged in, it is time to spin up a new instance. Lightsail provides a 30 day free trial so you can do this at no cost if you just want to play around for a bit and see how it works. The instance usually takes about 30 seconds to create at which time Lightsail will provide you with a public IP address and username to get logged in via SSH.
- Once the new Lightsail instance is spun up, it will provide you with a private key for gaining access via SSH. Download this private key onto your computer for use with your favorite SSH client.
- Next step is changing the permissions on your newly downloaded private key. I work on OSX so I opened up Terminal and used the following command, “chmod 600 /Users/user/documents/privatekey.ppk” where Users/user/documents was the path to my downloaded private key. **hint, you can drag and drop the file into terminal and it will automatically insert the path to the file.
- Next, following this guide, we’re going to create an SSH tunnel into PHPMyAdmin. In order to do this, I’m going to run the following command in Terminal: ssh -N -L 2222:127.0.0.1:80 -i /Users/user/documents/privatekey.ppk [email protected]_IP. A couple notes on the above: 1. I changed the port from the example guide to :2222 rather than :8888 as I have MAMP running on my computer which uses the :8888 port. 2. Make sure you change the path to your private key file accordingly as well as adding in your public_IP address and Lightsail username in the last expression.
- Once I’ve performed the above, I can access PHPMyAdmin at http://127.0.0.1:2222/phpmyadmin
- The credentials to login to PHPMyAdmin will be ‘root’ as the username and the password can be found in a file called bitnami_application_password which resides in the root folder after you login via SSH.
Overall, getting started was very simple to do. AWS is a fantastic product but many are turned off by the complexity of server management and even just getting started. Lightsail is a great lightweight product that I’m happy to see Amazon come out with.
I will be back with more guides on Amazon Lightsail as I jump deeper myself. Check back for more info!