EC2 public IPs change on stop/restart, which breaks anything pointing at them. The fix is mapping a custom domain via an Elastic IP. Allocate an Elastic IP In the AWS console, go to Network & Security -> Elastic IPs.
Architecture and Core Concepts
Click 'Allocate Elastic IP address', then 'Allocate' - you'll get a static IP. Associate the Elastic IP with your instance Select the new Elastic IP, then from the Actions dropdown click 'Associate Elastic IP address'. In the association screen, search for your instance and its private IP, then click Associate. Note the allocated IPv4 address shown after association. Point your domain at the Elastic IP In your domain registrar's DNS settings, add/update an A record: type A, host = your domain/subdomain, value = the Elastic IP you just allocated.
Gotchas and Troubleshooting Checklist
Permission & Access Control - verify user privilege level (sudo access or file ownership) before running commands.
Environment & Path Resolution - confirm environment variables and binary PATH entries match target software releases.
Log Diagnostics - inspect relevant system logs or application trace outputs to verify clean execution.
Following these steps provides a clean, reliable, and production-ready solution for use a domain name instead of public dns/ip in an amazon linux ec2 instance.
Comments and corrections