Hi@shalk,
You can list down your RDS snapshot. But you need to customize your script according to your requirement. You can take help from the below given script.
import
boto3
import datetime
def lambda_handler(event, context):
client = boto3.client('rds')
client.create_db_snapshot(
DBInstanceIdentifier='web-platform-slave',
DBSnapshotIdentifier='web-platform-%s' %
datetime.datetime.now().strftime("%y-%m-%d-%H"),
)
for snapshot in
client.describe_db_snapshots(DBInstanceIdentifier='web-platform-slave',
MaxRecords=50)['DBSnapshots']:
if create_ts < datetime.datetime.now() -
datetime.timedelta(days=7):
print "Deleting snapshot id:", snapshot['DBSnapshotIdentifier']
client.delete_db_snapshot(
DBSnapshotIdentifier=snapshot['DBSnapshotIdentifier']