Proposed Workflow:
-
Gets a list of users and iterates through each of them.
-
Gets a list of access keys attached to the user and iterates through it,
-
Calculate the age of each key.
-
If the key age is within 60 - 70 days and is in an active state, we will create a new access key. A notification email will be sent to the user via SNS Topic Subscription.
-
If the key age is within 80 - 90 days, we will consider it eligible for deactivation. The keys will be deactivated and the notification will be sent over to the user.
-
If the key age is above 90 days, the keys will be deactivated and the notifications will be sent to the user.
-
Using Amazon Event Bridge Scheduler, we will have to ensure that the Lambda is scheduled to run every week.
This ensures that your Access Keys are always secured and rotated. The Complete Source code is attached to the article!
Read: https://codewithmukesh.com/blog/automated-aws-iam-access-key-rotation/
Do support me by subscribing to my YouTube channel for more .NET Content!