LoginSignup
7
7

More than 5 years have passed since last update.

AWS CLIとjqで有効期限切れのIAMサーバー証明書を探す

Posted at

AWSコマンドラインインターフェイス(CLI)と jqコマンドを使ってこれまでにIAMにアップロードしたサーバー証明書の中から有効期限切れになっているものを探す方法です。

AWS IAMのドキュメント

jqコマンド

実行したコマンド

$ TODAY=`date --utc +'%Y-%m-%dT00:00:00Z'`
$ aws iam list-server-certificates | jq --raw-output ".ServerCertificateMetadataList[] | select(.Expiration < ¥"${TODAY}¥") | .Expiration +¥" -- ¥"+ .ServerCertificateName"

出力結果

2014-06-26T23:59:59Z -- <証明書の名前>
2015-03-21T23:59:59Z -- <証明書の名前>
2013-11-30T23:59:59Z -- <証明書の名前>
...

jqコマンドはとても便利でした。

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7