Assign Static IP (Elastic IP) & Configure DNS Records
By default, AWS EC2 instances receive a dynamic IP that changes on reboot. This guide shows you how to assign a permanent Elastic IP and point your custom domain to it.
Allocate an Elastic IP
AWS calls static IP addresses Elastic IPs. Unlike standard public IPs, these persist even if you stop and start your instance.
- Log in to the AWS Management Console.
- Navigate to the EC2 Dashboard.
- In the left sidebar, under Network & Security, select Elastic IPs.
- Click the orange Allocate Elastic IP address button.
- Keep the default settings (Amazon's pool of IPv4 addresses) and click Allocate.
Success: You should now see a new IP address listed in the dashboard.
Associate IP with Instance
Now that you own the IP, you need to attach it to your specific running server.
- Select the newly allocated IP address checkbox.
- Click the Actions dropdown menu and select Associate Elastic IP address.
- In the Instance field, search for and select your running EC2 instance.
- (Optional) Check "Allow this Elastic IP address to be reassociated" if you plan to move it later.
- Click Associate.
Note: Your EC2 instance's previous public IP will be released immediately. If you were connected via SSH, your connection will drop, and you must reconnect using the new Elastic IP.
Configure DNS Records
To make yourdomain.com point to your server, you need to add an A Record in your DNS provider settings (e.g., Route 53, GoDaddy, Namecheap).
If you also want www.yourdomain.com to work, create a second record:
⏳ Propagation Time
DNS changes can take anywhere from a few minutes to 48 hours to propagate globally. You can verify your setup using tools like whatsmydns.net.