AWS EC2 Deployment — Q&A Reference
A reference guide compiled from deploying two Node.js/Docker apps to AWS EC2, covering the real issues hit and how they were fixed. 1. Getting Connected Q: How do I SSH into my EC2 instance? chmod 400 your-key.pem ssh -i your-key.pem ubuntu@YOUR_ELASTIC_IP Type yes when asked about the fingerprint the first time. Q: chmod 400 doesn't seem to work / I get "bad permissions" / "Permission denied…
A guide compiled from deploying two Node.js/Docker applications to AWS EC2, addressing common issues encountered and their solutions. To access your instance, use the command: chmod 400 your-key.pem; ssh -i your-key.pem ubuntu@YOUR_ELASTIC_IP. If the chmod command fails, copy the private key from a Windows drive mounted in WSL and set permissions accordingly.
Verify which instance you are connected to by using curl commands to fetch the instance ID and public IP. For HTTPS without purchasing a domain, use sslip.io, which automatically resolves to the public IP. Real HTTPS can be obtained via Let's Encrypt via Certbot. Using the raw IP with HTTP will not work with Clerk or Razorpay, which require HTTPS with a proper hostname.
An Elastic IP is necessary to maintain a stable public IP for domain and certificate setup. To resolve "no space left on device" errors, allocate an Elastic IP and associate it with the instance. For disk space issues, increase the volume size through the AWS console or extend the partition on the server. Memory and swap problems can be addressed by adding swap space, as free-tier instances often have limited RAM.
Configure Nginx and Certbot for reverse proxy and free SSL, addressing common issues like OOM kills and Node.js memory limitations.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.