Move an external IPv4 address to a different project

Static external IPv4 addresses are associated with a Trusted Cloud project and can be used only within that project. However, you can move a static external IPv4 address from one project to another.

IAM roles and permissions

To move a regional IP address, you must have the following permissions:

  • compute.addresses.delete in the source project
  • compute.addresses.create in the destination project

To move a global IP address, you must have the following permissions:

  • compute.globalAddresses.delete in the source project
  • compute.globalAddresses.create in the destination project

Example roles that include these permissions:

Before you begin

Limitations

  • If you unassign an IP address, you must wait some time before you move it:

    • For global IP addresses, wait 10 minutes.
    • For regional IP addresses, wait 20 minutes.
  • You can't change the region of a regional IP address.

  • You can't convert a global IP address to regional or a regional IP address to global.

Move an external IPv4 address to a different project

You can move a regional or global external IPv4 address from one project to another. When you move the IP address, by default the IP address resource is assigned the same name and description. However, you can choose to assign a new name or description. After the external IPv4 address is moved to a new project, you can assign it to eligible resources in that project.

Console

  1. In the Trusted Cloud console, go to IP addresses.

    Go to IP addresses

  2. In the More actions menu () of the IP address that you want to move, select Move to another project.

  3. Click Select project, and then select the project that you want to move the IP address to.

  4. Optional: Enter a new Name for the IP address.

  5. Optional: Enter a new Description for the IP address.

  6. Click Move.

gcloud

The command options vary depending on whether you're moving a regional or global IP address, and whether you're keeping or replacing the address name or description. The following examples describe some of these combinations.

  • Move a regional external IPv4 address to a different project:

    gcloud compute addresses move ADDRESS_NAME \
        --target-project=TARGET_PROJECT \
        --region=REGION
    
  • Move a regional external IPv4 address to a different project and assign it a new name and description in the new project:

    gcloud compute addresses move ADDRESS_NAME \
        --target-project=TARGET_PROJECT \
        --new-name=NEW_NAME \
        --description=NEW_DESCRIPTION \
        --region=REGION
    
  • Move a global external IPv4 address to a different project:

    gcloud compute addresses move ADDRESS_NAME \
        --target-project=TARGET_PROJECT \
        --global
    

Replace the following:

  • ADDRESS_NAME: the name of the IP address resource that you want to move.
  • TARGET_PROJECT: the name or ID of the project that you want to move the IP address to.
  • REGION: the region of the IP address.
  • NEW_NAME: a new name for the IP address resource in the new project.
  • NEW_DESCRIPTION: a new name for the IP address resource in the new project. If omitted, the existing description, if any, is used for the resource.

For more information, see the gcloud compute addresses move reference documentation.

API

The request details vary depending on whether you're moving a regional or global IP address, and whether you're keeping or replacing the address name or description. The following examples describe some of these combinations.

  • Move a regional external IPv4 address to a different project:

    POST https://www.s3nsapis.fr/compute/v1/projects/SOURCE_PROJECT/regions/REGION/addresses/ADDRESS_NAME/move
    {
      "destination_address": "projects/TARGET_PROJECT/global/addresses/ADDRESS_NAME",
    }
    
  • Move a regional external IPv4 address to a different project and assign it a new name and description in the new project:

    POST https://www.s3nsapis.fr/compute/v1/projects/SOURCE_PROJECT/regions/REGION/addresses/ADDRESS_NAME/move
    {
      "destination_address": "projects/TARGET_PROJECT/global/addresses/NEW_NAME",
      "description": "NEW_DESCRIPTION",
    }
    
  • Move a global external IPv4 address to a different project:

    POST https://www.s3nsapis.fr/compute/v1/projects/SOURCE_PROJECT/global/addresses/ADDRESS_NAME/move
    {
      "destination_address": "projects/TARGET_PROJECT/global/addresses/ADDRESS_NAME",
    }
    

Replace the following:

  • ADDRESS_NAME: the name of the IP address resource that you want to move.
  • SOURCE_PROJECT: the name or ID of the project that you want to move the IP address to.
  • TARGET_PROJECT: the name or ID of the project that you want to move the IP address to.
  • REGION: the region of the IP address.
  • NEW_NAME: a new name for the IP address resource in the new project.
  • NEW_DESCRIPTION: a new name for the IP address resource in the new project. If omitted, the existing description, if any, is used for the resource.