Skip to main content

A simple CLI tool to manage AWS SSO sessions

Project description

Tori - AWS SSO Session Manager

Ultra-simple CLI tool to manage AWS SSO sessions across multiple organizations. Configure once per org, then just tori assume <account> and you're in!

Installation

Tori uses uv for dependency management.

# Install uv if you don't have it
brew install uv  # or: curl -LsSf https://astral.sh/uv/install.sh | sh

# Sync dependencies and install tori in editable mode
uv sync

# Run tori via uv (no activation needed)
uv run tori --help

# Or activate the venv to use `tori` directly
source .venv/bin/activate
tori --help

Quick Start

  1. Configure Tori with your SSO details:
tori configure my-org

Enter your SSO start URL and region when prompted. Tori will authenticate and cache all available accounts.

  1. List available accounts:
tori list

This shows all AWS accounts you have access to via SSO across all configured orgs.

  1. Assume a role:
tori assume my-account-name

This will:

  • Authenticate with AWS SSO (if needed)
  • Get temporary credentials
  • Back up your current default profile (if exists) to a named profile
  • Configure your default AWS CLI profile automatically
  • You're ready to use AWS CLI immediately!

Commands

tori configure <org-name>

Configure AWS SSO settings for an organization. You can configure multiple orgs.

Example:

tori configure my-company
# Enter SSO start URL: https://my-company.awsapps.com/start
# Enter SSO region: us-east-1

The first org you configure becomes the default. All accounts will be cached automatically.

tori assume <account> [org-name]

Assume an AWS SSO role and configure the default AWS profile with credentials.

Examples:

# Assume by account name (uses default org)
tori assume production

# Assume by account ID
tori assume 123456789012

# Assume from specific org
tori assume production my-company

# Assume with specific role (skips interactive selection)
tori assume production my-company --role AdminRole

Profile Backup: When you assume a new role, Tori automatically backs up your current default profile to profile_<account_id>_<role_name> so you can switch back later.

tori refresh [org-name]

Refresh cached accounts for an organization. Use this when new accounts or roles are added.

Examples:

# Refresh default org
tori refresh

# Refresh specific org
tori refresh my-company

tori list [org-name]

List all configured orgs and their AWS SSO accounts.

Examples:

# List all orgs and accounts
tori list

# List accounts for specific org
tori list my-company

tori status

Check your current AWS credentials status and see all backed up profiles.

tori default <org-name>

Set the default organization to use when org name is not specified.

Example:

tori default my-company

Configuration

Tori stores its configuration in ~/.tori/config.yaml:

default_org: my-company
orgs:
  my-company:
    sso_start_url: https://my-company.awsapps.com/start
    sso_region: us-east-1
    cached_accounts:
      production:
        accountId: '123456789012'
        accountName: production
        email: aws-prod@company.com
        roles:
          - AdminRole
          - ReadOnlyRole
  another-org:
    sso_start_url: https://another-org.awsapps.com/start
    sso_region: us-west-2
    cached_accounts: {}
active_profiles:
  profile_123456789012_AdminRole:
    account_id: '123456789012'
    role_name: AdminRole
    timestamp: '2025-11-21T10:30:00'

Credentials are automatically written to ~/.aws/credentials (default profile).

Multi-Org Workflow

Tori supports multiple SSO organizations:

  1. Configure multiple orgs:
tori configure company-prod
tori configure company-dev
tori configure client-org
  1. Set a default org (optional):
tori default company-prod
  1. Assume roles:
# Uses default org
tori assume my-account

# Uses specific org
tori assume my-account company-dev
  1. List all orgs:
tori list

Profile Management

When you assume a new role, Tori:

  1. Backs up your current default profile to a named profile
  2. Sets the new credentials as the default profile
  3. Tracks all backed up profiles in the config

Backed up profile naming: profile_<account_id>_<role_name>

View backed up profiles:

tori status

Switch back to a previous profile: Simply use tori assume with the account and role you want to switch to.

How it Works

  1. One-time setup per org: Store your SSO start URL and region
  2. Automatic caching: Accounts and roles are cached during configuration
  3. Explicit refresh: Only re-fetch accounts when you run tori refresh
  4. Assume roles:
    • Authenticate via AWS SSO (browser-based, only when needed)
    • Get temporary credentials for the selected account and role
    • Backup current default profile
    • Write new credentials to default AWS profile
    • Use AWS CLI normally!

No need to manage multiple profiles manually or remember account details - just use the account name!

Requirements

  • Python 3.8+
  • boto3 (AWS SDK)
  • click (CLI framework)
  • questionary (interactive prompts)
  • pyyaml (config management)
  • Internet connection for SSO authentication

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssof-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ssof-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file ssof-0.1.0.tar.gz.

File metadata

  • Download URL: ssof-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ssof-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48201cc573dc7970c16495278184ce01a870f3c14e22510684f85e85f1880a61
MD5 dd5e9d15dc695c24ece4d5a1ba1eb424
BLAKE2b-256 bfc3eb3362cdaec05c660ae6bfba8f4d5825fa737bf92e481221f772f46de373

See more details on using hashes here.

Provenance

The following attestation bundles were made for ssof-0.1.0.tar.gz:

Publisher: publish-pypi.yml on mrlikl/ssof

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ssof-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ssof-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ssof-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb4e376d526cfbe4a819d5683fdba7157b8e854723e09c01ad4660147586ead2
MD5 32530e2b32defc4c6dc571a170dee7ab
BLAKE2b-256 a6a5403239c7a29921cb0d48fdb5ec7e1bd516f546cf7e00501cf49dd378ccc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ssof-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on mrlikl/ssof

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page