How Amazon holds exclusive rights to the Elastic IPs - amazon-web-services

When I allocate an Elastic IP, it stays with me forever (until I remove it).
This also means, no one can ever use this IP address in the entire world. And you can see there is not DNS or stuff. Its is a straight forward IP address reachable from browser.
How does Amazon block the IP to itself? In other words, how does Amazon hold an IP address so that no one can use it.

Same way anybody else can:
https://www.apnic.net/get-ip/faqs/obtaining-resources/
Can I buy IP addresses?
IP addresses are not for sale, instead, they are public resources
administered by the Internet Numbers Registry System for the entire
Internet community. IP addresses delegated by the Regional registries,
such as APNIC are not "owned" by the Members. IP addresses will be
reclaimed by APNIC when the Membership is terminated.
Why does APNIC require so much detailed information about my network?
APNIC must ensure that address space, which is a shared public
resource, is managed responsibly in the region. APNIC needs detailed
information so that it can properly evaluate whether your plans
conform to agreed addressing policy and are consistent with the goals
of global Internet management.

Related

How do I make DHCP ip address scopes in AWS?

I have a AWS VPC where the DHCP optionset gives me random addresses in the scope of the CIDR 10.128.1.0/24.
But I want to have the DHCP scope limited, so that I can use static private ip addresses for some of the servers and dynamic for another set of server, like
Static Server scope:
10.128.1.1 .. 10.128.1.99
Dynamic Server scope:
10.128.1.100 .. 10.128.1.200
I have tried using the aws ec2 create-dhcp-options but it doesn't give me the opportunity to limit any ip addresses.
The question is perhaps, Can it done? then of course how to, or should I think complete different when having this perhaps odd need and should do it another AWS way....?
You can't do this on AWS. It is common on standard networking, but not on cloud.
If you really need to use "static" IPs you can reserve the IP creating ENI, Elastic Network Interface, in advance.
When an ENI exist, even if it is available, the IP associated with ENI is already in use, so DHCP will not use it anymore
When you create an EC2 instance you can allow it to use DHCP to get an random IP or you can choose an available ENI.
Just notice some IPs are reserved by AWS, you can't create an ENI for it.
See the reserved IPs on documentation below:
https://docs.aws.amazon.com/vpc/latest/userguide/configure-subnets.html#subnet-sizing

How long does it take to release the ephemeral IP address back to the GCE pool?

Ephemeral external IP addresses: these addresses are available to VM
instances and forwarding rules. Ephemeral external IP addresses remain
attached to a VM instance only until the VM is stopped and restarted
or the instance is terminated. If an instance is stopped, any
ephemeral external IP addresses that were assigned to the instance are
released back into the general Compute Engine pool and become
available for use by other projects. When a stopped instance is
started again, a new ephemeral external IP address is assigned to the
instance.
I have thought is instantaneously and we won't be getting back the same ephemeral IP address once the VM is stopped. However, it seems that ephemeral external IP addresses will still be assigned to a project for a while longer. For instance, I deleted a VM and released an IP address two days ago. The same IP address is assigned to a new VM today.
How long does it take to release the ephemeral IP addresses back to the GCE pool?
Are the ephemeral external IP addresses "assigned" to VPC or Project? If one has multiple projects within a VPC, will the ephemeral IP addresses be rotated within the projects until they are released to the GCE pool?
The answer is "it should not matter if ephemeral addresses are reused for your instance or not".
There is no guarantee that your instance will obtain the same address or will not obtain the same address. If you are designing something that depends on a certain ephemeral IP address behavior, your design will fail at some point.
Your question quotes Google's official ephemeral IP address policy. Design to that statement and do not depend on environment level behavior.
If you require a fixed IP address, then assign your instance a static IP address. Otherwise, your instance will have whatever address Google Cloud decides, which may or may not be the same address between restarts or recreates.
If your goal is to randomize public IP addresses, then you cannot count on the ephemeral address behavior to implement that. You can allocate a set of static IP addresses and then change which one is assigned to an instance. Note that unused IP addresses are billed (not free). Another method is to create instances in different regions and zones which will have different public IP addresses. You also could write a script to create VMs until the address is different (not part of a previous set of addresses) and then delete the other VMs (subject to quota restrictions).
From a customer support perspective, it is to Google's benefit to reallocate the same address to you. This minimizes a common problem. Some customers do not understand that the default IP address is ephemeral and what that means. They reboot their instance and the IP address changes. That breaks their SSH scripts, DNS settings, etc. The ephemeral address behavior cannot be consistently deployed but is a positive where possible.
Answers to your questions -
It’s instantaneous.
Ephemeral addresses don't belong to any project and can be assigned to any resources across projects, randomly.
Some users have done some tests like this and concluded that the system tends to assign familiar IP addresses to VMs if it can. However, this is not something confirmed by GCP. Regardless, it’s of no use as there is no guarantee what IP address you’ll be getting.

AWS EC2 - Developer dynamic ip permission

Every single day I need to update inbound rules, because the dev team is at homeoffice.
Is there any solution for my dev team with dynamic IP addresses?
Since your team's IP addresess change and you only want to allow those specific IP addresses, you are out of luck: you need to update Security Groups inbound rules every time the IP changes.
What you can do though is simplify this process. AWS recently announced Prefix Lists. You can create a Prefix List with all your team's IP addresses and reference this in any Security Group you need. You can then maintain one Prefix List instead of a number of Security Groups.
If you are willing to increase your exposure to a wider IP range, as a trade-off for less frequent IP address list maintenance, you can add your user's CIDR block instead of each specific IP address. Then, assuming that most dynamic IP addresses are allocated from the same CIDR block, your team members will be able to connect to your EC2 instances. A simple whois query for a specific IP address can show you the CIDR (IP range) it belongs too (usually your ISP's CIDR).

Reset DHCP IP's on GCP

Actually when I create a new machine in GCP, the google compute engine is assigning to me an IP 1xx.
Only I have arround 30 machines, but, when kubernetes generate a new node, the IP is incremented.
How I can reset this IP pool?
For example now I'm trying to generate a marketplace deploy (rabbitmq) and isn't possible to reserve internal IP.
TL;DR: CGE Instances supports two types of internal IP addresses: Static Internal and Ephemeral. For both cases, IPs remain attached to a resource until they are explicitly detached from the resource. So if you can't reserve more IP addresses is because you ran out of IP addresses.
Google released a document named IP addresses where it explains how IP addresses are assigned to resources within GCP.
Based on your question, seems that you have custom VPC. The error you get is because you ran out of IP addresses.
Ephemeral IP addresses are released when the resource is deleted. But Static Internal Addresses are not automatically deleted when the resource is deleted, it only gets detached. Most likely you have a lot of reserved addresses not attached to resources.
Lastly, Stackoverflow may be not the best forum for this question. I highly recommend you to share your question in Serverfault since is a better forum for infrastructure questions.

Why does a AWS NAT Gateway require an ElasticIP?

While creating NAT Gateway an Elastic IP Address is created in AWS. The AWS documentation (1) also mentions the same. Why is an Elastic IP Address required for NAT Gateway?
Simply stated, the EIP is required because that is the way the NAT Gateway feature was engineered.
It wouldn't make sense to have a dynamic address on a NAT device -- if the address changed, that would be guaranteed to break any sessions in progress... and the only way to allocate a static address is by allocating an Elastic IP address (EIP).
It's also common to have external vendors whitelist your servers (for access to their servers) by providing them with the EIP of your NAT Gateway, in which case a dynamic address from the public pool would be unacceptable.
There may also be internal, proprietary reasons related to the way EIPs function that made this requirement a necessity... but that is not documented, so such an assertion would be mere speculation. An example of this: the public pool addresses (like those auto-assigned to EC2 instances configured with a public IP address from the pool, not an EIP) might be engineered to the specific availability zone, or even a subset of a single availability zone (they do, after all, change, when an instance is stopped/started, implying that they might be dedicated to specific server bays within an AZ), while EIPs can migrate anywhere from one zone to another within a region. This strongly implies different internal topologies.
This requirement (constraint?), to me, seems insignificant: you shouldn't be charged for this EIP, and if you need to increase the maximum allowed number of EIPs in a region, you can submit a support request at no charge, describing your use case, to request a limit increase.
The EIP requirement is rather arbitrary. Having a static IP makes coding the NAT easier (it doesn't have to check the WAN Interface for upstream address changes) but NATs that support a dynamic upstream address are very common - almost every home served by a major ISP has one. Sure, there's a risk the external address might change and break the current connections, but the ISPs know this and try hard NOT to change the address. Generally it changes only when you reboot the router, and at that point all your connections are broken anyway.
On AWS there there are many similar scenarios where you don't care if your NAT gateways external address changes, especially if your VPC does not contain any public servers. I have a lot of these, and I'm trying to run them on free accounts - it annoys me that they force me to burn through my short supply of static IPs.
As others observed this is a small expense, and AWS is still way cheaper than any other way I know to get this kind of cloud power; but that EIP is not strictly required.
No insignificant at all, you are only allowed to have 5 EIPs, so having 2 or 3 apps in two availability zones will hit that threshold.
As of June 2021, the AWS NAT Gateway does not require an ElasticIP (if you choose "Private" mode):
A private NAT Gateway, or NAT Gateway with connectivity type set to private, does not require EIP and you do not need to attach an internet gateway with your VPC.
https://aws.amazon.com/about-aws/whats-new/2021/06/aws-removes-nat-gateways-dependence-on-internet-gateway-for-private-communications/
I think what the answers here are missing is that the NAT Gateway (NATG) traffic is still being routed through an Internet Gateway (IGW), which performs static (one private IP to one public IP) NAT. As the image in the question indicates, the Elastic IP (EIP) is an association. It is the IGW that is translating the NATG's private IP to its associated public EIP.
This EIP requirement is therefore consistent from an AWS implementation perspective for any resource (e.g. EC2 instance) in a public subnet accessing the internet through an IGW.
Let's say you have private network instances, how will they connect to internet? That's when NAT comes in. NAT ip is public. And private subnets can be associated with NAT. So in that way, the instance in private subnet can connect to internet using NAT. This is very useful when you have server to whitelist your ip. Just give them the NAT EIP and problem solved.