we have a code that create staticIP in GCP/AWS/Azure, we are using the IaaS Sdk's to create it, when we create it we are allocating it for our resources, now after some time we are deleting the resources that are using this staticIP, and now its "free"
After a sometime we need to attach new resource to allocate exact same IP's that we created before.
we afraid that some process will allocate those IP, so my question is if there is a way to "reserve" those IP for limit time until the "Real" resources will allocate them again ?
As @al-dann said there is an option in gcp to reserve a static ip address.
For existing ip:
From your Google Cloud Platform dashboard, navigate to Networking > External IP addresses
.the down arrow under the Type column and select Static for the External IP address that is connected to your instance (recommended method).
For new ip:
to reserve a new static IP address for your instance, instead of using the existing one, click the RESERVE STATIC ADDRESS
button. If you choose this option, make sure the IP address matches the IP address in your website’s DNS records.make sure to attach the static IP address to the correct instance, then click the Reserve button
For Change or assign an external IP address to an existing instance follow this doc.When you’re re-assigning IP addresses, it can sometimes take a while for the updates to reflect.
For reserving external IP you must have been granted the orgpolicy.policyAdmin
role on the organization.
If you want to reserve a regional external IPv6
address you need to give alpha Alpha access to the feature in the gcp project by:
gcloud alpha compute addresses create ADDRESS_NAME \
--region=REGION \
--subnet=SUBNET \
--ip-version=IPV6 \
--endpoint-type=VM
EDIT-1:
You can reserve an ip address and assign to a VM of your choice, but charges will be higher for reserved static external IP that is not used.
From this doc you can find
If you reserve a static external IP address and do not assign it to a resource such as a VM instance or a forwarding rule, you are charged at a higher rate than for static and ephemeral external IP addresses that are in use.
For Static IP addresses (assigned but unused) will be charged with $0.01 for every hour, you can find charges for various types from the table from the above doc.