When interacting with AWS web console, many times I find that it's very slow or have some strange limitation/inconsistencies. And I always keep coming back to it because it's intuitive and the learning curve is almost non existing.
Source: http://www.commitstrip.com/en/2016/12/22/terminal-forever/
In a nutshell, this is an effort to replicate the same experience and ease of use of the AWS web console inside the comfort of the terminal.
First I started observing who I and other people interact with AWS console:
I think that this covers a large amount of how people interact with AWS console.
Now, using fzf, jq and bash/zsh functions, I tried to replicate that same workflow:
- You don't need to remember the function name to interact with the service. Just type
aws-
. - Select the resource with FZF.
- Visualize it's state.
- Request an action.
- Confirm the action if it is destructive.
Note: This is still very alpha state right now. This should be very safe to use because it require a confirmation before running any action but use it at your oun risk.
Download and source aws-fzf in your shell:
$ wget -O ~/.aws-fzf https://raw.githubusercontent.com/aminehmida/aws-fzf/master/aws_fzf
# If you are using zsh:
$ echo "source ~/.aws-fzf" >> ~/.zshrc
This is currently not working currently with BASH. PRs are very welcomed!
- Export the right AWS environment:
export AWS_DEFAULT_PROFILE=your-environment-name
. - Type
aws-
. - Select the service you want to interact with.
- Select the resource.
- Select an action. Any action that require modification will prompt for confirmation by typing the command in the shell and waiting for the user to press enter key.
Note: You can pre populate FZF search form command line like this: aws-ec2 mysql rest
This will search for instances with the word mysql
and the select actions that have the word rest
.
Will show you a list of supported services.
Interact with Route53 hosted zone records.
- input-1: Hosted zone
- input-2: Record name
- input-3: Action
- print: Output record name
- ssh: ssh to the host with that record name. Default user is ec2-user
- ping: Ping the host with that record
Interact with CloudWatch logs using saw
- input-1: Log group
- input-2: Action
- follow: Show now logs as they arrive.
- download: Download logs starting form a specific point in time to /tmp/aws-logs.txt and open them with
$EDITOR
- input-3: Start time.
- 10m: Now - 10 minutes
- 30m: Now - 30 minutes
- 1h: Now - 1 hour
- 6h: Now - 6 hour
- input-3: Start time.
Interact with EC2 instances.
- input-1: Instance ID, State and/or AZ
- input-2: Action
- start: Start instance
- stop: Stop instance
- Terminate: Terminate instance
Interact with S3 objects.
- input-1: Bucket name
- input-2 .. input-(n-1): levels inside the bucket's objects
- input-n: Action:
- View - Download file in /tmp/ and open it with your the editor set with
$EDITOR
env. var. - Download - Download file to current directory.
- Delete - Delete object from bucket.
- View - Download file in /tmp/ and open it with your the editor set with
Note: This command doesn't support prepopulation (Yet).
Decrypt and output a parameter from System Manager Parameters Store.
- input-1: parameter name