aws-assume-role

Crates.ioaws-assume-role
lib.rsaws-assume-role
version1.3.1
created_at2025-06-20 12:40:14.109422+00
updated_at2025-06-24 02:40:05.678313+00
descriptionSimple CLI tool to easily switch between AWS IAM roles across different accounts
homepagehttps://github.com/holdennguyen/aws-assume-role
repositoryhttps://github.com/holdennguyen/aws-assume-role
max_upload_size
id1719564
size256,502
Hung, Nguyen Minh (holdennguyen)

documentation

https://docs.rs/aws-assume-role

README

AWS Assume Role CLI

A fast, reliable command-line tool for switching between AWS IAM roles across different accounts. Built for modern development workflows with comprehensive multi-platform support.

CI/CD Pipeline Crates.io License: AGPL v3

โœจ Key Features

  • ๐Ÿ”„ Instant role switching between AWS accounts with simple commands
  • ๐Ÿ” Smart credential management with automatic region and session handling
  • ๐ŸŒ Multi-platform support (Linux, macOS Apple Silicon, Windows Git Bash)
  • ๐Ÿ“‹ Multiple output formats (shell exports, JSON, environment variables)
  • ๐Ÿ’พ Persistent configuration with intuitive JSON storage
  • โฑ๏ธ Flexible session control with custom durations and automatic refresh
  • ๐Ÿงช Battle-tested reliability (60 comprehensive tests across all platforms)
  • ๐Ÿš€ Zero-config installation via popular package managers

๐Ÿš€ Quick Start

Installation

Choose your preferred method:

# ๐Ÿบ Homebrew (macOS/Linux) - Recommended
brew tap holdennguyen/tap && brew install aws-assume-role

# ๐Ÿฆ€ Cargo (Rust users)
cargo install aws-assume-role

# ๐Ÿ“ฆ Direct download (any platform)
curl -L https://github.com/holdennguyen/aws-assume-role/releases/download/v1.3.0/aws-assume-role-cli-v1.3.0.zip -o aws-assume-role-cli-v1.3.0.zip
unzip aws-assume-role-cli-v1.3.0.zip && cd aws-assume-role-cli-v1.3.0
./INSTALL.sh

๐Ÿ“‹ Need help with installation? โ†’ Complete Installation Guide

Basic Usage

# 1. Configure your first role
awsr configure --name dev --role-arn arn:aws:iam::123456789012:role/DevRole --account-id 123456789012

# 2. Verify it worked by checking your AWS identity
aws sts get-caller-identity

Essential Commands

Command Purpose Example
awsr configure Add or update a role configuration awsr configure --name prod
awsr assume Assume a configured role and export credentials awsr assume dev --duration 7200
awsr list Show all configured roles awsr list
awsr remove Delete a role configuration awsr remove dev

๐Ÿ’ก Shell Integration

Make role switching even faster with aliases:

# Add to ~/.bashrc, ~/.zshrc, or your shell config
alias assume-dev='awsr assume dev'
alias assume-prod='awsr assume prod'
alias aws-whoami='aws sts get-caller-identity --query "Arn" --output text'

# Usage
assume-dev      # Switch to dev role
aws-whoami      # Check current identity

๐Ÿ“š Documentation

Document Purpose Target Audience
๐Ÿ“‹ Installation & Deployment Complete installation guide, prerequisites, enterprise deployment End Users, DevOps Teams
๐Ÿ‘จโ€๐Ÿ’ป Development Guide Development setup, testing, contributing, release workflow Contributors, Maintainers
๐Ÿ—๏ธ Technical Architecture System design, security architecture, technical deep-dive Technical Users, Architects
๐Ÿ“– Release Notes Version history, changelog, migration guides All Users

๐Ÿ”ง Configuration

  • ๐Ÿ“ Config Location: ~/.aws-assume-role/config.json
  • ๐Ÿ“ Format: Human-readable JSON with role definitions
  • ๐Ÿ”„ Auto-Creation: Created automatically when you configure your first role
  • ๐Ÿ”’ Permissions: Automatically secured with appropriate file permissions

Example configuration:

{
  "roles": {
    "dev": {
      "role_arn": "arn:aws:iam::123456789012:role/DevRole",
      "account_id": "123456789012",
      "region": "us-east-1"
    },
    "prod": {
      "role_arn": "arn:aws:iam::987654321098:role/ProdRole",
      "account_id": "987654321098",
      "region": "us-west-2"
    }
  },
  "default_duration": 3600,
  "default_region": "us-east-1"
}

๐Ÿ›ก๏ธ Security & Compliance

  • ๐Ÿ” Modern Cryptography: AWS SDK v1.x with aws-lc-rs backend
  • ๐Ÿ›ก๏ธ FIPS Ready: Optional FIPS 140-3 compliance support
  • ๐Ÿ” Security Audited: Clean security audit with zero known vulnerabilities
  • ๐Ÿ“‹ Enterprise Features: Audit logging, centralized configuration, policy compliance

๐Ÿ“ฆ Distribution & Availability

Platform Status Installation Command
๐Ÿฆ€ Cargo โœ… Live cargo install aws-assume-role
๐Ÿบ Homebrew โœ… Live brew tap holdennguyen/tap && brew install aws-assume-role
๐Ÿณ Container โœ… Live docker pull ghcr.io/holdennguyen/aws-assume-role:latest
๐Ÿ“ Direct Download โœ… Live GitHub Releases

๐Ÿš€ Getting Started for Different Users

๐Ÿ‘จโ€๐Ÿ’ป For Developers

  1. Quick Setup: Follow the Quick Start above
  2. Shell Integration: Add aliases for your most-used roles
  3. IDE Integration: Configure your IDE to use assumed role credentials
  4. Troubleshooting: Check our Development Guide for common issues

๐Ÿข For DevOps Teams

  1. Enterprise Installation: See Deployment Guide
  2. Centralized Configuration: Set up organization-wide role definitions
  3. CI/CD Integration: Use in your automated pipelines
  4. Monitoring: Set up audit logging and usage monitoring

๐Ÿ”ง For Contributors

  1. Development Setup: Follow the Development Guide
  2. Testing: Run our comprehensive test suite (cargo test)
  3. Contributing: Submit PRs following our development workflow
  4. Release Process: Maintainers see our Safe Release Process

๐ŸŽฏ Why Choose AWS Assume Role CLI?

Before (Traditional AWS CLI)

# Complex, error-prone, hard to remember
aws sts assume-role \
  --role-arn "arn:aws:iam::123456789012:role/DevRole" \
  --role-session-name "my-session-$(date +%s)" \
  --duration-seconds 3600 \
  --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' \
  --output text | while read access_key secret_key session_token; do
    export AWS_ACCESS_KEY_ID="$access_key"
    export AWS_SECRET_ACCESS_KEY="$secret_key"
    export AWS_SESSION_TOKEN="$session_token"
  done

After (AWS Assume Role CLI)

# Simple, reliable, memorable
awsr assume dev

๐ŸŽ‰ Result: 10x faster role switching, zero errors, works everywhere!

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

  1. ๐Ÿ“– Read the Development Guide: docs/DEVELOPER_WORKFLOW.md
  2. ๐Ÿงช Run Tests: cargo test (all 60 tests must pass)
  3. ๐Ÿš€ Submit Changes: Follow our git flow workflow as described in the development guide.

Quick development setup:

git clone https://github.com/holdennguyen/aws-assume-role.git
cd aws-assume-role
./dev-cli.sh check  # Run all quality checks
./target/release/aws-assume-role --help

๐Ÿ“Š Project Stats

  • ๐Ÿงช Test Coverage: 60 comprehensive tests (unit, integration, additional)
  • ๐ŸŒ Platform Support: Linux, macOS, Windows (100% test pass rate)
  • ๐Ÿ” Security: Zero known vulnerabilities, modern cryptography
  • ๐Ÿ“ฆ Distribution: 6+ installation methods, automated CI/CD
  • โšก Performance: Sub-second role switching, minimal resource usage

๐Ÿ“„ License

This project is licensed under the GNU AGPLv3 - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

Built with the modern Rust ecosystem and AWS SDK v1.x for reliable, secure AWS credential management. Special thanks to the AWS CLI team for providing the foundation this tool builds upon.


๐Ÿ’ก Need Help?

Commit count: 0

cargo fmt