aws-rotate-iam-keys
aws-rotate-iam-keys copied to clipboard
Where to set the Days to reset the IAM Keys
Hello rhyeal,
I'm trying to use this script to rotate my keys automatically. But I'm not find the place where you are giving the number of days it should rotate. And I have multiple keys which I want to rotate based on the days they have created but its not working as expected. And the task scheduler which this is creating that also not working as expected. Could you please check once in the windows machine and try to fix this code. If I fix before that I can also prove the same :)
I can see from file homebrew.mxcl.aws-rotate-iam-keys.plist
, section StartCalendarInterval
controls the run interval.
The default run time is set to run at 0323 daily.
I have not personally modified the run interval, maybe you can refer to the link below, modify and update back if it works? https://alvinalexander.com/mac-os-x/launchd-plist-examples-startinterval-startcalendarinterval/
I too am looking for a way to change the frequency with which aws-rotate-iam-keys
rotates keys. I'd prefer every few days or weekly (rather than daily). Is there a way to do this?
@levinotik if you are working with the Windows powershell script, all you have to do it is adding any of the options suggested in the following link, based on your needs :
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-create
as for my personal case, I am currently trying using /mo 90
( rotate the key every 90 days ) to be added straight after the -profile default /sc daily
values of the script itself.
That seems a nice idea, but sounds tricky to implement neatly (esp. if it is done in the launch daemon config).
The Homebrew formula hard-codes a daily schedule when generating the plist file, the time is somewhat irrelevant, but it is designed to run daily. You could edit the plist file though and change the schedule to limit it to specific weekdays etc.
Run brew services list
, get the path to the plist file, probably ~/Library/LaunchAgents/homebrew.mxcl.aws-rotate-iam-keys.plist
, edit it and add a Weekday
key/value to the StartCalendarInterval
dict.
Unfortunately, your changes will be obliterated if you re-install or upgrade. Maybe the formula installation process could read and respect any existing schedule to fix that. I might take a look sometime. PR for this would be most welcome :-)