简体   繁体   English

我想是否有办法使用 aws acm list-certificates 以及有效性和域名来查找所有 ACM 证书

[英]I would like if there is way to find all the ACM certs using aws acm list-certificates along with validity and domain name

I would like if there is way to find all the ACM certs using aws acm list-certificates along with validity and domain name.Because i am looking to find the cert information which are less 30days.我想是否有办法使用 aws acm list-certificates 以及有效性和域名来查找所有 ACM 证书。因为我希望找到少于 30 天的证书信息。

Thanks, Kalyan谢谢, 卡利安

You can't do it with just list-certificates , you also need describe-certificate :你不能只使用list-certificates ,你还需要describe-certificate

for c in $(aws acm list-certificates --query 'CertificateSummaryList[].CertificateArn' --output text)
    do aws acm describe-certificate --certificate-arn $c --query 'Certificate.[CertificateArn,DomainName,Status,NotAfter]'
    done

If you run this you'll see the information about all of your certificates in the region, with the domains they cover and expiration timestamp.如果您运行此程序,您将看到有关该区域中所有证书的信息,包括它们所覆盖的域和到期时间戳。 Note that the expiration timestamp is a UNIX timestamp (seconds since epoch), not a date.请注意,过期时间戳是 UNIX 时间戳(自纪元以来的秒数),而不是日期。

Given that you want to test the timestamp, I'd recommend using a language such as Python rather than stringing together CLI invocations.鉴于您要测试时间戳,我建议使用诸如 Python 之类的语言,而不是将 CLI 调用串在一起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM