{"id":15648052,"url":"https://github.com/cytopia/aws-export-assume-profile","last_synced_at":"2025-09-01T12:11:32.415Z","repository":{"id":39599583,"uuid":"184383475","full_name":"cytopia/aws-export-assume-profile","owner":"cytopia","description":"Export AWS profiles to your shell environment","archived":false,"fork":false,"pushed_at":"2023-11-01T14:38:57.000Z","size":27,"stargazers_count":42,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-30T14:13:00.635Z","etag":null,"topics":["aws","aws-boto3","aws-cli","aws-profile","aws-sts","boto-profile","environment-variables","environment-vars"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/cytopia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2019-05-01T07:33:47.000Z","updated_at":"2024-09-16T09:04:53.000Z","dependencies_parsed_at":"2024-02-08T04:35:18.539Z","dependency_job_id":"a6a153da-849a-4567-a683-7009f4bf040a","html_url":"https://github.com/cytopia/aws-export-assume-profile","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cytopia/aws-export-assume-profile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-assume-profile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-assume-profile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-assume-profile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-assume-profile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cytopia","download_url":"https://codeload.github.com/cytopia/aws-export-assume-profile/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-assume-profile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273122129,"owners_count":25049539,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-boto3","aws-cli","aws-profile","aws-sts","boto-profile","environment-variables","environment-vars"],"created_at":"2024-10-03T12:23:00.325Z","updated_at":"2025-09-01T12:11:32.365Z","avatar_url":"https://github.com/cytopia.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aws-export-assume-profile\n\n`aws-export-assume-profile` is a bash script that will output AWS export statements of your chosen aws profile. In case you have to manage multiple AWS accounts that rely on different profiles, you can *activate* a chosen profile by making it available in your shell environment.\n\nThis tool requires `aws` cli and retrieves credentials via `aws sts assume-role`. If you are looking for a way to export profiles already present in `~/.aws/credentials` have a look at **[aws-export-profile](https://github.com/cytopia/aws-export-profile)**.\n\n[![Build Status](https://github.com/cytopia/aws-export-assume-profile/workflows/linting/badge.svg)](https://github.com/cytopia/aws-export-assume-profile/actions?workflow=linting)\n![Release](https://img.shields.io/github/release/cytopia/aws-export-assume-profile.svg)\n\n**Note:** Wrap the command in **`$(aws-export-assume-profile)`** to actually export your profiled environment variables.\n\n\n## :question: But why?\n\nMost AWS related tools support profiles out of the box, such as the `aws-cli` (Example: `aws ec2 --profile \u003cAWS_PROFILE\u003e`). However sometimes it is required to have your chosen aws profile available as shell variables. One of the use cases is when you use Docker and want a specific login available inside your container.:\n```bash\n# Export staging aws profile\nuser\u003e $(aws-export-assume-profile staging)\n\n# Make AWS login available inside your Docker container\nuser\u003e docker run --rm -it \\\n  --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \\\n  --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \\\n  --env AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \\\n  my-aws-docker\n```\n\n\n## :arrow_forward: Available exports\n\nThe following export variables are currently supported.\n\n| Variable               | Description |\n|------------------------|-------------|\n| `AWS_ACCESS_KEY`       | Access key  |\n| `AWS_ACCESS_KEY_ID`    | Alternative name for `AWS_ACCESS_KEY`|\n| `AWS_SECRET_KEY`       | Secret key  |\n| `AWS_SECRET_ACCESS_KEY`| Alternative name for `AWS_SECRET_KEY`|\n| `AWS_SESSION_TOKEN`    | Session token |\n| `AWS_DELEGATION_TOKEN` | Alternative name for `AWS_SESSION_TOKEN` |\n| `AWS_SECURITY_TOKEN`   | Secret token (unset only) |\n| `AWS_DEFAULT_REGION`   | Region |\n\n\u003e https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html\n\n\n\n## :tada: Installation\n```bash\nsudo make install\n```\n\n\n## :bulb: Examples\n\nThis tool simply output the exports to stdout. In order to auto-source them, wrap the command in **`$(...)`**.\n\n#### AWS profile `testing`\n\n```bash\nuser\u003e aws-export-assume-profile testing\n\nexport AWS_ACCESS_KEY_ID=\"XXXXXXXXXXXXXXXXXXXX\"\nexport AWS_ACCESS_KEY=\"XXXXXXXXXXXXXXXXXXXX\"\nexport AWS_SECRET_ACCESS_KEY=\"A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nexport AWS_SECRET_KEY=\"A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nexport AWS_DEFAULT_REGION=\"eu-central-1\"\n```\n\n#### AWS profile `testing` with custom paths\n\n```bash\nuser\u003e aws-export-assume-profile deploy /jenkins/aws/config\n\nexport AWS_ACCESS_KEY_ID=\"XXXXXXXXXXXXXXXXXXXX\"\nexport AWS_ACCESS_KEY=\"XXXXXXXXXXXXXXXXXXXX\"\nexport AWS_SECRET_ACCESS_KEY=\"A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nexport AWS_SECRET_KEY=\"A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nexport AWS_DEFAULT_REGION=\"eu-central-1\"\n```\n\n#### AWS profile `production` with more exports\n```bash\nuser\u003e aws-export-assume-profile production\n\nexport AWS_ACCESS_KEY_ID=\"XXXXXXXXXXXXXXXXXXXX\"\nexport AWS_ACCESS_KEY=\"XXXXXXXXXXXXXXXXXXXX\"\nexport AWS_SECRET_ACCESS_KEY=\"A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nexport AWS_SECRET_KEY=\"A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nexport AWS_SESSION_TOKEN=\"XXXXXXXXXXXXXXXXx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXX=\"\nexport AWS_DEFAULT_REGION=\"eu-central-1\"\n```\n\n#### Export AWS profile `production`\n```bash\nuser\u003e $(aws-export-assume-profile production)\n\n# Validate\nuser\u003e env | grep AWS_\n\nAWS_ACCESS_KEY_ID=\"XXXXXXXXXXXXXXXXXXXX\"\nAWS_ACCESS_KEY=\"XXXXXXXXXXXXXXXXXXXX\"\nAWS_SECRET_ACCESS_KEY=\"A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nAWS_SECRET_KEY=\"A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\nAWS_SESSION_TOKEN=\"XXXXXXXXXXXXXXXXx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXX=\"\nAWS_DEFAULT_REGION=\"eu-central-1\"\n```\n\n#### Unset all AWS_ variables\n```bash\nuser\u003e $(aws-export-assume-profile -u)\n```\n\n\n## :computer: Usage\n\n```bash\nUsage: aws-export-assume-profile [profile] [config]\n       aws-export-assume-profile --unset, -u\n       aws-export-assume-profile --help, -h\n       aws-export-assume-profile --version, -v\n\nThis bash helper will output AWS export statements of your chosen aws profile.\nWrap this script in $(aws-export-assume-profile) to export those environment variables.\n\nOptional parameter:\n    [profile]      AWS profile name to export. Default is 'default'\n    [config]       Path to your aws config file.\n                   If no config file is found, AWS_DEFAULT_REGION export will not be available.\n                   Default is ~/.aws/config\n\nArguments:\n    --unset, -u    Unset currently set AWS variables from env\n    --help, -h     Show this help screen\n    --version, -v  Show version\n\nAvailable exports:\n    AWS_ACCESS_KEY_ID\n    AWS_ACCESS_KEY\n    AWS_SECRET_ACCESS_KEY\n    AWS_SECRET_KEY\n    AWS_SESSION_TOKEN\n    AWS_DELEGATION_TOKEN\n    AWS_SECURITY_TOKEN (unset only)\n    AWS_DEFAULT_REGION\n\nExamples to show output:\n    aws-export-assume-profile testing\n    aws-export-assume-profile production /jenkins/aws/config\n\nExamples to export:\n    $(aws-export-assume-profile testing)\n    $(aws-export-assume-profile production /jenkins/aws/config)\n\nExamples to unset all AWS variables\n    $(aws-export-assume-profile -u)\n\nMIT License\nCopyright (c) 2019 cytopia\nhttps://github.com/cytopia/aws-export-assume-profile\n```\n\n\n## :page_facing_up: License\n\n**[MIT License](LICENSE.md)**\n\nCopyright (c) 2019 [cytopia](https://github.com/cytopia)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcytopia%2Faws-export-assume-profile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcytopia%2Faws-export-assume-profile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcytopia%2Faws-export-assume-profile/lists"}