Two complete full-stack Azure deployments — private MySQL, Load Balancers, NAT Gateway, and the Jump Host pattern
Project 1 — EpicBook
Running chmod on a .pem file in the Downloads folder failed on Windows. Fix: copy the key to the home directory (~/) first, then chmod 400 — Windows blocks permission changes in system folders.
The private NSG only allows MySQL traffic from the VM subnet (10.0.1.0/24). Nobody on the internet can reach the database directly. Network segmentation is the first principle of cloud security.
Project 2 — 3-Tier Book Review App
App VM in private subnet cannot reach the internet to run apt install. Solution: added a NAT Gateway to the app subnets. NAT allows outbound traffic to the internet while keeping the subnet completely inaccessible from inbound internet connections.
The app runs on a private IP. Users cannot access it from their browser. Solution: Nginx on the Web VM acts as middleman — browser calls /api/books, Nginx forwards it to 10.0.3.4:3001, gets the response, returns it. The browser never knows the private IP exists.
Without pm2 startup and pm2 save, your app dies when the VM reboots. This is non-negotiable in production — verified on every deployment.
Lessons Learned
Every Azure resource needs a network. Plan VNet and subnets before touching anything else. Retrofitting network architecture after deployment is painful and error-prone.
Private means no inbound internet — but it also means no outbound internet by default. If you need to install packages or pull from GitHub on a private subnet, add a NAT Gateway first.
Never give backend VMs a public IP. Always access them through a Web VM or dedicated Bastion host. This is industry-standard practice in production cloud environments.
Azure MySQL requires SSL. Always include dialectOptions.ssl in your Sequelize config. Forgetting this means silent connection failures that are difficult to debug.