Deploy a web server with Git, Apache, and your website in less than 5 minutes on Amazon Lightsail
Companies Mentioned
People want to get their websites or applications up and running as quickly as possible. With Amazon Lightsail, we are able to deploy our web server, install & configure Git, clone our GitHub repo, and enable our web services with less than 2 minutes of work. Don’t believe me? Check this out!
First, what is Amazon Lightsail?
Amazon Lightsail is an easy-to-use service that provides Virtual Private Servers (VPS) with CPU, Memory, Storage, and Data Transfer Allowances at a predictable monthly price, with the cheapest being $3.50/month!
Another benefit of Lightsail is that you can choose either a bare Operating System or an application blueprint to help you get up and running faster. Some application blueprints offered include: WordPress, PrestaShop, GhostCMS, Adobe Magento, LAMP stack, MEAN stack, etc.
Let’s Do this in less than 2 minutes!
First, we head into the Amazon Lightsail (//www.amazonlightsail.com) and choose our blueprint. I chose Amazon Linux 2.
Next, and this part is what saves us a LOT of time, we’ll use a Launch Script. This is a run-once script that will be executed after Lightsail deploys your instance. In this case with Amazon Linux 2 we use the following script:
This script updates the packages library, installs Git, installs apache, starts the apache service, adds it to run on startup in case our instance is rebooted, clones my website repo, and then moves the files into my web directory.
If your GitHub repo is private, You’ll need to authenticate to your private repo in the CLI to clone the files. Will create a post about that another day.
We then choose an instance size. As you saw in the first image under ‘What is Amazon Lightsail’ you’ll notice that Lightsail has 7 different instance sizes. Depending on the needs of your site, you can choose the corresponding instance size. (You can always upgrade to a bigger size later if needed).
Give your instance a name and add any tags you’d like. Tags are meant to help identify workloads depending on your needs.
Click ‘Create Instance’
Your Website will begin deploying. Once it’s deployed you’ll see that it is ‘Running’ and has an IP address. This is not a static IP, but a static IP can easily be attached in the next (optional) step
(Optional) Add a Static IP to your website
If you want to add a static IP, Lightsail makes it easy to generate the IP and attach it to your instance. Once you click on your instance, click the ‘Networking’ tab
Click ‘Attach static IP’
Click ‘Create Static IP’
Give your static IP a name, then click ‘Create’
Your static IP is now created and assigned to your instance. We can then copy-and-paste the IP address into our browser and see that our website is up and running.
FREEBIE
As I said in the title, there is a freebie here too if this is your first time trying Amazon Lightsail. Head on over and sign up to use the service and get your first 3-months free (if you choose one of the associated instance types). Let me know what you think!