如何在AWS Route53中按过期时间搜索/排序域名或导出对应列表?
Hey there! Let's tackle your question about managing domain expiry dates in AWS Route 53—since you've got multiple domains to coordinate with clients, these options should help you stay on top of things.
1. Direct Sorting in the Route 53 Console
First off, the good news: you can sort domains by expiration date directly in the Route 53 console—no extra tools needed. Here's how:
- Navigate to the
Registered Domainspage in Route 53. - Look for the
Expiration Datecolumn header (it's one of the default columns displayed). - Click the header to toggle between ascending and descending sort order (e.g., see soonest-expiring domains first).
That said, the console's search functionality doesn't let you filter domains by an expiration date range (like "all domains expiring in the next 30 days")—it only searches by keywords like domain name or owner email.
2. Exporting Domain Lists with Expiry Dates
If you need to sort/filter outside the console (or share the list with clients), exporting the data is the way to go. Here are two easy methods:
Option A: Console Export (Quick & Simple)
- On the
Registered Domainspage, select the domains you want to export (use the top checkbox to select all). - Click the
Export selectedbutton at the top of the page. - Choose CSV as the export format—this file will include the
Expiration Datefield, which you can open in Excel, Google Sheets, or any spreadsheet tool to sort, filter, or share.
Option B: AWS CLI (Automated/Bulk Processing)
For more control or to automate the process, use the AWS CLI. First, make sure your CLI is configured with the right permissions. Then run these commands:
List domains with expiry dates (table format):
aws route53domains list-domains --query "Domains[*].[DomainName, ExpirationDate]" --output table
Export to a CSV file:
aws route53domains list-domains --query "Domains[*].{Domain:DomainName, Expires:ExpirationDate}" --output csv > route53-domain-expiry.csv
Filter for domains expiring soon (e.g., next 30 days):
Combine the CLI with jq (a JSON processing tool) to narrow down results:
# Calculate the Unix timestamp for 30 days from now THIRTY_DAYS_OUT=$(($(date +%s) + 2592000)) # Fetch and filter domains expiring within that window aws route53domains list-domains --output json | jq --arg ts "$THIRTY_DAYS_OUT" '.Domains[] | select(.ExpirationDate <= $ts) | {DomainName, ExpirationDate}'
3. Bonus: Automate Expiry Alerts
To avoid manually checking expiry dates, set up automated reminders:
- For individual domains: Go to the domain's detail page in Route 53, scroll to
Expiration Notifications, and add email addresses to receive alerts 15, 7, and 1 day before expiry. - For bulk domains: Use AWS Lambda to periodically scan your Route 53 domains via API, then send custom alerts (e.g., Slack messages, team emails) for domains approaching expiry.
内容的提问来源于stack exchange,提问作者srt8driver




