Triage and Remediation
Check Cause
Using Console
Using Console
- Log in to the AWS Management Console and navigate to the API Gateway service.
- In the API Gateway dashboard, select the APIs that you want to examine.
- In the API details page, select the “Stages” option from the left navigation panel.
- In the Stages section, check the “Client Certificate for Endpoint Verification” field. If the certificate is set to expire in less than 30 days, it indicates a misconfiguration.
Using CLI
Using CLI
- First, you need to install and configure AWS CLI on your local machine. You can do this by following the instructions provided by AWS. Make sure you have the necessary permissions to access the ACM and API Gateway services.
- Once the AWS CLI is set up, you can list all the ACM Certificates using the following command:
- Now, for each Certificate ARN, you can describe the certificate to get its details including the expiration date. Use the following command:
- Now, you can write a script to compare the current date with the ‘NotAfter’ date. If the difference is less than 30 days, then the certificate is due for renewal in less than 30 days. Here is a simple Python script to do this:
Using Python
Using Python
-
Setup AWS SDK (Boto3) in Python Environment:
First, you need to set up AWS SDK (Boto3) in your Python environment. You can install it using pip:
Then, configure your AWS credentials either by setting up environment variables or by using AWS CLI.
-
List all ACM Certificates:
Use the
list_certificates
method from theboto3
client for ACM to get all the certificates. Here is a sample script: -
Get Certificate Details:
For each certificate, get the details using the
describe_certificate
method. This will give you the certificate’s expiry date. -
Check if Certificate is Expiring in Less Than 30 Days:
Compare the expiry date with the current date. If the difference is less than 30 days, then the certificate is due for renewal.
This script will print out the ARN of all certificates that are due for renewal in less than 30 days.