paint-brush
Install and Configure Git on Amazon Lightsail, and Deploy Your Website in Minutes! (Freebie Inside) by@thebriangraf
4,678 reads
4,678 reads

Install and Configure Git on Amazon Lightsail, and Deploy Your Website in Minutes! (Freebie Inside)

by Brian GrafOctober 12th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Deploy a web server with Git, Apache, and your website in less than 5 minutes on Amazon Lightsail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Install and Configure Git on Amazon Lightsail, and Deploy Your Website in Minutes! (Freebie Inside)
Brian Graf HackerNoon profile picture


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!

Amazon Lightsail Instance sizes and prices

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.


Amazon Lightsail Application Blueprint Options

Let’s Do this in less than 2 minutes!


Amazon Lightsail OS Blueprint Options

  • 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:
sudo yum update -y
sudo yum install -y git
sudo yum install -y httpd.x86_64
sudo systemctl start httpd.service
sudo systemctl enable httpd.service

git clone //github.com/lightsail-demo-environment/dimension-public

sudo mv ./dimension-public/* /var/www/html/
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.

Amazon Lightsail Instance Launch Script

  • 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’

Naming Amazon Lightsail Instances

  • 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

View of running instances in the Amazon Lightsail console

(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’

Networking tab of the Amazon Lightsail console

  • Give your static IP a name, then click ‘Create’

Generate a static IP and attach it to your Lightsail Instance

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.

The website we cloned from our public GitHub repository is live with our Static IP

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!





바카라사이트 바카라사이트 온라인바카라