AWS

Security

Tutorials

How To List All Expired SSL Certificates on AWS

SSL certificates are critical for securing cloud infrastructure, encrypting data in transit, and maintaining compliance. However, expired certificates can cause outages, security vulnerabilities, and compliance issues. This guide walks you through how to identify and analyze expired AWS SSL certificates using CloudQuery, ensuring your cloud security posture remains strong.

We will use CloudQuery, to extract SSL certificate data from AWS services and analyze expiration statuses with SQL queries. Specifically, we will:

  • Sync AWS SSL Certificate Data from key services such as ACM, IAM, RDS, DocumentDB, MQ, and Transfer Family.
  • Run ClickHouse SQL Queries to analyze certificate expiration dates.

How to Sync Your AWS Cloud Infrastructure Data with CloudQuery

Follow these simple steps to set up CloudQuery and sync your Azure data:

Sign Up for CloudQuery
Start by creating a CloudQuery account.

Set Up Your Data Sync
Configure a new sync using the AWS Source Integration. Be sure to sync the tables for the AWS services you are using. These tables collectively cover ACM, IAM, RDS, DocumentDB, MQ, and Transfer Family certificates. If you are only interested in ACM-issued certificates, then aws_acm_certificates alone should be sufficient.

Run Your Data Sync
Click the “Run Sync” button to pull your AWS data into CloudQuery.

How to analyze your AWS SSL Certification data

With CloudQuery, you can run queries about your synced data directly in the integrated SQL Editor. You can run the following ClickHouse queries to give you a list of all your expired SSL Certificates on AWS.

Screenshot of the CloudQuery Platform’s SQL Console displaying a query to identify expired SSL certificates in AWS ACM. The query results table shows two rows with certificate details, including account ID, ARN, domain name, expiration date, and status.

Identifying Expired SSL Certificates in AWS Certificate Manager (ACM)

This query retrieves a list of SSL certificates managed by AWS Certificate Manager (ACM) and checks if they are expired. It pulls relevant details such as the AWS account ID, certificate ARN, domain name, expiration date, and current status. The query also calculates whether a certificate has expired by comparing its expiration date (not_after) with the current time.

SELECT
account_id,
arn,
domain_name,
not_after AS expiry_date,
status,
NOW() AS current_time,
not_after < NOW() AS is_expired
FROM aws_acm_certificates
ORDER BY not_after ASC;

Checking Expired IAM Server Certificates in AWS

This query retrieves all IAM server certificates stored in AWS and checks if any have expired. It pulls key details such as the AWS account ID, certificate ARN, certificate name, and expiration date. By comparing the expiration date with the current time, it determines whether each certificate is still valid.

SELECT
account_id,
arn,
server_certificate_name,
expiration AS expiry_date,
NOW() AS current_time,
expiration < NOW() AS is_expired
FROM aws_iam_server_certificates
ORDER BY expiration ASC;

How to Find All Expired SSL Certificates Across AWS Services

This query consolidates expired SSL certificates from multiple AWS services into a single result set. It checks expiration dates across six key AWS certificate sources:

SELECT 'IAM Server' AS source, account_id, arn, expiration AS expiry_date FROM aws_iam_server_certificates WHERE expiration < NOW()
UNION ALL
SELECT 'ACM PCA' AS source, account_id, arn, not_after FROM aws_acmpca_certificate_authorities WHERE not_after < NOW()
UNION ALL
SELECT 'ACM' AS source, account_id, arn, not_after FROM aws_acm_certificates WHERE not_after < NOW()
UNION ALL
SELECT 'RDS' AS source, account_id, arn, valid_till FROM aws_rds_certificates WHERE valid_till < NOW()
UNION ALL
SELECT 'DocumentDB' AS source, account_id, arn, valid_till FROM aws_docdb_certificates WHERE valid_till < NOW()
UNION ALL
SELECT 'Transfer Family' AS source, account_id, arn, not_after_date FROM aws_transfer_certificates WHERE not_after_date < NOW()
ORDER BY expiry_date ASC;

Wrap Up

By syncing AWS infrastructure data with CloudQuery and running these SQL queries, you can:

  • Quickly identify expired SSL certificates across multiple AWS services.
  • Prevent outages and security risks caused by expired certificates.
  • Ensure compliance by proactively managing certificate renewals.

Regularly running these queries will help keep your AWS cloud infrastructure secure and compliant.

CloudQuery simplifies cloud asset discovery and governance, making it easy to audit, monitor, and manage cloud environments at scale. If you haven’t already, get started with CloudQuery today to enhance your cloud visibility.

Have questions or need help? Join the CloudQuery Developer Community to connect with other users, share insights, and get support. Let us know how your team is tackling cloud security by engaging with us on LinkedIn, or X.

FAQs

  1. Can I use CloudQuery with other cloud providers besides AWS?
    Yes, CloudQuery supports a wide range of cloud providers, including GCP, Azure, and more.
  2. How do I authenticate CloudQuery to access my AWS resources?
    You’ll need AWS read-only credentials to authenticate. CloudQuery supports multiple authentication methods, such as environment variables, shared credentials files, and IAM roles.
  3. Can I query other types of AWS resources besides SSL Certificates?
    Absolutely. CloudQuery allows you to query various AWS resources, including S3 buckets, security groups, IAM roles, and more.

Try CloudQuery yourself

Self-hosted, open source, and free to start. Or schedule a demo to see the managed version.

Related posts

AWS

Security

Tutorials

Finding AWS Unrestricted Outbound Access in 2026: EC2, Lambda, and Beyond

Find EC2, Lambda, and ECS Fargate resources with unrestricted outbound access in AWS using SQL. Why egress controls still break attack chains in 2026.

Joe Karlsson

Joe Karlsson

May 5, 2026

AWS

Security

Tutorials

AWS IAM Identity Center with Google Workspace as an IdP: 2026 Step-by-Step Guide

Set up AWS IAM Identity Center with Google Workspace: SAML authentication, SCIM user provisioning, and group sync with CLI or ssosync. Updated for 2026.

Joe Karlsson

Joe Karlsson

May 5, 2026

AWS

Cloud Infrastructure

Security

Tutorials

Integrate AbuseIPDB Threat Intelligence with CloudQuery

Enrich your cloud asset inventory with AbuseIPDB threat intelligence to identify public cloud IPs with known abuse reports.

Joe Karlsson

Joe Karlsson

April 20, 2026

AWS

Security

Tutorials

AWS IAM Identity Center (Formerly AWS SSO): The Complete 2026 Guide

AWS IAM Identity Center replaced AWS SSO in 2022. Learn how to set it up, configure permission sets, use the AWS CLI, and audit access with CloudQuery.

Joe Karlsson

Joe Karlsson

April 6, 2026

AWS

Security

Tutorials

Set Up AWS CLI with SSO (IAM Identity Center) — Step by Step

Set up AWS CLI v2 with IAM Identity Center in 5 minutes. Covers SSO registration scopes, sso-session config, token refresh, and multi-account profiles.

Yevgeny Pats

Yevgeny Pats

February 25, 2026

AWS

GCP

Security

Tutorials

How to Inventory All Public IP Addresses Across AWS and GCP using CloudQuery

Track every public IP across AWS and GCP in minutes with SQL. Find exposed EC2 instances, unused Elastic IPs, and GCP Compute resources in one place.

Adam Cobb

Adam Cobb

Joe Karlsson

Joe Karlsson

December 19, 2025

AWS

Azure

GCP

Security

Tutorials

How to Find Internet-Facing Cloud Assets in AWS, Azure and GCP

Find all internet-facing cloud resources across AWS, Azure, and GCP. Identify exposed VMs, storage, databases, and load balancers to reduce attack surface.

Adam Cobb

Adam Cobb

November 5, 2025

AWS

Security

Tutorials

DORA Compliance Made Simple with CloudQuery

Ensure DORA compliance with CloudQuery. Automate cloud asset inventory, run SQL-powered audits, and benchmark against security best practices.

Mohamed Labouardy

Mohamed Labouardy

February 10, 2025

AWS

Security

Tutorials

Finding Cross-Account AWS EventBridge Usage

Learn how a CloudQuery customer used custom SQL queries to find cross-account AWS EventBridge usage and strengthen their event-driven security posture.

Jason Kao

Jason Kao

November 30, 2022

Own your pipeline.
Own your data.