Now you will see, how to assign elastic IP (EIP) to amazon EC2 instance. It is actually beneficial to have EIP on AWS server as earlier as possible because this reduces confusions at many places. EIPs are like Static IPs so they also provide ease of use and management.
Many people believe that it is better to have EIP sooner on AWS EC2 servers so there will not be any mis-configuration of apache, php and mysql after installation of said packages. However, my experiments showed that it doesn’t affect anything even if installed later on.
So, why you need EIP?
Amazon servers (EC2 or VPC) provides two kind of IPs. One is Private IP. This is for personal use and cannot be reached by outside of Amazon EC2. Other is public IP and can be reached from internet; outside the instance network. Public IP (which actually can be derived from long Public DNS) can be used to forward or create name servers (NS) for your domains. However, there is only one issue. Actually, a big one. Whenever, you will stop, restart or reboot the instance this Public DNS will change and so the IP. So, how many times actually you can create BIND records and change NS for a domain? Not feasible, right?
EIP acts like a static IP which every user can have for his/her server. One IP per user without cost if it is bind to a running instance. So, this IP can be easily used to access websites, entered in BIND and nameservers for domains.
This is how you create and assign them.
1. Go to EC2 Dashboard. Check your region.
2. Make sure you have at least one running instance. Note the Instance ID.
TIP: If you remember to have an instance and can’t find it then again check the region present on top of sidebar.
3. Now from sidebar, select Elastic IP under Network and Security.
4. Click on Allocate New Address. A popup will appear to ask that for what service you need it? EC2 or VPC. Select whatever you are using. Click Allocate.
5. A new IP will be generated and will be shown in just some seconds.
6. Now right click the EIP and select Associate. A popup will appear. Just select your instance ID from drop-down list and hit Ok.
7. Now EIP will show a long address of instance to which it is assigned.
8. First confirmation: Go to Running Instance and click on instance. You will see same EIP in information presented below.
9. Second confirmation: Reboot this instance (NOT STOP and START; just Reboot). If after reboot the instance still shows the EIP and EIP section shows the instance name then everything is fine.
Now, you can use this EIP to access your webmin, internet site, create NS in BIND, configure apache or create NS for domains.
Troubleshooting: If you can’t access EIP in AWS, then please check your Security Group settings in AWS Instance Control Panel. The standard ports 80 (http), 10000 (Webmin), 21 (FTP), 53 (DNS) are the least requirement to be opened on a security group as it is kind of firewall.
So, actually you are done with it but you must know some information and facts about EIP if you don’t want to end up paying high charges. Get all this information here.