Quick reference for managing the EC2 server — SSH access, VS Code, PM2, nginx, and common diagnostics.
Server: esqserver.comUser: ec2-userAmazon Linux 2023
1
SSH from Terminal
Connect to the EC2 server from any Mac/Linux terminal or Windows PowerShell.
Basic Connection
Connect to EC2
ssh-i~/.ssh/your-key.pem ec2-user@esqserver.com
Replace your-key.pem with your actual AWS key pair file name.
Fix key permissions (first time only)
chmod 400 ~/.ssh/your-key.pem
Required if SSH gives "WARNING: UNPROTECTED PRIVATE KEY FILE" error.
SSH Config Shortcut (Recommended)
Add this to ~/.ssh/config on your local machine so you can type ssh esquire instead of the full command:
~/.ssh/config entry
Host esquire
HostName esqserver.com
User ec2-user
IdentityFile~/.ssh/your-key.pem
After saving, connect with just: ssh esquire
ℹ️
On Windows, use PowerShell or Windows Terminal — SSH is built in. The key file goes in C:\Users\YourName\.ssh\ and permissions are set automatically.
2
VS Code + Claude Code
Use VS Code's Remote SSH extension to edit server files and run Claude Code directly on the EC2.
One-Time Setup
1
Open VS Code → Extensions (Ctrl+Shift+X) → search "Remote - SSH" → Install (by Microsoft)
2
Add the SSH config entry above to ~/.ssh/config on your local machine
3
Press F1 → type Remote-SSH: Connect to Host → select esquire
4
VS Code opens a new window connected to the EC2. You can now open folders, edit files, and use the integrated terminal as if you were on the server.
5
Open the integrated terminal (Ctrl+`) and run claude to start Claude Code on the server.
Reconnecting
Reconnect via Command Palette
F1 → Remote-SSH: Connect to Host → esquire
Or use the green >< button in the bottom-left corner of VS Code.
Running Claude Code on EC2
Start Claude Code
claude
Run in the VS Code integrated terminal while connected to the EC2. Claude Code opens in the current directory.
Start in a specific project folder
cd /home/ec2-user/project-folder && claude
⚠️
Keep the VS Code window open while Claude Code is running. Closing it or losing the SSH connection will interrupt Claude mid-task.
3
PM2 — Process Manager
PM2 keeps Node.js apps running in the background and restarts them automatically after a server reboot.
View Running Processes
List all processes
pm2 list
Shows all processes with their status, CPU, memory, and uptime. All should show online.
Current processes on this server
# ID Name Port Purpose 0 server 3000 Excel Upload (filemaker-node-uploader) 1 pdf-print 3001 PDF Print Server
Restart / Stop / Start
Restart a process
pm2 restart server
pm2 restart pdf-print
pm2 restart all # restart everything
Stop a process
pm2 stop server
Stops the process but keeps it in the list. Use pm2 start server to bring it back.
Start a new process
pm2 start app.js--namemy-app
Remove a process from PM2
pm2 delete my-app
Logs
View live logs (all processes)
pm2 logs
Streams all output in real time. Press Ctrl+C to exit.
View logs for one process
pm2 logs server
pm2 logs pdf-print
Show last 100 log lines
pm2 logs --lines 100
After Server Reboot
Save current process list (run once after adding new processes)
pm2 save
Saves the list so PM2 restores everything after a reboot. Already configured on this server.
4
Nginx — Web Server
Nginx acts as the front door — it handles HTTPS, routes /excel-upload/ to port 3000, /print/ to port 3001, and serves static files like the portal and spec docs.
Common Commands
Check config for errors (always run before reloading)
sudo nginx -t
Must show "syntax is ok" and "test is successful" before proceeding.
Reload nginx (apply config changes, no downtime)
sudo nginx -t && sudo systemctl reload nginx
The && means reload only runs if the test passes. Safe to use in production.
Restart nginx (full restart, brief interruption)
sudo systemctl restart nginx
Use reload instead unless nginx is unresponsive.
Check nginx status
sudo systemctl status nginx
Shows whether nginx is running, its PID, and recent log entries.
Mirror of gemba-demos (server/) + /var/www/gemba/ (public/)
fm-order-uploader
/home/ec2-user/fm-order-uploader/
filemaker-node-uploader
/home/ec2-user/filemaker-node-uploader/
pdf-print-server
/home/ec2-user/pdf-print-server/
n8n-backups
/home/ec2-user/n8n-backups/
Auto-backed up daily at 7am via PM2
ℹ️
gemba-demos vs gemba-it-demos: PM2 runs the live server from gemba-demos/. The GitHub backup is gemba-it-demos/server/. When you update server code, keep both in sync.