{"id":13623014,"url":"https://github.com/remind101/assume-role","last_synced_at":"2025-05-16T14:04:34.234Z","repository":{"id":44031948,"uuid":"50394608","full_name":"remind101/assume-role","owner":"remind101","description":"Easily assume AWS roles in your terminal.","archived":false,"fork":false,"pushed_at":"2023-03-18T19:51:46.000Z","size":1121,"stargazers_count":567,"open_issues_count":25,"forks_count":105,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-16T14:03:15.325Z","etag":null,"topics":["aws","iam-role","sts"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remind101.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}},"created_at":"2016-01-26T01:43:44.000Z","updated_at":"2025-05-08T08:45:32.000Z","dependencies_parsed_at":"2024-01-13T16:20:35.518Z","dependency_job_id":"cc04001d-4c2d-4384-a13d-926995bd7f7f","html_url":"https://github.com/remind101/assume-role","commit_stats":{"total_commits":34,"total_committers":11,"mean_commits":3.090909090909091,"dds":0.5294117647058824,"last_synced_commit":"06a34b06d24a610291bb0952f2a24341e67a9b6e"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remind101%2Fassume-role","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remind101%2Fassume-role/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remind101%2Fassume-role/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remind101%2Fassume-role/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remind101","download_url":"https://codeload.github.com/remind101/assume-role/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"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","iam-role","sts"],"created_at":"2024-08-01T21:01:26.997Z","updated_at":"2025-05-16T14:04:34.209Z","avatar_url":"https://github.com/remind101.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"This tool will request and set temporary credentials in your shell environment variables for a given role.\n\n## Installation\n\nOn OS X, the best way to get it is to use homebrew:\n\n```bash\nbrew install remind101/formulae/assume-role\n```\n\nIf you have a working Go 1.6/1.7 environment:\n\n```bash\n$ go get -u github.com/remind101/assume-role\n```\n\nOn Windows with PowerShell, you can use [scoop.sh](http://scoop.sh/)\n\n```cmd\n$ scoop bucket add extras\n$ scoop install assume-role\n```\n\n## Configuration\n\nSetup a profile for each role you would like to assume in `~/.aws/config`.\n\nFor example:\n\n`~/.aws/config`:\n\n```ini\n[profile usermgt]\nregion = us-east-1\n\n[profile stage]\n# Stage AWS Account.\nregion = us-east-1\nrole_arn = arn:aws:iam::1234:role/SuperUser\nsource_profile = usermgt\n\n[profile prod]\n# Production AWS Account.\nregion = us-east-1\nrole_arn = arn:aws:iam::9012:role/SuperUser\nmfa_serial = arn:aws:iam::5678:mfa/eric-holmes\nsource_profile = usermgt\n```\n\n`~/.aws/credentials`:\n\n```ini\n[usermgt]\naws_access_key_id = AKIMYFAKEEXAMPLE\naws_secret_access_key = wJalrXUtnFEMI/K7MDENG/MYxFAKEYEXAMPLEKEY\n```\n\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-roles.html\n\nIn this example, we have three AWS Account profiles:\n\n * usermgt\n * stage\n * prod\n\nEach member of the org has their own IAM user and access/secret key for the `usermgt` AWS Account.\nThe keys are stored in the `~/.aws/credentials` file.\n\nThe `stage` and `prod` AWS Accounts have an IAM role named `SuperUser`.\nThe `assume-role` tool helps a user authenticate (using their keys) and then assume the privilege of the `SuperUser` role, even across AWS accounts!\n\n## Usage\n\nPerform an action as the given IAM role:\n\n```bash\n$ assume-role stage aws iam get-user\n```\n\nThe `assume-role` tool sets `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN` environment variables and then executes the command provided.\n\nIf the role requires MFA, you will be asked for the token first:\n\n```bash\n$ assume-role prod aws iam get-user\nMFA code: 123456\n```\n\nIf no command is provided, `assume-role` will output the temporary security credentials:\n\n```bash\n$ assume-role prod\nexport AWS_ACCESS_KEY_ID=\"ASIAI....UOCA\"\nexport AWS_SECRET_ACCESS_KEY=\"DuH...G1d\"\nexport AWS_SESSION_TOKEN=\"AQ...1BQ==\"\nexport AWS_SECURITY_TOKEN=\"AQ...1BQ==\"\nexport ASSUMED_ROLE=\"prod\"\n# Run this to configure your shell:\n# eval $(assume-role prod)\n```\n\nOr windows PowerShell:\n```cmd\n$env:AWS_ACCESS_KEY_ID=\"ASIAI....UOCA\"\n$env:AWS_SECRET_ACCESS_KEY=\"DuH...G1d\"\n$env:AWS_SESSION_TOKEN=\"AQ...1BQ==\"\n$env:AWS_SECURITY_TOKEN=\"AQ...1BQ==\"\n$env:ASSUMED_ROLE=\"prod\"\n# Run this to configure your shell:\n# assume-role.exe prod | Invoke-Expression\n```\n\nIf you use `eval $(assume-role)` frequently, you may want to create a alias for it:\n\n* zsh\n```shell\nalias assume-role='function(){eval $(command assume-role $@);}'\n```\n* bash\n```shell\nfunction assume-role { eval $( $(which assume-role) $@); }\n```\n\n## TODO\n\n* [ ] Cache credentials.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremind101%2Fassume-role","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremind101%2Fassume-role","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremind101%2Fassume-role/lists"}