Expired SSL/TLS certificate stored in AWS IAM should be removed

Description

To enable HTTPS connections to your website or application in AWS, you need an SSL/TLS server certificate. You can use ACM or IAM to store and deploy server certificates. Use IAM as a certificate manager only when you must support HTTPS connections in a region that is not supported by ACM. IAM securely encrypts your private keys and stores the encrypted version in IAM SSL certificate storage. IAM supports deploying server certificates in all regions, but you must obtain your certificate from an external provider for use with AWS. You cannot upload an ACM certificate to IAM. Additionally, you cannot manage your certificates from the IAM Console.

Default value

By default, expired certificates won’t get deleted.

Rationale

Removing expired SSL/TLS certificates eliminates the risk that an invalid certificate will be deployed accidentally to a resource such as AWS Elastic Load Balancer (ELB), which can damage the credibility of the application/website behind the ELB. As a best practice, it is recommended to delete expired certificates.

Impact

Removing an expired server certificate may impact your application if it’s being used with services like Elastic Load Balancing or CloudFront. To avoid disruptions in application performance, ensure that the necessary configurations are made within each respective service.

Remediation

From the console:

Removing expired certificates via AWS Management Console is not currently supported. To delete SSL/TLS certificates stored in IAM via the AWS API, use the Command Line Interface (CLI).

From the command line:

To delete an expired certificate, run the following command by replacing <CERTIFICATE_NAME> with the name of the certificate:

aws iam delete-server-certificate --server-certificate-name <CERTIFICATE_NAME>

References

  1. https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html
  2. https://docs.aws.amazon.com/cli/latest/reference/iam/delete-server-certificate.html