首页 > 其他分享 >Difference between elastic IP and Public IP

Difference between elastic IP and Public IP

时间:2022-09-04 16:36:02浏览次数:79  
标签:elastic IP AWS public instance Difference Public

Learn what is elastic IP and public IP means in AWS. List out all differences between elastic IP and public IP in AWS.

I was having a conversation about AWS with one of my friends and he came up with the question what is the difference between elastic IP and public IP? So, I explained to him and thought why not draft a post about it! So in this article, we will see the difference between elastic IP and public IP in AWS. This can be a cloud interview question so without much delay lets get into elastic IP vs public IP battle.

What is elastic IP in AWS?

First thing first, let’s get basics clear. What is the elastic IP? It is IPv4 IP address designed and exists for dynamic cloud computing and reachable over the internet. By name, you can imagine it’s a flexible IP that can be used or mapped rapidly from one EC2 instance to another when a currently associated instance fails. This way end-user or application continues to talk to the same IP even if the instance behind it fails. They are like static public IPs allocated for your AWS account.

What is Public IP in AWS?

Public IP is IPv4 IP address which is reachable over the internet. Remember switching flexibility of Elastic IP is not available for this IP. Amazon also assigns external/Public DNS name (shown in the screenshot) to instances who receives public IP. The public IP of the instance is mapped to the primary private IP of that instance via NAT (Network Address Translation) by default.

Refer below screenshot from the EC2 console of AWS and observe where you can check your elastic IP, public IP, and public DNS name.

Check elastic IP, public IP and public DNS in EC2 AWS console

Difference between elastic IP and Public IP

Now let’s look at the difference between these two IP types.

  1. Whenever a new EC2 instance spins up, it’s assigned with public IP by default. Elastic IP is not assigned by default.
  2. Elastic IPs are assigned to AWS accounts which you can attach to instances. Public IPs assigned to instances directly.
  3. When an instance is stopped and started again, public IP gets changed. But if the instance is assigned with elastic IP, it will remain the same even if the instance is stopped and started again.
  4. If elastic IP is allocated to your account and not in use then you will be charged for it on an hourly basis.
  5. Public IP released once your instance is stopped so no question of getting charged for not using it.
  6. You won’t be able to re-use the same public IP since its allocated from the free IP pool. You can always re-use, re-attach elastic IP to other instances when it is released from the current instance.
  7. You can not manually attach or detach public IP from the instance. It’s auto allocated from the pool. Elastic IP can be manually attached and detach from the instance.
  8. You can have a maximum of 5 elastic IP to your account per region. But, you can have as many public IPs as EC2 instances you spin up.
  9. You can have either of them for an instance. If you assign elastic IP to instance then its currently assigned public IP will be released to the free pool.

 

Quote from: https://kerneltalks.com/cloud-services/difference-between-elastic-ip-and-public-ip/

标签:elastic,IP,AWS,public,instance,Difference,Public
From: https://www.cnblogs.com/sycosmos/p/16655330.html

相关文章