zsh-awsmultiaccount

February 18, 2026 ยท View on GitHub

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 installed and configured.
  • jq installed.
  • Access to AWS Organizations (for account lookup).

Features

  • Profile Management: awsprofile <profile> to switch AWS_PROFILE.
  • Role Assumption: awsrole <account-id|partial-name> to assume OrganizationAccountAccessRole in target account.
  • Account Lookup: Helpers to find Account IDs and Names.

Installation with Zap

Add the following to your .zshrc:

plug "acidix/zsh-awsmultiaccount"

Usage

Switch AWS Profile

awsprofile my-sso-profile

Run without arguments to unset AWS_PROFILE.

Assume Role in Account

# 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 <name>: Get Account ID from name.
  • awsaccountname <id>: Get Account Name from ID.

License

MIT License. See LICENSE file.