# zsh-awsmultiaccount A Zsh plugin for managing AWS profiles and assuming roles in a multi-account organization. It provides helper functions to easily switch between AWS profiles and assume the `OrganizationAccountAccessRole` in different accounts. ## Prerequisites - [AWS CLI](https://aws.amazon.com/cli/) installed and configured. - [jq](https://stedolan.github.io/jq/) installed. - Access to AWS Organizations (for account lookup). ## Features - **Profile Management**: `awsprofile ` to switch `AWS_PROFILE`. - **Role Assumption**: `awsrole ` to assume `OrganizationAccountAccessRole` in target account. - **Account Lookup**: Helpers to find Account IDs and Names. ## Installation with Zap Add the following to your `.zshrc`: ```zsh plug "acidix/zsh-awsmultiaccount" ``` ## Usage ### Switch AWS Profile ```zsh awsprofile my-sso-profile ``` Run without arguments to unset `AWS_PROFILE`. ### Assume Role in Account ```zsh # By Account ID awsrole 123456789012 # By Account Name (partial match) awsrole production ``` This assumes the `OrganizationAccountAccessRole` in the target account and exports temporary credentials (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`). ### Helpers - `awsaccountid `: Get Account ID from name. - `awsaccountname `: Get Account Name from ID. ## License MIT License. See [LICENSE](LICENSE) file.