Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soniah/awsenv
AWS environment config loader
https://github.com/soniah/awsenv
go golang
Last synced: about 2 months ago
JSON representation
AWS environment config loader
- Host: GitHub
- URL: https://github.com/soniah/awsenv
- Owner: soniah
- License: apache-2.0
- Created: 2015-08-05T07:21:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-17T14:05:46.000Z (over 6 years ago)
- Last Synced: 2024-10-15T02:22:24.089Z (2 months ago)
- Topics: go, golang
- Language: Go
- Size: 17.6 KB
- Stars: 35
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - awsenv - AWS environment config loader - ★ 16 (Software Packages)
- awesome-go-extra - awsenv - 08-05T07:21:24Z|2018-07-17T14:05:46Z| (Go Tools / DevOps Tools)
README
# 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](https://www.vagrantup.com/). 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
```shell
# 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**.```shell
eval `awsenv profile-name`
```For example, if you had the following credential files:
```shell
% 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:```shell
% 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 ExampleIn a **Vagrantfile** you could do:
```ruby
override.ssh.username = "ubuntu"
aws.keypair_name = ENV['AWS_KEYNAME']
override.ssh.private_key_path = ENV['AWS_KEYPATH']
```
# FlagsThe accepted flags can be displayed using `-h`:
```
% awsenv -h
Usage:
awsenv [OPTIONS] ProfileApplication Options:
-v, --verbose Verbose output
-f, --filename= Credentials file (~/.aws/credentials)Help Options:
-h, --help Show this help messageArguments:
Profile
```# Contributions
Contributions are welcome; here is an example workflow using [hub](https://github.com/github/hub).
1. `go get github.com/soniah/awsenv`
1. `cd $GOPATH/src/github.com/soniah/awsenv`
1. `hub fork`
1. `git co -b dev` (and write some code)
1. `git push -u dev`
1. `hub pull-request`