Converting a dynamic public IP address to static
You can convert a dynamic public IP address to static. Static public IP addresses are reserved and remain attached to respective resources when VMs and network load balancers are stopped.
Note
Make sure to check out our pricing policy for inactive static public IPs.
- In the management console
, select the folder containing the address. - In the list of services, select Virtual Private Cloud.
- In the left-hand panel, select
IP addresses. - Click
in the row with the IP address and select Make static. - In the window that opens, click Change.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
See the description of the CLI's update address attribute command:
yc vpc address update --help
-
Get a list of addresses in the default folder:
yc vpc address list
Result:
+----------------------+------+---------------+----------+------+ | ID | NAME | ADDRESS | RESERVED | USED | +----------------------+------+---------------+----------+------+ | e2l46k8conff******** | | 84.201.177.41 | false | true | +----------------------+------+---------------+----------+------+
The
false
value of the RESERVED parameter for the IP address with thee2l46k8conff********
ID shows that this address is dynamic. -
Convert the address to static by using the
--reserved=true
key and the address ID:yc vpc address update --reserved=true e2l46k8conff********
Result:
id: e2l46k8conff******** folder_id: b1g7gvsi89m3******** created_at: "2021-01-14T09:36:46Z" external_ipv4_address: address: 84.201.177.41 zone_id: ru-central1-a requirements: {} reserved: true used: true
Now that the
reserved
parameter istrue
, the IP address is static.
To change the type of a public IP address from dynamic to static, use the update REST API method for the Address resource or the AddressService/Update gRPC API call, and provide the following in the request:
-
ID of the IP address you want to convert to static in the
addressId
parameter.To get the address ID, use the list REST API method for the Address resource or the AddressService/List gRPC API call and provide the folder ID in the
folderId
request parameter.To learn how to find out the folder ID, see Getting the folder ID.
-
true
in thereserved
parameter. -
Name of the
reserved
parameter in theupdateMask
parameter.
Warning
This API method overrides all parameters of the object being modified that were not explicitly passed in the request to the default values. To avoid this, list the settings you want to change in the updateMask
parameter (one line separated by commas).