Expired SSL/TLS certificate

Renew certificates before expiry and verify that the service presents the replacement.

Description

Renew certificates you import into ACM. Monitor the expiry date and reimport the renewed certificate from the issuer before the existing one expires.

Potential impact

ACM rejects an already-expired certificate at import. If a certificate expires while in service, clients that verify it can reject the connection.

Remediation

Check the new PEM’s dates and hostnames, its matching private key and the required certificate chain. Reimporting to the existing ARN preserves service associations. After replacement, connect to the service hostname with validation enabled and check the certificate it presents.

Examples

The legacy community.aws.aws_acm module finds the certificate by name_tag. Clients must trust the self-signed certificate used in this example.

Before

yaml
- name: upload a self-signed certificate
  community.aws.aws_acm:
    certificate: "{{ lookup('file', 'expiredCertificate.pem') }}"
    private_key: "{{ lookup('file', 'key.pem') }}"
    name_tag: my_cert

The first task fails if the certificate in expiredCertificate.pem has expired.

After

yaml
- name: upload a self-signed certificate
  community.aws.aws_acm:
    certificate: "{{ lookup('file', 'validCertificate.pem') }}"
    private_key: "{{ lookup('file', 'key.pem') }}"
    name_tag: my_cert

The second uses validCertificate.pem with the same tag and key.pem. Verify that the certificate and private key in those files match.

References