Urgent.News

What's breaking now, across thousands of outlets.

Tech

aws console: open the AWS Console from your terminal, in one command

When you manage dozens of AWS accounts and roles, opening the Console is a tedious ritual: find the right profile, click to sign in, start over to switch accounts. I ended up packaging the shortcut I use every day into a dead-simple command: aws console my-profile And that's it: the AWS Console opens in your browser, signed in to the right account. The tools installs in one command and behaves…

Managing multiple AWS accounts and roles can be a cumbersome process when trying to open the AWS Console. The author of this story crafted a fast and simple solution by packaging their everyday shortcut into a single command, "aws console my-profile". This command effortlessly opens the AWS Console in your browser, signed in to the correct account.

Installation requires AWS CLI v2, curl, python3, and SSO or assume-role profiles. To install, run curl to download the package, extract it, navigate into the directory, and execute the install.sh script. The installer creates two equivalent aliases, "aws console" and "aws console-url", in the ~/.aws/cli/alias directory.

To verify the installation, use "aws console my-profile --print" to display the URL instead of opening the browser. You can also use "aws console my-profile" to open the account's console, specify a region with "--region", or force a specific browser with "--browser".

The tool supports default browser opening on macOS, Linux, and Windows Subsystem for Linux (WSL) and Git Bash. To jump to a specific service, use a second argument or "--service" option, such as "aws console my-profile ec2" to open the EC2 console directly. The tool handles most services automatically, with a few exceptions like S3, IAM, Route53, and Billing.

The AWS Console supports up to 5 simultaneous sessions in the same browser, enabling multi-account management. After the initial setup, signing into additional accounts is as simple as running "aws console account-a" and "aws console account-b" in separate terminal windows. The tool automatically detects and manages these sessions without overwriting the previous one. Users can enable or disable multi-session mode using the "--no-multi" flag.

For those who prefer a more streamlined workflow, a shell aws-helpers.sh file provides three functions (al, ap, and ac) to source from your ~/.zshrc or ~/.bashrc. These functions allow faster access to the AWS Console, setting the AWS_PROFILE, and opening the console with a single command. The typical workflow involves using "al" to ensure a valid SSO session, "ap my-profile" to select a profile, and "ac" to open the console.

The tool is open-source and licensed under MIT. You can find the code on GitHub and consider sponsoring the author if this tool saves you time.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in Tech

More from Tuesday 22 September →