How do I transfer an Elastic IP address between AWS accounts in the same Region?

4 minute read
2

I use an Amazon Elastic IP address, and I want to transfer the address to another AWS account.

Short description

To transfer Elastic IP addresses between accounts in the same AWS Region, use either of the following methods:

  • The Amazon Elastic Compute Cloud (Amazon EC2) console
  • Amazon EC2 APIs

When you transfer an Elastic IP address, there's a two-step handshake between the source account and transfer account. The source account can be a standard AWS account or an AWS Organizations account. When the source account starts the transfer, the transfer account has 7 days to accept it. Otherwise, the Elastic IP address returns to its original owner.

AWS doesn't inform the transfer account about pending Elastic IP address transfer requests. To facilitate the transfer within the time frame, the source account owner must communicate this request to the transfer account owner.

Resolution

Use the Amazon EC2 console

For steps on how to send a transfer request through the Amazon EC2 console and prerequisites for it, see Activate Elastic IP address transfer.

After you send the transfer request, the owner of the transfer account must accept it. For steps on how to complete the transfer in the Amazon EC2 console, see Accept a transferred Elastic IP address.

Use the AWS CLI to transfer a single Elastic IP address

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re running a recent version of the AWS CLI. To verify that you correctly configured the AWS CLI, see Configuring the AWS CLI.

In the following example use case, source account A (111111111111) is transferring an Elastic IP address to transfer account B (222222222222).

In the following commands, replace ELASTIC_IP with your Elastic IP address. Replace us-east-1 with your AWS Region.

1.     In the source account, use either the Amazon EC2 console or AWS CLI to get the AllocationId of the Elastic IP address. For the AWS CLI, use the describe-addresses API call:

aws ec2 describe-addresses --filters "Name=public-ip,Values=ELASTIC_IP" --region us-east-1  
{  
    "Addresses": [  
        {  
            "PublicIp": "ELASTIC_IP",  
            "AllocationId": "eipalloc-1111111111111111",  
            "Domain": "vpc",  
            "PublicIpv4Pool": "amazon",  
            "NetworkBorderGroup": "us-east-1"  
        }  
    ]  
}

2.     In the source account, check if there are any existing or pending address transfers for the Elastic IP address. To do this, check the AllocationId (in this case, eipalloc-1111111111111111):

aws ec2 describe-address-transfers --query "AddressTransfers[?AllocationId=='eipalloc-11111111111111111']" --region us-east-1  
[ ]

In this example, there aren’t any existing or pending address transfers. This means that you can proceed with your new transfer.

3.    Use the enable-address-transfer API call to initiate the address transfer:

aws ec2 enable-address-transfer --allocation-id eipalloc-11111111111111111 --transfer-account-id 222222222222 --region us-east-1  
    "AddressTransfer": {  
        "PublicIp": "3.",  
        "AllocationId": "eipalloc-11111111111111111",  
        "TransferAccountId": "222222222222",  
        "TransferOfferExpirationTimestamp": "2022-10-28T08:44:41+00:00",  
        "AddressTransferStatus": "pending"  
    }  
}

4.   Notify the transfer account owner that the Elastic IP address transfer is in the Pending state and that they must accept the transfer. To accept the transfer, the transfer account owner uses the accept-address-transfer API call.

Note: The transfer account can't see the Elastic IP address that's in the Pending state. This is a security feature in case you accidentally send an IP address to the wrong account. In this case, you can cancel the transfer before the other account sees the IP address.

aws ec2 accept-address-transfer --address ELASTIC_IP --region us-east-1  
    "AddressTransfer": {  
        "PublicIp": "ELASTIC_IP",  
        "AllocationId": "eipalloc-11111111111111111",  
        "TransferAccountId": "222222222222",  
        "TransferOfferExpirationTimestamp": "2022-10-28T08:44:41+00:00",  
        "AddressTransferStatus": "accepted"  
    }  
}

If the acceptance fails, then you see one of the following errors:

  • AddressLimitExceeded
  • InvalidTransfer.AddressCustomPtrSet
  • InvalidTransfer.AddressAssociated

To troubleshoot any of these errors, see Accept a transferred Elastic IP address.

5.    After the Elastic IP address transfers successfully, the transfer account can use the describe-addresses API to confirm the transfer:

Note: A successful transfer generates a new AllocationId for the Elastic IP address in the transfer owner's account.

aws ec2 describe-addresses --filters "Name=public-ip,Values=ELASTIC_IP" --region us-east-1  
{  
    "Addresses": [  
        {  
            "PublicIp": "ELASTIC_IP",  
            "AllocationId": "eipalloc-22222222222222222",  
            "Domain": "vpc",  
            "PublicIpv4Pool": "amazon",  
            "NetworkBorderGroup": "us-east-1"  
        }  
    ]  
}

6.    The source account can use the describe-address-transfers API to confirm a successful transfer:

aws ec2 describe-address-transfers --query "AddressTransfers[?AllocationId=='eipalloc-11111111111111111']" --region us-east-1  
[  
       {  
            "PublicIp": "ELASTIC_IP",  
            "AllocationId": "eipalloc-11111111111111111",  
            "TransferAccountId": "222222222222",  
            "TransferOfferExpirationTimestamp": "2022-10-28T10:44:41+00:00",  
            "AddressTransferStatus": "accepted"  
        }  
]  
  

Related information

Amazon Virtual Private Cloud (VPC) now supports the transfer of Elastic IP addresses between AWS accounts

Transfer Elastic IP addresses

AWS OFFICIAL
AWS OFFICIALUpdated a year ago
2 Comments

What if the two Elastic IPs are both part of CloudFormation Stack?

replied 6 months ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

profile pictureAWS
MODERATOR
replied 6 months ago