When working with Amazon Connect Customer, customers may occasionally encounter the error message: "Phone number not available: <phone number>. Try again with a different available number" while attempting to claim a phone number through the Connect console. This article provides an alternative method using the AWS Command Line Interface (CLI) to successfully claim phone numbers, along with a detailed explanation of the command structure.
When claiming a phone number through the Amazon Connect Customer console, you may encounter this error:
Phone number not available: <phone number>. Try again with a different available number.
Why This Happens
Phone number availability in Amazon Connect Customer is based on a shared inventory. The number you selected was available when the list loaded, but another customer or process claimed it before your request completed. This is a race condition — not an account or permissions issue.
Solution 1: Retry in the Console
In many cases, simply refreshing the available numbers list and selecting a different number resolves the issue. The console displays a fresh list of unclaimed numbers on each refresh.
If the error persists across multiple numbers, proceed to Solution 2.
Solution 2: Claim a Phone Number Using the AWS CLI
You can programmatically search for and claim an available phone number using the AWS CLI. This approach avoids the race condition by executing the search and claim in quick succession.
Prerequisites
- AWS CLI installed and configured with appropriate credentials
- jq installed for JSON processing (pre-installed in AWS CloudShell)
- IAM permissions for the following actions:
connect:SearchAvailablePhoneNumbers
connect:ClaimPhoneNumber
connect:DescribePhoneNumber
Step 1: Set Your Instance Variables
Replace the placeholder values with your Amazon Connect Customer instance region and instance ID:
INSTANCE_REGION=<your-connect-instance-region>
INSTANCE_ID=<your-connect-instance-id>
PHONE_NUMBER_COUNTRY_CODE=<country-code>
You can find your instance ID in the Amazon Connect Customer console under Instance ARN (it's the last segment after the final /). The country code should be the ISO 3166-1 alpha-2 code for your desired phone number country (e.g., US, GB, DE).
Step 2: Search for Available Phone Numbers
aws connect search-available-phone-numbers \
--phone-number-country-code $PHONE_NUMBER_COUNTRY_CODE \
--phone-number-type DID \
--instance-id $INSTANCE_ID \
--max-items 20 \
--region $INSTANCE_REGION
Parameters:
--phone-number-country-code — The ISO 3166-1 alpha-2 country code (e.g., US, GB, DE)
--phone-number-type — DID (Direct Inward Dialing) or TOLL_FREE
--max-items — Number of results to return (up to 20)
This returns a JSON response with an AvailableNumbersList array. Pick the last number from the results.
Step 3: Claim the Phone Number
aws connect claim-phone-number \
--instance-id $INSTANCE_ID \
--phone-number "<phone-number>" \
--region $INSTANCE_REGION
Replace <phone-number> with a phone number from the search results. The response includes a PhoneNumberId that you can use to verify the claim.
Step 4: Verify the Claim
aws connect describe-phone-number \
--phone-number-id <phone-number-id-from-step-3> \
--region $INSTANCE_REGION
A PhoneNumberStatus of CLAIMED confirms the number is now associated with your instance.
Combined One-Liner (Optional)
For convenience, you can chain these commands together. This searches for 20 available numbers, claims the last one in the list, and verifies the result in a single operation:
INSTANCE_REGION=<region> && \
INSTANCE_ID=<instance-id> && \
PHONE_NUMBER_COUNTRY_CODE=<country-code> && \
aws connect describe-phone-number \
--phone-number-id $(aws connect claim-phone-number \
--instance-id $INSTANCE_ID \
--phone-number $(aws connect search-available-phone-numbers \
--phone-number-country-code $PHONE_NUMBER_COUNTRY_CODE \
--phone-number-type DID \
--instance-id $INSTANCE_ID \
--max-items 20 \
--region $INSTANCE_REGION | jq -r '.AvailableNumbersList[19].PhoneNumber') \
--region $INSTANCE_REGION | jq -r '.PhoneNumberId') \
--region $INSTANCE_REGION
Note: This fetches 20 available numbers and claims the last one in the list (index 19), which is less likely to be contested by another customer simultaneously browsing available numbers. If you need a specific area code or prefix, use Step 2 first to review options, then claim your preferred number in Step 3.
Step 5: Confirm the Phone Number Status Is CLAIMED
When you first run describe-phone-number immediately after claiming, the PhoneNumberStatus may show IN_PROGRESS while the number is being provisioned:
"PhoneNumberStatus": {
"Status": "IN_PROGRESS"
}
Wait a few seconds and run the describe-phone-number command again to confirm the status has transitioned to CLAIMED:
aws connect describe-phone-number \
--phone-number-id <phone-number-id-from-step-3> \
--region $INSTANCE_REGION
A final status of CLAIMED confirms the phone number has been successfully provisioned and is associated with your instance:
"PhoneNumberStatus": {
"Status": "CLAIMED"
}
Additional Resources