Identify and remove any unused Amazon EC2 key pairs in order to adhere to AWS security best practices and protect against unapproved SSH access. An SSH key pair is evaluated as unused when is not associated with any of the EC2 instances available in the same AWS region.
This rule can help you with the following compliance standards:
- APRA
- MAS
This rule can help you work with the AWS Well-Architected Framework
This rule resolution is part of the Cloud Conformity Security & Compliance tool for AWS
Removing unused SSH key pairs can significantly reduce the risk of unauthorized access to your AWS EC2 instances as these key pairs can be reassociated at any time, providing access (usually by mistake) to the wrong users. Ideally, you will want to restrict access to your EC2 resources for all individuals who leave your organization, department or project that still possess the private key from the SSH key pair used.
Audit
To determine if you have any unused Amazon EC2 key pairs still available within your AWS account, perform the following:
Remediation / Resolution
To decommission (remove) any unused EC2 key pairs provisioned within your AWS account, perform the following:
References
- AWS Documentation
- What Is Amazon EC2?
- Network and Security
- Amazon EC2 Key Pairs
- AWS Command Line Interface (CLI) Documentation
- Using Key Pairs
- ec2
- describe-key-pairs
- describe-instances
- delete-key-pair
Unlock the Remediation Steps
Gain free unlimited access
to our full Knowledge Base
Over 750 rules & best practices
for and
Get started for FREE
You are auditing:
Unused AWS EC2 Key Pairs
Risk level: Medium