Skip to content

Commit

Permalink
Merge pull request #20 from 99designs/aws-session-config
Browse files Browse the repository at this point in the history
Use the aws cli config
  • Loading branch information
mtibben authored Sep 9, 2016
2 parents 1a4daf1 + eaadbfa commit 4f3a568
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,30 @@ IAMy is a tool for dumping and loading your AWS IAM configuration into YAML file

This allows you to use a "Infrastructure as Code" model to manage your IAM configuration, and allows you to operate configuration and change management on a higher level. For example, you might use a github repo with a pull request model for changes.


## How it works

IAMy has two subcommands.

`pull` will sync IAM users, groups and policies from AWS to YAML files

`push` will sync IAM users, groups and policies from YAML files to AWS

For the `push` command, IAMy will output an execution plan as a series of [`aws` cli](https://aws.amazon.com/cli/) commands which can be optionally executed. This turns out to be a very direct and understandable way to display the changes to be made, and means you can pick and choose exactly what commands get actioned.


## Getting set up

Because IAMy uses the aws cli tool, you'll want to install it

To install the aws cli on macOS with brew:
```
brew install awscli
```

For configuration, IAMy uses the same [AWS environment variables](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment) as the aws cli.


## Usage

```bash
Expand Down
16 changes: 14 additions & 2 deletions iamy/awssession.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
package iamy

import "github.com/aws/aws-sdk-go/aws/session"
import (
"log"

"github.com/aws/aws-sdk-go/aws/session"
)

var sess *session.Session

func awsSession() *session.Session {
if sess == nil {
sess = session.New()
var err error
sess, err = session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
})

if err != nil {
log.Fatal("awsSession: couldn't create an AWS session", err)
}
}

return sess
}

0 comments on commit 4f3a568

Please sign in to comment.