Binding, unbinding, and moving public address ranges
Public Address Ranges for VPC is only available for evaluation and testing purposes for users with special access.
You can bind, unbind, and move public address ranges to a VPC in an availability zone with the console, CLI, and API.
Before you begin
- Make sure to review planning considerations and limitations for public address ranges.
- The binding of a public address range must include both a VPC and an availability zone.
Binding, unbinding and moving public address ranges in the console
You can bind, unbind, and move a public address range to a VPC in an availability zone in the console.
Binding a public address range in the console
To bind a public address range in the IBM Cloud® console, follow these steps:
- From the IBM Cloud console, select the Navigation menu
, then click Infrastructure
> Network > Public address ranges. The Public Address Ranges for VPC page appears.
- Highlight the row of the address range in the table, then click Bind from the Actions menu
.
- From the Bind public address range side panel, select the VPC and its corresponding availability zone where you want to bind the address range.
- Click Bind to bind the public address range to the VPC.
Unbinding a public address range in the console
To unbind a public address range in the IBM Cloud console, follow these steps:
After a public address is unbound, it is still reserved and available to be bound again.
- From the IBM Cloud console, select the Navigation menu
, then click Infrastructure
> Network > Public address ranges. The Public Address Ranges for VPC page appears.
- Highlight the row of the address range in the table, then click Unbind from the Actions menu
.
- Click Unbind to confirm that you want to unbind this address range from the VPC.
Moving a public address range in the console
If the public address range is bound to a VPC in an availability zone, you can update and bind (move) it to a different VPC and availability zone. The public address range is automatically unbound from its VPC and availability zone and then bound to the newly specified VPC and availability zone.
You don't need to unbind the address range from its original target first.
To move a public address range in the console, follow these steps:
- From the IBM Cloud console, select the Navigation menu
, then click Infrastructure
> Network > Public address ranges. The Public Address Ranges for VPC page appears.
- Highlight the row of the address range in the table, then click Edit from the Actions menu
.
- From the address range side panel, select the VPC and its availability zone where you want to move the address range.
- Click Save to bind the public address range to the new VPC.
Binding, unbinding, and moving public address ranges from the CLI
To bind, unbind, or move a reserved IP address from the command line, follow these steps:
-
Log in to your CLI environments. After you enter the password, the system prompts which account and region that you want to use:
ibmcloud login --sso
-
Enable the following feature flag:
export IBMCLOUD_IS_FEATURE_PUBLIC_ADDRESS_RANGE=true
You'll receive a notification in the command line when updates to the IBM Cloud CLI and its plug-ins are available. It's important to keep your CLI up to date to access the latest commands. To check the current version of all installed plug-ins, run
ibmcloud plugin list
. -
Run the following command:
ibmcloud is public-address-range-update PUBLIC_ADDRESS_RANGE [--name NAME] [--vpc VPC] [--zone ZONE] | --reset-target] [--output JSON] [-q, --quiet]
Where:
PUBLIC_ADDRESS_RANGE
- The ID or name of the public address range to update.
--name
- A new identifier for the public address range, if you want to rename it.
--vpc
- The VPC you want to attach the public address range to. When specifying the
--vpc
option,--zone
is required. --zone
- The zone where you want this public address range to reside. When specifying the
--zone
option,--vpc
is required. --reset-target
- Unbind a public address range.
-f, --force
- Force the operation without confirmation.
--output
- The output format, only JSON is supported. One of: JSON.
-q, --quiet
- Suppress verbose output.
Command examples
If a public address is not bound to a VPC, you can bind it to a VPC in any availability zone:
ibmcloud is public-address-range-update r006-81222eee-b3e0-4dc3-b429-aee9e5c0abf2 --name public-address-range-1 --vpc cli-test-vpc --zone us-south-1
Unbind a public address range from a VPC and leave it unbound:
ibmcloud is public-address-range-update r006-81222eee-b3e0-4dc3-b429-aee9e5c0abf2 --name public-address-range-1 --reset-target
Move a public address range from one VPC (in any availability zone) to another:
ibmcloud is public-address-range-update r006-81222eee-b3e0-4dc3-b429-aee9e5c0abf2 --name public-address-range-1 --vpc cli-test-vpc --zone us-south-1
Binding, unbinding, and moving public address ranges with the API
To bind, unbind, or move public address ranges with the API, follow these steps:
-
Set up your API environment.
-
Store the following values in variables to be used in the API command:
version
(string): The API version, in formatYYYY-MM-DD
. -
When all variables are initiated, do one of the following:
-
Bind a public address range to a specific VPC:
curl -X PATCH \ "$vpc_api_endpoint/v1/public_address_ranges/$par-id?version=$version&generation=2" \ -H "Authorization: Bearer $iam_token" \ -d '{ "target": { "vpc": { "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b" }, "zone": { "name": "us-south-2" } } }'
-
Unbind a public address range from a specific VPC:
curl -X PATCH \ "$vpc_api_endpoint/v1/public_address_ranges/$par-id?version=$version&generation=2" \ -H "Authorization: Bearer $iam_token" \ -d '{ "target": null }'
After a public address is unbound, it is still reserved and can be bound again.
-
Move a public address range from one VPC to another:
curl -X PATCH \ "$vpc_api_endpoint/v1/public_address_ranges/$par-id?version=$version&generation=2" \ -H "Authorization: Bearer $iam_token" \ -d '{ "target": { "vpc": { "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b" }, "zone": { "name": "us-south-2" } } }'
-