Guide for new Backend Project setup on Ubuntu VM (AWS/GCP/OCI)

leangaurav
2 min readJan 29, 2023

This is my personal guide to quickly get a new Ubuntu Linux based AWS-EC2 instance or any other VM up and running in minutes. I’ve used it on OCI(Oracle Cloud) as well.

Step-1: Create an Ubuntu VM/Instance

Use any Cloud provider. Remember to:

  1. Open Ports 443, 80 (remove after HTTPS setup)
  2. Upload public ssh key/ download ssh key pair to login to instance
  3. Assign a public IP.

Check ufw, iptable etc. and ensure ingress on 443 and 80 is allowed.
This answer helped fix firewall on OCI https://stackoverflow.com/a/54810101/5449226

Verify a port is open, run a python file server. Example command to run on port 80.
sudo python3 -m http.server 80
Then jump to <ip>:80 in your browser it should show a directory listing. Remember to close the python server.

Step-2 (optional): Add swap space

Handles abrupt memory spikes and prevents instance from freezing.
https://github.com/leangaurav/docs/blob/main/guides/add_swap_space.md

How much to add ? Probably follow this guide or below table which I copied from here

Step-3: Install Docker

Copy paste command from below github gist. Or use the official doc link mentioned in the gist.

Step-4: Setup github ssh access

Required to clone your private git repositories.

https://leangaurav.medium.com/setup-ssh-key-with-git-github-clone-private-repo-using-ssh-d983ab7bb956

Step-5: Setup Backend with HTTPS

--

--

leangaurav

Engineer | Trainer | writes about Practical Software Engineering | Find me on linkedin.com/in/leangaurav | Discuss anything topmate.io/leangaurav