IBM Cloud Docs
Creating public address ranges

Creating public address ranges

Public Address Ranges for VPC is only available for evaluation and testing purposes for users with special access.

You can create a public address range by defining its size and, optionally, specifying a VPC to associate with it in any availability zone within the account.

If the VPC is deleted while it is bound to a public address range, the address range continues to exist and can be bound later to a different VPC in any availability zone.

You can create public address ranges with the console, CLI, and API.

Before you begin

Make sure to review planning considerations and limitations for public address ranges.

Creating a public access range in the console

To create a public access range in the IBM Cloud console, follow these steps:

  1. From the IBM Cloud console, select the Navigation Menu Menu icon, then click Infrastructure > Network > Public Address Ranges. The Public Address Ranges for VPC page appears.

  2. Click Create to go to the provisioning page.

  3. In the Location section, edit the following fields, if necessary:

    • Geography: Indicates the geography where you want the public address range created.
    • Region: Indicates the region where you want the public address range created.
  4. In the Details section, complete the following information:

    • Name: Enter a name for the public address range, such as my-public-address-range.

    • Size: Choose the size (number of IPs) of the address range. You can choose from 1, 2, 4, 8, or 16 IPs to include in the block.

      After you create a public address range, you can't change its size.

    • Resource group: Select a resource group for the public address range.

      After you create a public address range, you can't change the resource group.

    • Tags: (Optional) Add tags to help you organize and find your resources. You can always add more tags later. For more information, see Working with tags.

  5. (Optional) If you want to bind your public address range to an existing VPC, toggle the Bind switch to On. Then, select the VPC and availability zone that you want to bind to.

    You can bind a public address range to any VPC in a single availability zone that already exists in your account. You can also bind the address range to a VPC later. For more information, see Binding a public address range.

  6. Review the Order summary, then click Create. The public address range is requested for use.

On the Public address ranges for VPC page, your address range now shows in the table. For IBM Cloud services, the status of your public address range changes from Updating to Stable.

Creating a public address range from the CLI

To create a public address range from the command line, follow these steps:

  1. Set up your CLI environment.

  2. Log in to your CLI environment. After you enter the password, the system prompts which account and region that you want to use:

    ibmcloud login --sso
    
  3. 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.

  4. Run the following command:

    ibmcloud is public-address-range-create --ipv4-address-count IPV4_ADDRESS_COUNT [--zone ZONE] [--name NAME] [--resource-group-id RESOURCE_GROUP_ID | --resource-group-name RESOURCE_GROUP_NAME | --all-resource-groups] [--vpc VPC] [--output JSON] [-q, --quiet]
    

    Where:

    --ipv4-address-count
    The total number of public IPv4 addresses required. Must be a power of 2.
    --zone
    The zone where this public address range will reside. When specifying the --zone option, --vpc is required.
    --name
    A unique identifier for the Private Path service, such as public-address-range-1.
    --resource-group-id
    ID of the resource group. This ID is mutually exclusive with --resource-group-name.
    --resource-group-name
    Name of the resource group. This name is mutually exclusive with --resource-group-id.
    --all-resource-groups
    Query all resource groups.
    --vpc
    The VPC this public address range attaches to. When specifying --vpc flag, --zone is required.
    --output
    The output format, only JSON is supported. One of: JSON.
    -q, --quiet
    Suppress verbose output.

Command examples

Create a public address range named public-address-range-1 with an address count of 8:

ibmcloud is public-address-range-create --name public-address-range-1 --ipv4-address-count 8

Create a public address range named public-address-range-2 with an address count of 4 and a resource group named Default:

ibmcloud is public-address-range-create --name public-address-range-2 --ipv4-address-count 4
--resource-group-name Default

Create a public address range named public-address-range-3 with an address count of 8, bound to VPC cli-test-vpc in zone us-south-1 with resource group ID 72b27b5c-f4b0-48bb-b954-5becc7c1dcb3:

ibmcloud is public-address-range-create --name public-address-range-3 --ipv4-address-count 8 --vpc
cli-test-vpc --zone us-south-1 --resource-group-id 72b27b5c-f4b0-48bb-b954-5becc7c1dcb3

Creating a public address range with the API

To create a public address range with the API, follow these steps:

  1. Set up your API environment.

  2. Store the following values in variables to be used in the API command:

    For example: version (string): The API version, in format YYYY-MM-DD.

  3. When all variables are initiated, do one of the following:

    • Create a public address range bound to a VPC:

         curl -X POST \
         "$vpc_api_endpoint/v1/public_address_ranges?version=$version&generation=2" \
         -H "Authorization: Bearer $iam_token" \
         -d '{
               "ipv4_address_count": 8,
               "name": "my-public-address-range",
               "target": {
                  "vpc": {
                     "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"
                  },
                  "zone": {
                     "name": "us-south-1"
                  }
               }
            }'
      
    • Create an unbound public address range:

      curl -X POST \
      "$vpc_api_endpoint/v1/public_address_ranges?version=$version&generation=2" \
      -H "Authorization: Bearer $iam_token" \
      -d '{
               "ipv4_address_count": 8,
               "name": "my-public-address-range"
            }'
      
      

If you need to change the size of the address range or the resource group, you must delete and recreate the address range.

Related links