InvalidKeyPair.NotFound: The key pair 'x' does not exist
The key pair name you passed doesn’t exist in that region (key pairs are regional).
Seen on:
AWS
Meaning
Key pairs created in one region aren’t visible in others. Typos, deleted keys and Terraform configs that reference a key by name in another region cause it.
Common causes
- Key pair created in a different region
- Name typo or deleted key
- Wrong account/profile
⚡ Quick fix
- List keys in the region: aws ec2 describe-key-pairs
- Import your public key into this region
- Use the right profile/region
Detailed fix by platform
AWS CLI
- bash
aws ec2 describe-key-pairs --region eu-west-1 --query 'KeyPairs[].KeyName' aws ec2 import-key-pair --key-name deploy --public-key-material fileb://~/.ssh/id_ed25519.pub --region eu-west-1
How to diagnose
- Region — Where was the key created?
- Name — Exact key name
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- AWS.SimpleQueueService.NonExistentQueue SQS: The specified queue does not exist (AWS.SimpleQueueService.NonExistentQueue / QueueDoesNotExist)
- Instance reachability check failed EC2 status check failed: Instance reachability check failed (1/2 checks passed)
- InsufficientInstanceCapacity InsufficientInstanceCapacity: We currently do not have sufficient capacity in the Availability Zone you requested
Most viewed in AWS
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026