Skip to content

Commit

Permalink
feat: assume aws role, save crendentials to profile or expose to envi…
Browse files Browse the repository at this point in the history
…ronment variables (#5)

Co-authored-by: Wei Xu <wxu@seek.com.au>
  • Loading branch information
weixu365 and weixu365 authored Mar 13, 2023
1 parent 76c7228 commit 1dec9bc
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,31 @@ Technically, it's the same with executing `aws sts assume-role --role-arn <role-
and save credential to profile or export to env manually

## Install
### Download pre-built executables
- ### Download pre-built executables
```bash
wget https://github.com/weixu365/aws-assume-role/releases/download/v1.0.0/aws-assume-role_darwin_amd64 -O aws-assume-role
chmod +x aws-assume-role
# Then copy aws-assume-role to one of your PATH folder, e.g. /usr/local/bin
```

```bash
wget https://github.com/weixu365/aws-assume-role/releases/download/v1.0.0/aws-assume-role_darwin_amd64 -O aws-assume-role
chmod +x aws-assume-role
# Then copy the file to one of your PATH folder
```

### Install from source
```bash
cargo install --git https://github.com/weixu365/aws-assume-role.git
```
- ### Install from source
```bash
cargo install --git https://github.com/weixu365/aws-assume-role.git
```

## Assume AWS Role
### Create/Update profile
```bash
aws-assume-role --profile <profile-name> --session-name <session-name> --role-arn <role-arn>
```
- ### Create/Update profile
```bash
aws-assume-role --profile <profile-name> --session-name <session-name> --role-arn <role-arn>
```

Or add to alias
```
alias myrole='aws-assume-role --profile <profile-name> --session-name <session-name> --role-arn <role-arn>'
```
and just execute `myrole` at any time you need
Or add to alias
```bash
alias myrole='aws-assume-role --profile <profile-name> --session-name <session-name> --role-arn <role-arn>'
```
and just execute `myrole` at any time you need

### Export into current environment variable using `export`
```bash
eval $(aws-assume-role --session-name <session-name> --role-arn <role-arn>)
```
- ### Export into current environment variable using `export`
```bash
eval $(aws-assume-role --session-name <session-name> --role-arn <role-arn>)
```

0 comments on commit 1dec9bc

Please sign in to comment.