Triage and Remediation
Check Cause
Using Console
Using Console
- Log in to the AWS Management Console and open the API Gateway console at https://console.aws.amazon.com/apigateway/.
- In the navigation pane, choose ‘APIs’.
- In the APIs pane, choose the API you want to check.
- In the API details pane, choose ‘Custom Domain Names’. This will display a list of custom domain names associated with the API.
- For each custom domain name, check the ‘ACM Certificate’ column. If the certificate is expired, the status will be ‘Expired’.
Using CLI
Using CLI
-
Install and configure AWS CLI: Before you can start using AWS CLI, you need to install it on your local machine and configure it with your AWS account credentials. You can do this by running the following commands:
You will be prompted to provide your AWS Access Key ID, Secret Access Key, Default region name, and Default output format.
-
List all API Gateways: Use the following command to list all the API Gateways in your AWS account:
This command will return a list of all the REST APIs in your account.
-
Get the details of each API: For each API in the list, use the following command to get its details:
Replace
{rest-api-id}
with the ID of the API you want to check. This command will return the details of the specified API, including its name, ID, and description. -
Check the ACM Certificate: In the details of each API, look for the
clientCertificateId
field. This field contains the ID of the ACM Certificate associated with the API. Use the following command to get the details of the certificate:Replace{certificate-arn}
with the ARN of the certificate you want to check. This command will return the details of the certificate, including its status and expiration date. If the status isEXPIRED
, then the certificate has expired.
Using Python
Using Python
-
Install the necessary Python libraries: To interact with AWS services, you need to install the AWS SDK for Python (Boto3). You can install it using pip:
- Configure AWS Credentials: Before you can begin using Boto3, you need to set up authentication credentials for your AWS account using either the AWS CLI or by creating a credentials file manually. The credentials should have permissions to access the ACM and API Gateway services.
-
Create a Python script to list all the API Gateways and their associated ACM certificates:
-
Create a Python script to check the expiration date of the ACM certificates: