GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - soniah/awsenv: AWS environment config loader

BranchesTags
Open more actions menu

Latest commit

 

History

23 Commits
23 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
.gometalinter.json
.gometalinter.json
 
 
.goxc.json
.goxc.json
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
main.go
main.go
 
 

Repository files navigation

awsenv

AWS environment config loader.

awsenv is a small binary that loads AWS environment variables for an AWS profile from ~/.aws/credentials - useful if you're regularly switching credentials and using tools like Vagrant. In addition to aws_access_key_id and aws_secret_access_key, it will also optionally load settings for aws_keyname and aws_keypath.

Installation

# install Go from https://golang.org/dl/
export GOPATH=$HOME/go
go get -u github.com/soniah/awsenv

This will automatically download, compile and install the awsenv executable to $GOPATH/bin.

Usage

Import variables into your environment by eval-ing a backticked call to awsenv.

eval `awsenv profile-name`

For example, if you had the following credential files:

% cat ~/.aws/credentials
[example1]
aws_access_key_id = DEADBEEFDEADBEEF
aws_secret_access_key = DEADBEEFDEADBEEF1vzfgefDEADBEEFDEADBEEF

% cat /var/tmp/credentials
[example2]
aws_access_key_id = DEADBEEFDEADBEEF
aws_secret_access_key = DEADBEEFDEADBEEF1vzfgefDEADBEEFDEADBEEF
aws_keyname = 'example2_key'
aws_keypath = "~/.ssh/example2.pem"

The following shell commands would import AWS variables into your environment:

% eval `awsenv example1`
% env | grep AWS
AWS_ACCESS_KEY_ID=DEADBEEFDEADBEEF
AWS_SECRET_ACCESS_KEY=DEADBEEFDEADBEEF1vzfgefDEADBEEFDEADBEEF

% eval `awsenv example2 -f /var/tmp/credentials -v`
AWS_ACCESS_KEY_ID=DEADBEEFDEADBEEF
AWS_SECRET_ACCESS_KEY=DEADBEEFDEADBEEF1vzfgefDEADBEEFDEADBEEF
AWS_KEYNAME=example2_key
AWS_KEYPATH=/Users/sonia/.ssh/example2.pem

Vagrant Example

In a Vagrantfile you could do:

override.ssh.username = "ubuntu"
aws.keypair_name = ENV['AWS_KEYNAME']
override.ssh.private_key_path = ENV['AWS_KEYPATH']

Flags

The accepted flags can be displayed using -h:

% awsenv -h
Usage:
  awsenv [OPTIONS] Profile

Application Options:
  -v, --verbose   Verbose output
  -f, --filename= Credentials file (~/.aws/credentials)

Help Options:
  -h, --help      Show this help message

Arguments:
  Profile

Contributions

Contributions are welcome; here is an example workflow using hub.

  1. go get github.com/soniah/awsenv
  2. cd $GOPATH/src/github.com/soniah/awsenv
  3. hub fork
  4. git co -b dev (and write some code)
  5. git push -u <your-github-username> dev
  6. hub pull-request

About

AWS environment config loader

Topics

gogolang

Resources

Readme
Apache-2.0 license
Activity

Stars

35 stars

Watchers

1 watching

Forks

6 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.