Bash functions for managing AWS resources simply and easily
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


bash-my-aws assists Infrastructure Jockeys using Amazon Web Services from the command line.

This project provides short, memorable commands for realtime control of resources in Amazon AWS. The goal is to reduce the time between intention and effect.

These functions make extensive use of the incredibly powerful AWSCLI.



As shown below, you may simply clone the GitHub repo and source the files required. (You should probably fork it instead to keep your customisations)

$ git clone ~/.bash-my-aws


Source the functions with something like:

$ for f in ~/.bash-my-aws/lib/*-functions; do source $f; done

Add the bash_completion scripts: (optional)

$ source ~/.bash-my-aws/

Typing stack[TAB][TAB] will list available functions for CloudFormation:

$ stack
stack             stack-elbs        stack-parameters  stack-template
stack-asgs        stack-events      stack-resources   stack-update
stack-create      stack-failure     stack-status      stack-validate
stack-delete      stack-instances   stack-tags        stacks
stack-diff        stack-outputs     stack-tail

$ instance
instance-asg          instance-ip           instance-start        instance-terminate    instances
instance-console      instance-ssh          instance-state        instance-type
instance-dns          instance-ssh-details  instance-stop         instance-userdata
instance-iam-profile  instance-stack        instance-tags         instance-volumes

$ asg
asg-capacity             asg-max-size-set         asg-resume               asgs
asg-desired-size-set     asg-min-size-set         asg-suspend
asg-instances            asg-processes_suspended  asgard

For more info on the query syntax used by AWSCLI, check out

Piping output between functions

We're very excited to announce this functionality.

Most bash-my-aws functions will accept AWS Resource Ids from STDIN. This means you can pipe output from many functions into other functions.

$ instances | grep splunk | instance-stack | stack-status
splunk-forwarder  UPDATE_COMPLETE
splunk-forwarder-role CREATE_COMPLETE

Usage examples


Create a stack

This function gives you tab completion for filenames (missing from AWSCLI).

$ stack-create
USAGE: stack-create stack

$ stack-create example      # creates stack called example using example.json

It's also one of the functions that allows you to omit the template name if it exists in the current directory and matches the stack name with '.json' appended.

It's even smart enough to detect that you've added '-blah' to the stack name.

$ stack-create example-test # creates stack called example-test using example.json

List stacks

This is basically 'ls' with the ability to filter by a search string

$ stacks # call without filter argument to return all stacks

$ stacks example # Or filter out the relevant stacks

See what changes will be made by updating a stack

$ stack-diff
USAGE: stack-diff stack [template-file]

$ stack-diff example-dev
template for stack (example) and contents of file (example-dev.json) are the same

e--- params
+++ example-params-dev.json
@@ -4,7 +4,7 @@
         "ParameterKey": "slipGeneratorRolePath"
-        "ParameterValue": "something",
+        "ParameterValue": "something-else",
         "ParameterKey": "storageBucketName"

Updating a stack

$ stack-update
USAGE: stack-update stack [template-file] [params-file]

$ stack-update example # creates stack called example using example.json

Deleting a stack

$ stack-delete
USAGE: stack-delete stack

$ stack-delete example # deletes stack called example

Tailing stack events

The create/update tasks call this one but it can also be called directly. It watches events for a stack until it sees them complete or fail.

$ stack-tail my-stack
|                                                                  DescribeStackEvents                                                                  |
|  2015-07-25T23:13:21.628Z|  MyStack                      |  AWS::CloudFormation::Stack               |  CREATE_IN_PROGRESS                            |
|  2015-07-25T23:13:27.221Z|  AppServerSSHSecurityGroup    |  AWS::EC2::SecurityGroup                  |  CREATE_IN_PROGRESS                            |
|  2015-07-25T23:13:27.235Z|  DeploymentSQSQueue           |  AWS::SQS::Queue                          |  CREATE_IN_PROGRESS                            |
|  2015-07-25T23:13:27.291Z|  InternalELBSecurityGroup     |  AWS::EC2::SecurityGroup                  |  CREATE_IN_PROGRESS                            |
|  2015-07-25T23:13:27.537Z|  AppServerRole                |  AWS::IAM::Role                           |  CREATE_IN_PROGRESS                            |
|  2015-07-25T23:13:28.244Z|  DeploymentSQSQueue           |  AWS::SQS::Queue                          |  CREATE_IN_PROGRESS                            |
|  2015-07-25T23:13:28.769Z|  DeploymentSQSQueue           |  AWS::SQS::Queue                          |  CREATE_COMPLETE                               |