Skip to main content

op-aws-vault 🚀

A handy aws-vault-like utility built entirely on 1Password!

🤔 What is it?

Ever wished aws-vault played nicely with 1Password? Or found the official 1Password AWS plugin a little... quirky? This tool scratches that itch! ✨

It's a small Python script that mimics aws-vault's core behavior but integrates seamlessly with your 1Password vault. It leverages the power of the 1Password CLI (op).

Prerequisites:

  • A 1Password account
  • The 1Password CLI (op) installed and configured
  • The 1Password desktop app running and unlocked

Tested and working on macOS, Linux, Windows, and WSL2! ✅

Core Features:

  • 🔑 Execute commands or open a shell with temporary AWS credentials (including MFA support!) for any role you can assume.
  • 🌐 Log in to the AWS Management Console via federation with a single command.

No more juggling configuration files! All settings – AWS credentials, OTP secrets, and assumable roles – live securely within your 1Password vault. Set it up once, use it everywhere! 🌍

🛠️ How to install

  1. Create a Python Virtual Environment (recommended):
    python -m venv .venv
    source .venv/bin/activate # On Linux/macOS
    # .\.venv\Scripts\activate # On Windows
    
  2. Install using pip:
    pip install op-aws-vault
    

Tip: You might want to disable the 1Password AWS integration (unalias aws in your shell profile if needed) to avoid potential conflicts.

⚙️ Setup in 1Password

Create a new Login item (or use an existing one) in 1Password and add the following fields with these exact labels:

  • access key id (Your AWS Access Key ID)
  • secret access key (Your AWS Secret Access Key)
  • mfa serial (Your MFA device ARN, e.g., arn:aws:iam::123456789012:mfa/YourUser. Recommended!)
  • one-time password (Link this to the TOTP secret for your MFA device)
  • default-region (e.g., us-east-1, eu-west-1)
  • session name (Optional: A custom name for the AWS session. Defaults to op-aws-vault if omitted)
  • session duration (Optional: Set the default session duration, e.g., 15m, 1h, 8h. Overridden by the --duration command-line option. Defaults to 1h if neither is set.)

Adding Assumable Roles:

For each AWS role you want to assume, add a Text field with the label following the pattern role-{your-role-name}. The value should be the full ARN of the role.

Example:

  • Label: role-developer
  • Value: arn:aws:iam::987654321098:role/DeveloperRole

Add as many roles as you need!

Tagging:

Finally, add the tag aws-credentials to this 1Password item. This is how op-aws-vault finds your configuration.

Your item should look something like this:

Example Configuration

🚀 Usage

All commands require the role name as the first argument. This can be:

  • The name you defined after role- (e.g., developer from the example above).
  • default to use the base credentials directly (MFA will still be used if configured).

Expect 1Password to prompt for authentication periodically.

Common Optional Arguments:

  • --region <aws-region>: Specify the AWS region for the command (overrides default-region).
  • --duration <duration>: Set the session validity period (e.g., 15m, 1h, 8h). Defaults to 1h.

op-aws-vault exec 💻

Opens an authenticated shell or runs a command with the specified role's credentials.

Examples:

  • Open your default shell with the developer role credentials:
    op-aws-vault exec developer
    
  • Run a specific command (aws s3 ls) with the developer role:
    op-aws-vault exec developer -- aws s3 ls
    
  • Open a specific shell (/bin/bash) with the default credentials:
    op-aws-vault exec default -- /bin/bash
    

Unlike the original aws-vault, op-aws-vault sessions can be safely nested if needed.


op-aws-vault login 🌐

Generates a federated login URL for the AWS Management Console and opens it in your default web browser.

Example:

  • Log in to the console as the developer role:
    op-aws-vault login developer
    

Get URL Only:

If you prefer to copy the URL instead of opening a browser, use the --stdout flag:

op-aws-vault login developer --stdout

Happy vaulting! 🎉

Metadata

Release files for op-aws-vault 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for op-aws-vault 0.0.9
File Size Uploaded
op_aws_vault-0.0.9.tar.gz 20.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for op-aws-vault 0.0.9
File Interpreter ABI Platform
op_aws_vault-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 MB

Release files / op_aws_vault-0.0.9.tar.gz

Download URL op_aws_vault-0.0.9.tar.gz
Size 20.5 MB
Tags Source
SHA-256 checksum
How to use checksums
47325e02eb76f8df35ec02deb5257ac8e5e03ab2d7fee68ff82f6bb5f469e20b
BLAKE2b-256 checksum
How to use checksums
d4c95c4ae0c5f68ddde57a2b4cbbae28cdcd344f15b55b7074bb082cdc1022d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release files / op_aws_vault-0.0.9-py3-none-any.whl

Download URL op_aws_vault-0.0.9-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee0c869745856f878478288828082e401eb64cb8b31aa1c4a0cc67a1e17d4d3a
BLAKE2b-256 checksum
How to use checksums
834663583165305925c42d54b15756815db99d1740ed965ce95569e9b80923af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page