Bring your own IP
AWS BYOIP: bring your own IPv4 addresses to EC2
You prove you control the range with a certificate in its registry record and ROAs naming AWS's ASNs, provision it into an address pool, and allocate Elastic IP addresses from it as you would from AWS's own. You can bring a leased range to EC2 the same way. Its holder adds your certificate and creates the ROAs. Addresses you bring are not billed the hourly public IPv4 charge.
This guide covers EC2 through the AWS CLI. The same range can also go through VPC IP Address Manager (IPAM), which adds a DNS-based way to prove control and the option to announce from your own ASN. AWS Global Accelerator has a process and requirements of its own, and AWS says addresses brought for one service cannot be used with another.
What AWS accepts
From AWS's documentation, on the day we checked:
- Size. The most specific IPv4 range you can bring is a /24.
- Registry. ARIN, the RIPE NCC or APNIC, and registered to a business or institution, never to a person.
- Status. The EC2 User Guide sets no requirement for the registry status. Until October 2021 it listed ALLOCATED PA, LEGACY and ASSIGNED PI. AWS's VPC FAQ still says AWS is "not accepting reassigned or reallocated prefixes at this time", using ARIN's terms for space a provider assigns to its customers. Even so, the RIPE Database and the routing table show AWS announcing leased blocks registered as ASSIGNED PA today.
- Global Accelerator. Its documentation keeps the list: at the RIPE NCC it accepts ALLOCATED PA, LEGACY and ASSIGNED PI, so a block registered as ASSIGNED PA does not qualify there.
- History. AWS may check the range's reputation and reject one with addresses that have a poor record (keeping a block clean).
- Legacy space is accepted but still needs ROAs.
- One Region at a time per range, and five ranges per Region by default; AWS Support can raise that.
- Where. Every commercial Region except the China Regions, and a list of Local Zones.
- Hands off the routing registry. AWS updates RADb itself, and a manual change that includes AWS's ASN makes provisioning fail.
Before you start
ROAs for AWS's ASNs. They must authorize AS16509 and AS14618, and any ASN announcing the range today, each with the maximum length set to the size of the range you bring. In the AWS GovCloud (US) Regions they name AS8987 instead, and in the AWS European Sovereign Cloud AS16509 and AS214101; through IPAM, set the maximum length to /24 so you can split the block. If you are moving the range from your own network, create the ROA for your current ASN first, so nothing that works now turns invalid (RPKI and ROAs). A ROA can take up to 24 hours to reach AWS.
A key pair and a certificate, made with OpenSSL 1.0.2 or later:
openssl genpkey -aes256 -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out private-key.pem
openssl req -new -x509 -key private-key.pem -days 365 | tr -d "\n" > certificate.pemThe certificate in the registry record, on one line, including the BEGIN and END markers. Where it goes depends on the registry, and the field matters:
| Registry | Where the certificate goes |
|---|---|
| RIPE NCC | A new descr line on the inetnum object. Not remarks |
| ARIN | Public Comments of the network, not of the organization |
| APNIC | remarks on the inetnum object |
You can remove the certificate once provisioning has finished.
Step by step
01Sign the authorization message. The message names your account, the range and an expiry date:
text_message="1|aws|123456789012|203.0.113.0/24|20261231|SHA256|RSAPSS"
signed_message=$(echo -n $text_message | openssl dgst -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1 -sign private-key.pem -keyform PEM | openssl base64 | tr -- '+=/' '-_~' | tr -d "\n")02Provision the range in the Region where you will use it:
aws ec2 provision-byoip-cidr --cidr 203.0.113.0/24 \
--cidr-authorization-context Message="$text_message",Signature="$signed_message" \
--region eu-central-103Wait for it. The status goes from pending-provision to provisioned. AWS says most ranges finish within two hours and some take up to a week. This command shows the range's status:
aws ec2 describe-byoip-cidrs --max-results 5 --region eu-central-104Prepare, then switch. To keep downtime short, allocate Elastic IP addresses from the new pool and attach them before the range is announced. The first command gives the pool's ID, and the second takes an address from it:
aws ec2 describe-public-ipv4-pools
aws ec2 allocate-address --public-ipv4-pool <pool-id>05Advertise. Stop announcing the range anywhere else, then:
aws ec2 advertise-byoip-cidr --cidr 203.0.113.0/24 --region eu-central-1AWS recommends withdrawing the range from other locations first; while someone else announces it, AWS cannot promise that traffic for it reaches its network. You must advertise exactly the range you provisioned, never a part of it.
06Check it from outside. The RIPE Database shows the certificate until it is removed, and RIPEstat's validator should call the range valid for AS16509:
whois -r -h whois.ripe.net 203.0.113.0/24 | grep descr
curl "https://stat.ripe.net/data/rpki-validation/data.json?resource=16509&prefix=203.0.113.0/24"Mistakes that cost a day
- The certificate in the wrong field. For the RIPE NCC, AWS reads
descrand explicitly notremarks. Azure wants the opposite, so a block moved between the two clouds needs the record changed. - A ROA with the wrong maximum length. AWS requires it to equal the size of the range you bring, or /24 through IPAM. A maximum length more specific than the range you bring invites sub-prefix hijacks, and AWS reserves the right to stop advertising a range whose ROAs do not follow its rules.
- Advertising part of the range. AWS advertises exactly what you provisioned. To use a smaller range, deprovision and provision again.
- Two networks announcing at once. Traffic splits between them, and AWS will not troubleshoot it.
Your own ASN
Through VPC IPAM, AWS can announce your range from your own ASN instead of its own. You add the same certificate to your ASN's registry record (for the RIPE NCC, as a descr line on the aut-num), create a second ROA naming your ASN, and AWS recommends an ASPA object that lists AS16509 and AS14618 as your providers. You can switch the origin back to AWS's ASN at any time, and to yours at most once an hour.
If you lease the block
Leased space works with EC2 in practice, provided the record names a business or institution, not a person. The holder does the registry side: the certificate in the block's own registry record (for the RIPE NCC, a descr line on its inetnum), which the holder maintains, and the ROAs for AS16509 and AS14618. AWS's documentation asks for no Letter of Authorization. You make the key pair and the certificate, sign the message and do the rest from your AWS account.
Where RTM Networks fits
We lease /24s and larger from our own RIPE NCC address space, and sell blocks in the RIPE NCC, ARIN and APNIC regions. For space leased from us we add your AWS certificate to the registry record and create the ROAs for AWS's ASNs, so the AWS side is all that is left to you (lease IPv4). If you want AWS to announce the range from your own ASN, we can be its sponsoring LIR at the RIPE NCC (sponsoring). If you need fewer than 256 addresses on an EC2 instance, we can deliver them over a tunnel instead (GRE and WireGuard tunnels). How the hourly IPv4 charge adds up, and when bringing your own pays: the real cost of cloud IPv4. Other providers: BYOIP guides.
Contact
Bringing your own IP to AWS?
Tell us the provider, the region and how many addresses you need. We lease /24s and larger with the registry work for your provider done, sell blocks outright, or deliver fewer addresses over a tunnel. We usually reply in 1-3 business hours.

