{"id":15646757,"url":"https://github.com/cytopia/aws-export-profile","last_synced_at":"2025-04-30T12:28:54.169Z","repository":{"id":44463220,"uuid":"122110929","full_name":"cytopia/aws-export-profile","owner":"cytopia","description":"Export AWS profiles to your shell environment","archived":false,"fork":false,"pushed_at":"2019-07-02T03:44:53.000Z","size":24,"stargazers_count":46,"open_issues_count":3,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-09T21:51:02.270Z","etag":null,"topics":["aws","aws-boto3","aws-cli","aws-profile","boto","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}},"created_at":"2018-02-19T19:35:52.000Z","updated_at":"2024-07-30T01:24:17.000Z","dependencies_parsed_at":"2022-09-06T21:10:55.053Z","dependency_job_id":null,"html_url":"https://github.com/cytopia/aws-export-profile","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-profile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-profile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-profile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Faws-export-profile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cytopia","download_url":"https://codeload.github.com/cytopia/aws-export-profile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235208997,"owners_count":18953003,"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-boto3","aws-cli","aws-profile","boto","boto-profile","environment-variables","environment-vars"],"created_at":"2024-10-03T12:14:37.533Z","updated_at":"2025-01-23T00:55:51.528Z","avatar_url":"https://github.com/cytopia.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aws-export-profile\n\n`aws-export-profile` is a bash script that will output AWS export statements of your chosen aws boto profile. In case you have to manage multiple AWS accounts that rely on different boto profiles, you can *activate* a chosen profile by making it available in your shell environment.\n\nThis tool reads credentials from `~/.aws/credentials`. If you are looking for a way to export boto profiles via `aws sts assume-role` instead, have a lookt at **[aws-export-assume-profile](https://github.com/cytopia/aws-export-assume-profile)**.\n\n[![Build Status](https://travis-ci.org/cytopia/aws-export-profile.svg?branch=master)](https://travis-ci.org/cytopia/aws-export-profile)\n![Release](https://img.shields.io/github/release/cytopia/aws-export-profile.svg)\n\n**Note:** Wrap the command in **`$(aws-export-profile)`** to actually export your boto environment variables.\n\n\n## But why?\n\nMost AWS related tools support boto profiles out of the box, such as the `aws-cli` (Example: `aws ec2 --profile \u003cBOTO_PROFILE`). However sometimes it is required to have your chosen boto profile available as shell variables. One of the use cases is when you use Docker and want a specific boto login available inside your container.:\n```bash\n# Export staging boto profile\nuser\u003e $(aws-export-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_REGION=$AWS_REGION \\\n  my-aws-docker\n```\n\n\n## 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 |\n| `AWS_REGION`           | Region|\n\n\n## Examples\n\nThis tool simply output the exports to stdout. In order to auto-source them, wrap the command in **`$(...)`**.\n\n#### Boto profile `testing`\n\n```bash\nuser\u003e aws-export-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_REGION=\"eu-central-1\"\n```\n\n#### Boto profile `testing` with custom paths\n\n```bash\nuser\u003e aws-export-profile deploy /jenkins/aws/credentials /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_REGION=\"eu-central-1\"\n```\n\n#### Boto profile `production` with more exports\n```bash\nuser\u003e aws-export-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_DELEGATION_TOKEN=\"XXXXXXXXXXXXXXXXx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXX=\"\nexport AWS_REGION=\"eu-central-1\"\n```\n\n#### Export boto profile `production`\n```bash\nuser\u003e $(aws-export-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_DELEGATION_TOKEN=\"XXXXXXXXXXXXXXXXx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXX=\"\nAWS_REGION=\"eu-central-1\"\n```\n\n#### Unset all AWS_ variables\n```bash\nuser\u003e $(aws-export-profile -u)\n```\n\n\n## Usage\n\n```bash\nUsage: aws-export-profile [profile] [credentials] [config]\n       aws-export-profile --unset, -u\n       aws-export-profile --help|-h\n       aws-export-profile --version|-v\n\nThis bash helper will output AWS export statements of your chosen aws boto profile.\nWrap this script in $(aws-export-profile) to export those environment variables.\n\nOptional parameter:\n    [profile]      Boto profile name to export. Default is 'default'\n    [credentials]  Path to your aws credentials file.\n                   Default is ~/.aws/credentials\n    [config]       Path to your aws config file.\n                   If no config file is found, AWS_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\n    AWS_REGION\n\nExamples to show output:\n    aws-export-profile testing\n    aws-export-profile production /jenkins/aws/credentials /jenkins/aws/config\n\nExamples to export:\n    $(aws-export-profile testing)\n    $(aws-export-profile production /jenkins/aws/credentials /jenkins/aws/config)\n\nExamples to unset all AWS variables\n    \\$(aws-export-profile -u)\n```\n\n## License\n\n**[MIT License](LICENSE.md)**\n\nCopyright (c) 2018 [cytopia](https://github.com/cytopia)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcytopia%2Faws-export-profile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcytopia%2Faws-export-profile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcytopia%2Faws-export-profile/lists"}