{"id":13449943,"url":"https://github.com/99designs/aws-vault","last_synced_at":"2025-05-14T23:01:47.053Z","repository":{"id":36235274,"uuid":"40539602","full_name":"99designs/aws-vault","owner":"99designs","description":"A vault for securely storing and accessing AWS credentials in development environments","archived":false,"fork":false,"pushed_at":"2024-07-24T08:45:55.000Z","size":9720,"stargazers_count":8715,"open_issues_count":41,"forks_count":829,"subscribers_count":119,"default_branch":"master","last_synced_at":"2025-05-07T22:00:51.029Z","etag":null,"topics":["aws","aws-vault","cli","credentials","iam","keychain","mfa","temporary-credentials"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/99designs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-11T12:09:34.000Z","updated_at":"2025-05-07T03:56:06.000Z","dependencies_parsed_at":"2024-01-02T21:57:54.873Z","dependency_job_id":"72a3b7c6-5338-4ea2-a547-d378a9d4b54d","html_url":"https://github.com/99designs/aws-vault","commit_stats":{"total_commits":887,"total_committers":138,"mean_commits":6.427536231884058,"dds":0.5546786922209695,"last_synced_commit":"90c6834e431769acbeb13223dcae996923b8820e"},"previous_names":[],"tags_count":120,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/99designs%2Faws-vault","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/99designs%2Faws-vault/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/99designs%2Faws-vault/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/99designs%2Faws-vault/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/99designs","download_url":"https://codeload.github.com/99designs/aws-vault/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243353,"owners_count":22038044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-vault","cli","credentials","iam","keychain","mfa","temporary-credentials"],"created_at":"2024-07-31T07:00:23.139Z","updated_at":"2025-05-14T23:01:46.944Z","avatar_url":"https://github.com/99designs.png","language":"Go","readme":"# AWS Vault\n\n[![Downloads](https://img.shields.io/github/downloads/99designs/aws-vault/total.svg)](https://github.com/99designs/aws-vault/releases)\n[![Continuous Integration](https://github.com/99designs/aws-vault/workflows/Continuous%20Integration/badge.svg)](https://github.com/99designs/aws-vault/actions)\n\nAWS Vault is a tool to securely store and access AWS credentials in a development environment.\n\nAWS Vault stores IAM credentials in your operating system's secure keystore and then generates temporary credentials from those to expose to your shell and applications. It's designed to be complementary to the AWS CLI tools, and is aware of your [profiles and configuration in `~/.aws/config`](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files).\n\nCheck out the [announcement blog post](https://99designs.com.au/tech-blog/blog/2015/10/26/aws-vault/) for more details.\n\n## Installing\n\nYou can install AWS Vault:\n- by downloading the [latest release](https://github.com/99designs/aws-vault/releases/latest)\n- on macOS with [Homebrew Cask](https://formulae.brew.sh/cask/aws-vault): `brew install --cask aws-vault`\n- on macOS with [MacPorts](https://ports.macports.org/port/aws-vault/summary): `port install aws-vault`\n- on Windows with [Chocolatey](https://chocolatey.org/packages/aws-vault): `choco install aws-vault`\n- on Windows with [Scoop](https://scoop.sh/): `scoop install aws-vault`\n- on Linux with [Homebrew on Linux](https://formulae.brew.sh/formula/aws-vault): `brew install aws-vault`\n- on [Arch Linux](https://www.archlinux.org/packages/community/x86_64/aws-vault/): `pacman -S aws-vault`\n- on [Gentoo Linux](https://github.com/gentoo/guru/tree/master/app-admin/aws-vault): `emerge --ask app-admin/aws-vault` ([enable Guru first](https://wiki.gentoo.org/wiki/Project:GURU/Information_for_End_Users))\n- on [FreeBSD](https://www.freshports.org/security/aws-vault/): `pkg install aws-vault`\n- on [OpenSUSE](https://software.opensuse.org/package/aws-vault): enable devel:languages:go repo then `zypper install aws-vault`\n- with [Nix](https://search.nixos.org/packages?show=aws-vault\u0026query=aws-vault): `nix-env -i aws-vault`\n- with [asdf-vm](https://github.com/karancode/asdf-aws-vault): `asdf plugin-add aws-vault https://github.com/karancode/asdf-aws-vault.git \u0026\u0026 asdf install aws-vault \u003cversion\u003e`\n\n## Documentation\n\nConfig, usage, tips and tricks are available in the [USAGE.md](./USAGE.md) file.\n\n## Vaulting Backends\n\nThe supported vaulting backends are:\n\n* [macOS Keychain](https://support.apple.com/en-au/guide/keychain-access/welcome/mac)\n* [Windows Credential Manager](https://support.microsoft.com/en-au/help/4026814/windows-accessing-credential-manager)\n* Secret Service ([Gnome Keyring](https://wiki.gnome.org/Projects/GnomeKeyring), [KWallet](https://kde.org/applications/system/org.kde.kwalletmanager5))\n* [KWallet](https://kde.org/applications/system/org.kde.kwalletmanager5)\n* [Pass](https://www.passwordstore.org/)\n* Encrypted file\n\nUse the `--backend` flag or `AWS_VAULT_BACKEND` environment variable to specify.\n\n## Quick start\n\n```shell\n# Store AWS credentials for the \"jonsmith\" profile\n$ aws-vault add jonsmith\nEnter Access Key Id: ABDCDEFDASDASF\nEnter Secret Key: %%%\n\n# Execute a command (using temporary credentials)\n$ aws-vault exec jonsmith -- aws s3 ls\nbucket_1\nbucket_2\n\n# open a browser window and login to the AWS Console\n$ aws-vault login jonsmith\n\n# List credentials\n$ aws-vault list\nProfile                  Credentials              Sessions\n=======                  ===========              ========\njonsmith                 jonsmith                 -\n\n# Start a subshell with temporary credentials\n$ aws-vault exec jonsmith\nStarting subshell /bin/zsh, use `exit` to exit the subshell\n$ aws s3 ls\nbucket_1\nbucket_2\n```\n\n## How it works\n\n`aws-vault` uses Amazon's STS service to generate [temporary credentials](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) via the `GetSessionToken` or `AssumeRole` API calls. These expire in a short period of time, so the risk of leaking credentials is reduced.\n\nAWS Vault then exposes the temporary credentials to the sub-process in one of two ways\n\n1. **Environment variables** are written to the sub-process. Notice in the below example how the AWS credentials get written out\n   ```shell\n   $ aws-vault exec jonsmith -- env | grep AWS\n   AWS_VAULT=jonsmith\n   AWS_DEFAULT_REGION=us-east-1\n   AWS_REGION=us-east-1\n   AWS_ACCESS_KEY_ID=%%%\n   AWS_SECRET_ACCESS_KEY=%%%\n   AWS_SESSION_TOKEN=%%%\n   AWS_CREDENTIAL_EXPIRATION=2020-04-16T11:16:27Z\n   ```\n2. **Local metadata server** is started. This approach has the advantage that anything that uses Amazon's SDKs will automatically refresh credentials as needed, so session times can be as short as possible.\n   ```shell\n   $ aws-vault exec --server jonsmith -- env | grep AWS\n   AWS_VAULT=jonsmith\n   AWS_DEFAULT_REGION=us-east-1\n   AWS_REGION=us-east-1\n   AWS_CONTAINER_CREDENTIALS_FULL_URI=%%%\n   AWS_CONTAINER_AUTHORIZATION_TOKEN=%%%\n   ```\n\nThe default is to use environment variables, but you can opt-in to the local instance metadata server with the `--server` flag on the `exec` command.\n\n## Roles and MFA\n\n[Best-practice](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#delegate-using-roles) is to [create Roles to delegate permissions](https://docs.aws.amazon.com/cli/latest/userguide/cli-roles.html). For security, you should also require that users provide a one-time key generated from a multi-factor authentication (MFA) device.\n\nFirst you'll need to create the users and roles in IAM, as well as [setup an MFA device](https://docs.aws.amazon.com/IAM/latest/UserGuide/GenerateMFAConfigAccount.html). You can then [set up IAM roles to enforce MFA](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html#cli-configure-role-mfa).\n\nHere's an example configuration using roles and MFA:\n\n```ini\n[default]\nregion = us-east-1\n\n[profile jonsmith]\nmfa_serial = arn:aws:iam::111111111111:mfa/jonsmith\n\n[profile foo-readonly]\nsource_profile = jonsmith\nrole_arn = arn:aws:iam::22222222222:role/ReadOnly\n\n[profile foo-admin]\nsource_profile = jonsmith\nrole_arn = arn:aws:iam::22222222222:role/Administrator\nmfa_serial = arn:aws:iam::111111111111:mfa/jonsmith\n\n[profile bar-role1]\nsource_profile = jonsmith\nrole_arn = arn:aws:iam::333333333333:role/Role1\nmfa_serial = arn:aws:iam::111111111111:mfa/jonsmith\n\n[profile bar-role2]\nsource_profile = bar-role1\nrole_arn = arn:aws:iam::333333333333:role/Role2\nmfa_serial = arn:aws:iam::111111111111:mfa/jonsmith\n```\n\nHere's what you can expect from aws-vault\n\n| Command                                  | Credentials                 | Cached        | MFA |\n|------------------------------------------|-----------------------------|---------------|-----|\n| `aws-vault exec jonsmith --no-session`   | Long-term credentials       | No            | No  |\n| `aws-vault exec jonsmith`                | session-token               | session-token | Yes |\n| `aws-vault exec foo-readonly`            | role                        | No            | No  |\n| `aws-vault exec foo-admin`               | session-token + role        | session-token | Yes |\n| `aws-vault exec foo-admin --duration=2h` | role                        | role          | Yes |\n| `aws-vault exec bar-role2`               | session-token + role + role | session-token | Yes |\n| `aws-vault exec bar-role2 --no-session`  | role + role                 | role          | Yes |\n\n## Development\n\nThe [macOS release builds](https://github.com/99designs/aws-vault/releases) are code-signed to avoid extra prompts in Keychain. You can verify this with:\n```shell\n$ codesign --verify --verbose $(which aws-vault)\n```\n\nIf you are developing or compiling the aws-vault binary yourself, you can [generate a self-signed certificate](https://support.apple.com/en-au/guide/keychain-access/kyca8916/mac) by accessing Keychain Access \u003e Certificate Assistant \u003e Create Certificate -\u003e Certificate Type: Code Signing. You can then sign your binary with:\n```shell\n$ go build .\n$ codesign --sign \u003cName of certificate created above\u003e ./aws-vault\n```\n\n## References and Inspiration\n\n * https://github.com/pda/aws-keychain\n * https://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html\n * https://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPractices.html#create-iam-users\n * https://github.com/makethunder/awsudo\n * https://github.com/AdRoll/hologram\n * https://github.com/realestate-com-au/credulous\n * https://github.com/dump247/aws-mock-metadata\n * https://boto.readthedocs.org/en/latest/boto_config_tut.html\n","funding_links":[],"categories":["Go","Tools of Trade","Datastores","\u003ca id=\"c71ad1932bbf9c908af83917fe1fd5da\"\u003e\u003c/a\u003eAWS","\u003ca id=\"7e840ca27f1ff222fd25bc61a79b07ba\"\u003e\u003c/a\u003e特定目标","Secrets management","Public Cloud Governance","Infrastructure","Security Enabling Tools","cli","Open Source Repos","Shell Aliases"],"sub_categories":["Online resources","\u003ca id=\"0476f6b97e87176da0a0d7328f8747e7\"\u003e\u003c/a\u003eblog","\u003ca id=\"c71ad1932bbf9c908af83917fe1fd5da\"\u003e\u003c/a\u003eAWS","AWS Governance","CLI","Chess :chess_pawn:"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F99designs%2Faws-vault","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F99designs%2Faws-vault","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F99designs%2Faws-vault/lists"}