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).
The key pair does not exist 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
- SignatureDoesNotMatch AWS: SignatureDoesNotMatch / InvalidClientTokenId — the request signature we calculated does not match
- NoSuchKey AWS S3: NoSuchKey / NoSuchBucket — The specified key/bucket does not exist
- Runtime.ImportModuleError Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'x'
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026