AWS Console only remembers the last 5 role-account combination for switching role. Switching role in the console is usually a cumbersome operation (you need to fill a form, and account numbers are difficult to remember)
This script lets you configure a set of role-account pairs and they will always appear just next to your switch role history. Additionally, it will let you choose arbitrary colors for those roles, and will change the AWS Console header color to match the current environment color.
You need to have Tampermonkey or Violentmonkey extension installed and activated.
Install script by visiting the raw version
Visit the AWS Console for the first time with the userscript activated. This will create a default configuration for you in the userscript manager preferences, so your configuration will persist across userscript updates.
Once you have done that, edit the script in your userscript extension management page, go to Storage
tab and edit the config.
displayName
: How the name will be displayed in the menuroleName
: the target role you are switching toaccountNumber
: The AWS account number of the account you are switching tomfaNeeded
:0
if not needed,1
if it's requirednavColor
: The color for the navigation bar when you change to this rolebackgroundColor
: The background color for the menu icon (empty if you use an icon other than
)labelIcon
: The icon for the menu element (AWS default is
)
{
"userConfig": [
{
"displayName": "development",
"roleName": "myawsrole",
"accountNumber": "00000000",
"mfaNeeded": "0",
"navColor": "14fc03",
"backgroundColor": "",
"labelIcon": "😁"
},
{
"displayName": "staging",
"roleName": "myawsrole",
"accountNumber": "00000000",
"mfaNeeded": "0",
"navColor": "031cfc",
"backgroundColor": "",
"labelIcon": "🚀"
}
]
}
Save config in the Storage tab for the userscript (edit script, then go to the storage tab). If the storage tab is not present, remember to generate the config by visiting the AWS console once with the userscript activated, then reload the script editing page.
Enjoy!