Facebook Pixel

Why do I need an Elastic IP for EC2?

The default public IP changes when you stop and start the EC2 instance. An Elastic IP is a static IP that persists across stop/start cycles. Without it, your DNS A record would point to the wrong IP after a restart.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Configuring DNS Records for AWS EC2 A Records, CNAME, and Subdomains

First allocate an Elastic IP and associate it with your instance. Then create an A record in your DNS provider: Type A, Name @ (for root) or api (for subdomain), Value (your Elastic IP). Verify with dig yourdomain.com A +short.

Create an A record: Type A, Name api, Value (your Elastic IP). Then add an Nginx server block with server_name api.yourdomain.com and the appropriate proxy_pass or root. Finally, get SSL with sudo certbot --nginx -d api.yourdomain.com.

Create a hosted zone for your domain, update nameservers at your registrar, then create records: A record for root (empty name, Elastic IP value), A record for subdomains (api, Elastic IP), and CNAME for www (yourdomain.com).

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.