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:
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.
To determine if you have any unused Amazon EC2 key pairs still available within your AWS account, perform the following:
To decommission (remove) any unused EC2 key pairs provisioned within your AWS account, perform the following: