Skip to content

Instantly share code, notes, and snippets.

@ideadapt
Last active July 2, 2024 11:52
Show Gist options
  • Save ideadapt/d293e31b80a68a7e00c7c9c8fcc6d50a to your computer and use it in GitHub Desktop.
Save ideadapt/d293e31b80a68a7e00c7c9c8fcc6d50a to your computer and use it in GitHub Desktop.
AWS Management Console signed in account name label - Tampermonkey / Greasemonkey Userscript
// ==UserScript==
// @name AWS account name label in AWS Console
// @namespace userscripts
// @version 0.2
// @description Adds AWS account name label to navigation bar in AWS Console
// @author [email protected]
// @match https://*.console.aws.amazon.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.setTimeout(() => {
const label = (unsafeWindow || window).ConsoleNavService.AccountInfo.loginDisplayNameAccount;
const o = document.createElement("div");
const color = {dev:'green',int:'brown',prd:'red'}[label.split('-').pop()]; // adjust to your account name schema
o.innerHTML="<div style='position: absolute; top: 33px; right: 32px; background-color: "+color+"; color: white; z-index: 2000; font-family: sans-serif; padding: 5px;'>"+label+"</div>";
const i = o.firstChild;
document.body.appendChild(i);
}, 5000);
})();
@carpnick
Copy link

carpnick commented Oct 9, 2023

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment