Amazon Lightsail
Last updated
Last updated
Amazon Lightsail is a service that lets you spin up managed service quickly with a shell script.
https://aws.amazon.com/lightsail/
First login to your Amazon Lightsail account and create an instance
Instance Settings
These are the insance settings that are working. Your mileage may vary for something not indicated in this list.
Select OS Only
Ubuntu 18.04
Add Launch Script (script below)
Select 1GB - $5 plan.
Assign a name to your instance under "Identify Your Instance"
That's basically it for settings!
Now before you click create, you'll need the following template to get your site working on Amazon Lightsail. You only get one shot at this when it initializes. You can't do this later.
Commandbox Template
Full script at the end but here is the play by play
1. Install Java
Commandbox needs Java to run
2. Install Commandbox
This is taken directly from (https://commandbox.ortusbooks.com/setup/installation)
3. Download your code/repo
In this template, we are using Ortus' awesome Github repo with Elixir and Vue.js. There are other ways like copying over from a local file with SSH or use a disk that you created in Amazon Lightsail that will persist even if the instance is delete. Notice here that we saved it to the /app
directory. Note that for later when you run your app, to navigate to it.
Private Repo If you want to automate a private repo, one way you can do it is to use an access token. The procedure is here https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line. You can create an an access token for downloading private repos without exposing your account password. Fair warning, it's not a perfect solution because as of 08/27/19, they still don't have a read-only permission for private repos.
4. Install any dependencies
For example you can run your box dependencies or if you are using webpack, this would be the time to get all that compiled.
5. Run the server
In here we start the server in the /app
directory. We set the host to 0.0.0.0
so that it listens on any interface/hostname assigned to it. Also, we define the port 80
so that it's not some random port generated by commandbox. Long story short, when this thing runs, we know all we need to do is hit the IP address that Amazon Lightsail assigned to it.
All you have to do is create your instance. It will boot up and when it is finally running, you should have a Public IP address assigned to it...But don't be in to big of a hurry. With these settings, it takes about 4 minutes and 30 seconds before Commandbox is serving something. Wait for it and enjoy!