EC2 Address — Auto-Assigned Public IP vs. Elastic IP vs. No-IP (DDNS)
TL;DR
- Auto-assigned public IP: provided by AWS, and it will change once the instance stops or reboots. Let’s call it dynamic.
- Elastic IP: is static and associated with your account. However, if you own an Elastic IP but do not use it with any instance, you will incur charges.
- NO-IP: a third-party service that you can install on your EC2 instance. Even if your public IP changes, this DDNS technology allows external access to your instance despite the changing IP.
AWS Provides
- Auto-assign public IP
- Elastic IP
No DDNS service is provided; please install No-IP on your EC2 instance.
What is DDNS?
DDNS (Dynamic DNS) is a service that automatically updates domain name resolution records to accommodate changes in IP addresses.
The purpose of DDNS is to ensure that even if your machine’s IP address changes, you can still access it by entering the domain name.
Home networks typically use dynamic IP addresses, so if you want to directly provide an IP address for services like NAS or personal websites without binding to a virtual machine’s IP, you would use a domain name. DDNS tracks the actual IP changes of this domain and updates it accordingly.
This way, you can communicate using the domain name, which makes the service much more stable, especially given that your IP might change.
Installing No-IP on EC2
No-IP is one of the DDNS service providers. If you prefer not to use Elastic IP and instead opt for the default auto-assign option, but still want your EC2 instance to be accessible externally, you can install the No-IP client.
cd /usr/local/src
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar xzf noip-duc-linux.tar.gz
cd noip-2.1.9-1
make
make install
# Configuration
/usr/local/bin/noip2 -C # init config
/usr/local/bin/noip2 # start the service
This is great for individuals who are sensitive to costs. LOL
BUT Elastic IP provided by AWS is quite handy
Just keep in mind that if you allocate an Elastic IP but do not use it, you will incur charges.
You don’t need to set up No-IP on your EC2 instance; just follow these steps:
- EC2
- Elastic IPs → Allocate Elastic IP Address
- Then associate that Elastic IP with an instance.
- (optional) Use Route 53
- Point to the Elastic IP
Choosing an Elastic IP is a simple and convenient option if you plan to route traffic directly to the EC2 instance via Route 53. Moreover, Route 53 does not support direct A record alias to EC2 endpoints, but you can point an A record to the Elastic IP.
- A Record elastic ip
A record alias ec2 endpoint
- Alternatively, use an A record alias to a resource endpoint
Consider that you might have integrations with other resources like CloudFront or ELB, which manage dynamic IPs, in which case you wouldn’t need an Elastic IP.
- Point to the Elastic IP
The advantage is that everything is integrated, making it more professional and easier to operate.
By the way: DDNS is not usually a default service on routers.
But many modern routers provide support for DDNS function, allowing users to manually configure or enable the service.
Many routers support various DDNS service providers, such as DynDNS, No-IP, OpenDNS, etc. Users simply need to enter the relevant information provided by the DDNS service provider in the router’s management interface to enable the DDNS service. This way, even if the user’s IP address changes, they can still access their home network devices through a fixed domain name.