Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tilfin/homebrew-aws
AWS commands easy to manipulate on terminal
https://github.com/tilfin/homebrew-aws
assume-role aws aws-cli ec2 shell-script ssh
Last synced: 13 days ago
JSON representation
AWS commands easy to manipulate on terminal
- Host: GitHub
- URL: https://github.com/tilfin/homebrew-aws
- Owner: tilfin
- Created: 2017-02-17T07:22:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-03T02:13:42.000Z (6 months ago)
- Last Synced: 2024-10-24T01:37:11.914Z (22 days ago)
- Topics: assume-role, aws, aws-cli, ec2, shell-script, ssh
- Language: Shell
- Homepage:
- Size: 10.7 KB
- Stars: 15
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
AWS commands easy to manipulate on terminal
===========================================## Prepare for homebrew
```
$ brew tap tilfin/aws
```## ec2ssh
A script to ssh EC2 instances to be selected from the list shown for specified profile
### Install via homebrew
```
$ brew install ec2ssh
```### How to use
```
$ ec2ssh
```* If switching profile needs your MFA token, `Enter MFA code> ` is shown.
* SSH user is fixed to _ec2-user_.### Pre and Post hook
* If your need pre hook, put `~/.ec2ssh-pre` file.
* If your need post hook, put `~/.ec2ssh-post` file.#### Purposes
* If target EC2 needs the connection via a bastion server, `bastion` in *pre* hook
* If target EC2 needs the routing (via VPN), add a route in *pre* hook and delete the route in *post* hook.#### Examples
##### .ec2ssh-pre
```
case $profile in
brand-x)
bastion=brand-x-bastion
;;
brand-y)
sudo route add 50.200.200.100 192.168.50.1
;;
esac
```##### .ec2ssh-post
```
case $profile in
brand-y)
sudo route del 50.200.200.100
;;
esac
```### Screenshot
![ec2ssh_screenshot](https://cloud.githubusercontent.com/assets/519017/23257373/d62b8df0-fa06-11e6-8832-593b87ee3e46.png)
## swrole
A script to switch an assume role for terminal shell
### Install via homebrew
```
$ brew install swrole
```### How to use
```
$ swrole [-j] [-o] [-t ]
```- `-j`: Output JSON for AWS credential_process.
- `-o`: Output AWS credentials values as environment variable definitions.
- `-t `: Specify a onetime code, e.g., `-t 123456`.* Enter forked bash that exports AWS_XXX environments if neither `-o` nor `-j` option is specified.
* Be careful that the session will expire in an hour.### Configuration Fields
Add the following fields to `~/.aws/config`:
- `color`: Specify a color for the profile name in the forked bash.
- `generate_token`: Automatically obtain OTP by executing the specified command for profiles with `mfa_serial` defined.### Screenshot
![swrole_screenshot](https://cloud.githubusercontent.com/assets/519017/23257376/dc26893a-fa06-11e6-86af-6fa88ce49299.png)