NEW: various python files

This commit is contained in:
xpk
2025-06-18 21:22:41 +08:00
parent 6c764730d3
commit 03797d6e8c
5 changed files with 135 additions and 9 deletions
+20
View File
@@ -0,0 +1,20 @@
"""
This program list all secrets and show their next rotation date if < 30d
"""
import boto3
from datetime import datetime, timezone
print("Secret DaysToNextRotation NextRotationDate")
sm_client = boto3.client('secretsmanager')
paginator = sm_client.get_paginator('list_secrets')
iterator = paginator.paginate()
for page in iterator:
for i in page.get('SecretList'):
if i.get("NextRotationDate") is not None:
NextRotationDate = i.get("NextRotationDate").replace(tzinfo=timezone.utc)
Today = datetime.now(timezone.utc)
Difference = (NextRotationDate - Today).days
# if Difference < 20:
print(i.get("Name"), Difference, NextRotationDate.date())