Simplify your AWS Single Sign-On (SSO) profile configuration process with this effective shell script. A perfect solution for individual developers and teams managing multiple AWS accounts and frequently alternating between various SSO profiles.
Before launching this script, please ensure to install the following dependencies:
- AWS CLI
- jq
Refer to their respective documentation for the installation process.
- Clone the repository to your local system:
git clone https://github.com/YOUR_GITHUB_USERNAME/aws-sso-config.git
- Navigate into the cloned repository:
cd aws-sso-config
- Assign execution permission to the script:
chmod +x awsaccounts.sh
For script execution, use bash or zsh:
- Bash users:
bash awsaccounts.sh
- Zsh users:
zsh awsaccounts.sh
Here's a rundown of how the script operates:
- Verifies the installation of the required tools (
jq
andaws
), providing installation instructions if any are missing. - Lists all available AWS SSO profiles and prompts you to select one.
- Validates the AWS SSO session related to the chosen profile, establishing a new session if the existing one has expired.
- Validates the connection to the selected AWS SSO profile and proceeds with its configuration.
- Sets the chosen AWS SSO profile as the
AWS_PROFILE
environment variable in your shell profile.
The script auto-detects your shell (bash
or zsh
) and accordingly updates the AWS_PROFILE
environment variable in the correct shell profile file.
Upon successful configuration of the AWS SSO profile and updating your shell profile, apply the changes to reflect them in your current shell session.
For bash users, run the following command:
source ~/.bashrc
For zsh users, run the following command:
source ~/.zshrc
This project operates under the Apache License 2.0. For more information, see the LICENSE.md file.
Please replace "YOUR_GITHUB_USERNAME" with your actual GitHub username in the repository cloning command.