I wanted a quick and easy way to deploy an AWS Lightsail instance and have it be a blank slate for me to tinker with.
Here is the "intended" way for this repo to be used:
- Download the repo, optionally as a zip folder.
- This repo assumes you have https://direnv.net/ installed to load and unload the
.envrc
files when changing directories. I'd recommend installing it, otherwise if you're so inclined, you can manage the environment variables through another package or manually. - Change to the new directory for the repo once you have the folder downloaded/unzipped/un-tar'd/etc.
- Update your variables for your AWS region in
.envrc
. Ensure your AWS credentials are set up in the~/.aws
folder as per the AWS CLI configuration. For help setting up these credentials, visit AWS CLI Configuration.
direnv
should prompt you to allow the new.envrc
file with an easy copy and pasteable error message! This will need to be done before running the scripts so the variables exist.
- Finally, make the shell script(s) executable with
chmod +x *.sh
, and then turn up the server with./run-all.sh
!
wget https://github.com/oct8l/Lightsail-Scratch-Server/archive/refs/heads/main.tar.gz
tar -xzf main.tar.gz
rm main.tar.gz
cd Lightsail-Scratch-Server
chmod +x *.sh
vi .envrc
After you defeat the vi
boss and have your variables set, you can run ./run-all.sh
and watch the magic happen!
You can also optionally run ./ssh.sh
if you'd like to SSH to the machine, it will use the SSH key that was generated by the previous script.
The Terraform template also applies the needed firewall rules and assigns the machine to that firewall group, so no need to manually allow it. It makes port 22/tcp accessible from any IPv4 address.