All Projects → cytopia → aws-export-profile

cytopia / aws-export-profile

Licence: MIT License
Export AWS profiles to your shell environment

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to aws-export-profile

aws-export-assume-profile
Export AWS profiles to your shell environment
Stars: ✭ 40 (-11.11%)
Mutual labels:  aws-cli, environment-variables, environment-vars, aws-boto3, aws-profile, boto-profile
angular-environment
AngularJS Environment Plugin
Stars: ✭ 78 (+73.33%)
Mutual labels:  environment-variables, environment-vars
envyable
The simplest yaml to ENV config loader.
Stars: ✭ 78 (+73.33%)
Mutual labels:  environment-variables, environment-vars
envmnt
Environment variables utility functions.
Stars: ✭ 16 (-64.44%)
Mutual labels:  environment-variables, environment-vars
envman
Manage your .env configuration easily
Stars: ✭ 20 (-55.56%)
Mutual labels:  environment-variables, environment-vars
awsprofile
Shell script to ease management of AWS profiles
Stars: ✭ 12 (-73.33%)
Mutual labels:  aws-cli, aws-profile
env-dot-prop
♻️ Get, set, or delete nested properties of process.env using a dot path
Stars: ✭ 31 (-31.11%)
Mutual labels:  environment-variables, environment-vars
ionic-workflow-guide
Create a full and powerful worflow with Ionic (Unit Testing, Environment variables, Automatic documentation, Production App Server, Automatic deployment)
Stars: ✭ 46 (+2.22%)
Mutual labels:  environment-variables, environment-vars
ngx-env
Easily inject environment variables into your Angular applications
Stars: ✭ 73 (+62.22%)
Mutual labels:  environment-variables
hyper-kube-config
H Y P E R K U B E - A Serverless API and kubectl plugin providing a storage and retrieval Kubernetes cluster credentials. Hyperkube leverages AWS Secrets Manager for storing credential information.
Stars: ✭ 27 (-40%)
Mutual labels:  boto
parse it
A python library for parsing multiple types of config files, envvars & command line arguments that takes the headache out of setting app configurations.
Stars: ✭ 86 (+91.11%)
Mutual labels:  environment-variables
orcanode
Software for live-streaming and recording lossy or lossless compressed audio (HLS, DASH, FLAC) via AWS S3 buckets. ⭐
Stars: ✭ 23 (-48.89%)
Mutual labels:  boto
babyenv
Go environment var parsing, for babies
Stars: ✭ 30 (-33.33%)
Mutual labels:  environment-variables
fuck-env
Fuck environment variables everywhere
Stars: ✭ 14 (-68.89%)
Mutual labels:  environment-variables
flagga
An extensible Go library for handling program configuration using flags.
Stars: ✭ 28 (-37.78%)
Mutual labels:  environment-variables
cypress-dotenv
Cypress plugin that enables compatability with dotenv
Stars: ✭ 47 (+4.44%)
Mutual labels:  environment-variables
php-env
A small and fast .env loader for PHP
Stars: ✭ 19 (-57.78%)
Mutual labels:  environment-variables
onelogin-aws-cli
Assume an AWS Role and cache credentials using Onelogin
Stars: ✭ 55 (+22.22%)
Mutual labels:  aws-cli
aws-ssm-ec2-proxy-command
AWS SSM EC2 SSH Proxy Command
Stars: ✭ 115 (+155.56%)
Mutual labels:  aws-cli
pyaml env
Parse YAML configuration with environment variables in Python
Stars: ✭ 36 (-20%)
Mutual labels:  environment-variables

aws-export-profile

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.

This 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.

Build Status Release

Note: Wrap the command in $(aws-export-profile) to actually export your boto environment variables.

But why?

Most AWS related tools support boto profiles out of the box, such as the aws-cli (Example: aws ec2 --profile <BOTO_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.:

# Export staging boto profile
user> $(aws-export-profile staging)

# Make AWS login available inside your Docker container
user> docker run --rm -it \
  --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  --env AWS_REGION=$AWS_REGION \
  my-aws-docker

Available exports

The following export variables are currently supported.

Variable Description
AWS_ACCESS_KEY Access key
AWS_ACCESS_KEY_ID Alternative name for AWS_ACCESS_KEY
AWS_SECRET_KEY Secret key
AWS_SECRET_ACCESS_KEY Alternative name for AWS_SECRET_KEY
AWS_SESSION_TOKEN Session token
AWS_DELEGATION_TOKEN Alternative name for AWS_SESSION_TOKEN
AWS_SECURITY_TOKEN Secret token
AWS_REGION Region

Examples

This tool simply output the exports to stdout. In order to auto-source them, wrap the command in $(...).

Boto profile testing

user> aws-export-profile testing

export AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXXXXXXX"
export AWS_ACCESS_KEY="XXXXXXXXXXXXXXXXXXXX"
export AWS_SECRET_ACCESS_KEY="A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX"
export AWS_SECRET_KEY="A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX"
export AWS_REGION="eu-central-1"

Boto profile testing with custom paths

user> aws-export-profile deploy /jenkins/aws/credentials /jenkins/aws/config

export AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXXXXXXX"
export AWS_ACCESS_KEY="XXXXXXXXXXXXXXXXXXXX"
export AWS_SECRET_ACCESS_KEY="A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX"
export AWS_SECRET_KEY="A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX"
export AWS_REGION="eu-central-1"

Boto profile production with more exports

user> aws-export-profile production

export AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXXXXXXX"
export AWS_ACCESS_KEY="XXXXXXXXXXXXXXXXXXXX"
export AWS_SECRET_ACCESS_KEY="A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX"
export AWS_SECRET_KEY="A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX"
export AWS_SESSION_TOKEN="XXXXXXXXXXXXXXXXx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXX="
export AWS_DELEGATION_TOKEN="XXXXXXXXXXXXXXXXx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXX="
export AWS_REGION="eu-central-1"

Export boto profile production

user> $(aws-export-profile production)

# Validate
user> env | grep AWS_

AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXXXXXXX"
AWS_ACCESS_KEY="XXXXXXXXXXXXXXXXXXXX"
AWS_SECRET_ACCESS_KEY="A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX"
AWS_SECRET_KEY="A1Bc/XXXXXXXXXXXXXXXXXXXXXXXXXXX"
AWS_SESSION_TOKEN="XXXXXXXXXXXXXXXXx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXX="
AWS_DELEGATION_TOKEN="XXXXXXXXXXXXXXXXx/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXX="
AWS_REGION="eu-central-1"

Unset all AWS_ variables

user> $(aws-export-profile -u)

Usage

Usage: aws-export-profile [profile] [credentials] [config]
       aws-export-profile --unset, -u
       aws-export-profile --help|-h
       aws-export-profile --version|-v

This bash helper will output AWS export statements of your chosen aws boto profile.
Wrap this script in $(aws-export-profile) to export those environment variables.

Optional parameter:
    [profile]      Boto profile name to export. Default is 'default'
    [credentials]  Path to your aws credentials file.
                   Default is ~/.aws/credentials
    [config]       Path to your aws config file.
                   If no config file is found, AWS_REGION export will not be available.
                   Default is ~/.aws/config

Arguments:
    --unset, -u    Unset currently set AWS variables from env
    --help, -h     Show this help screen
    --version, -v  Show version

Available exports:
    AWS_ACCESS_KEY_ID
    AWS_ACCESS_KEY
    AWS_SECRET_ACCESS_KEY
    AWS_SECRET_KEY
    AWS_SESSION_TOKEN
    AWS_DELEGATION_TOKEN
    AWS_SECURITY_TOKEN
    AWS_REGION

Examples to show output:
    aws-export-profile testing
    aws-export-profile production /jenkins/aws/credentials /jenkins/aws/config

Examples to export:
    $(aws-export-profile testing)
    $(aws-export-profile production /jenkins/aws/credentials /jenkins/aws/config)

Examples to unset all AWS variables
    \$(aws-export-profile -u)

License

MIT License

Copyright (c) 2018 cytopia

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].