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 cloud region.
This rule can help you with the following compliance standards:
- APRA
- MAS
For further details on compliance standards supported by Conformity, see here.
This rule can help you work with the AWS Well-Architected Framework.
This rule resolution is part of the Conformity Security & Compliance tool for AWS.
excellence
Removing unused SSH key pairs can significantly reduce the risk of unauthorized access to your Amazon 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 Amazon 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 cloud account, perform the following operations:
Remediation / Resolution
To decommission (remove) any unused Amazon EC2 key pairs from your AWS cloud account, perform the following operations:
References
- AWS Documentation
- What Is Amazon EC2?
- Amazon EC2 Key Pairs and Linux instances
- AWS Command Line Interface (CLI) Documentation
- ec2
- describe-key-pairs
- describe-instances
- delete-key-pair