InvalidKeyPair.NotFound AWS Origin: Platform & cloud OSI layer 7 · Application Last updated 13 Oct 2026

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).

Exact message you may see The key pair does not exist
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

  1. List keys in the region: aws ec2 describe-key-pairs
  2. Import your public key into this region
  3. Use the right profile/region

Detailed fix by platform

AWS CLI

  1. 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

  1. Region — Where was the key created?
  2. 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:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

AWS.SimpleQueueService.NonExistentQueue — SQS: The specified queue does not exist (AWS.SimpleQueueService.NonExistentQueue / QueueDoesNotExist) (AWS)AWS.SimpleQueueServic…Instance reachability check failed — EC2 status check failed: Instance reachability check failed (1/2 checks passed) (AWS)Instance reachability…InsufficientInstanceCapacity — InsufficientInstanceCapacity: We currently do not have sufficient capacity in the Availability Zone you requested (AWS)InsufficientInstanceC…Invalid AWS Region — Terraform: Error: Invalid AWS Region: us-east-3 / Error: configuring Terraform AWS Provider: validating provider credentials: operation error STS: GetCallerIdentity (Terraform)Invalid AWS RegionInvalidAMIID.NotFound — InvalidAMIID.NotFound: The image id '[ami-xxxx]' does not exist (AWS)InvalidAMIID.NotFoundLocationNotAvailableForResourceType — LocationNotAvailableForResourceType / InvalidResourceLocation (Azure)LocationNotAvailableF…PermanentRedirect — S3 PermanentRedirect: The bucket you are attempting to access must be addressed using the specified endpoint (AWS)PermanentRedirectResourceNotFoundException (DynamoDB) — DynamoDB ResourceNotFoundException: Requested resource not found (table) (AWS)ResourceNotFoundExcep…InvalidKe…

Explore the map of this error Full error map →

🧠 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.