from Hacker News

Show HN: Bash-My-AWS – CLI Commands for AWS

by mike-bailey on 12/31/19, 2:48 PM with 63 comments

  • by mike-bailey on 12/31/19, 3:15 PM

    It's probably my fault if you haven't heard of Bash-My-AWS.

    Bash-My-AWS is a simple but extremely powerful set of CLI commands for managing resources on Amazon Web Services. They harness the power of Amazon's AWSCLI, while abstracting away the verbosity. The project implements some innovative patterns but (arguably) remains simple, beautiful, readable and easily extensible.

    The project started in 2014 and while many hundreds of hours have gone into it, far less has gone into promotion.

    I'm speaking about it at LinuxConf and have created a documentation site at https://bash-my-aws.org

    https://linux.conf.au/schedule/presentation/144/

  • by nahikoa on 1/1/20, 6:04 PM

    This looks like an awesome project!

    Meta note: All things considered, Amazon has it pretty good. They put out a barely usable, bare-bones, but fully functional tool in awscli. Paying customers of AWS have to perform the engineering effort to make the API more usable, and some even open-source their projects like this. AWS is an incredible business model.

  • by m0zg on 1/1/20, 10:53 PM

    Coming from Google Cloud, I couldn't deal with the atrocity that is awscli, so I ended up eventually implementing the bare minimum of shell wrappers to at least start, stop, ssh into, rsync files to and from, etc, my aws instances _by name_, not by instance ID. Took me a couple of hours to cobble it together.

    Google cloud CLI offers all of this out of the box. Why Amazon wants to make such basic commands difficult, I'll never understand.

  • by wjoe on 1/2/20, 11:44 AM

    This looks pretty great, while the AWS CLI is very comprehensive, I always struggle to remember which flags are needed for each command, and it's not very consistent.

    One thing I've not been able to work out with bash-my-aws yet was how to easily switch between regions and accounts. I noticed you can use `region` on it's own to set the current default region, but I'm often working with multiple regions, and it'd be a pain to have to run `region us-west-1` separately each time I want to use a different region. I couldn't see a way to just specify a region for a given command (eg how you'd do `aws get-instances --region us-west-1`). I guess you could do this with the environment variable `AWS_DEFAULT_REGION=us-west-1 instances` but that's a bit verbose.

    Similarly with AWS accounts, I use multiple AWS accounts, which are accessed with different access keys, which are defined as profiles in my ~/.aws/config. Normally I'd use these with the AWS CLI like `aws ec2 get-instances --profile production`, I couldn't see any way in the docs to use or set this?

  • by Terretta on 1/1/20, 4:32 PM

    Interesting this requires ‘jq’ when JMESpath is built into AWS CLI already.

    http://jmespath.org/

  • by TheSpiciestDev on 1/1/20, 5:45 PM

    Just the other day I was looking for an official docker image that includes the AWS CLI. On top of that, and mainly, I was looking to find more documentation or tooling to better automate the deployment of new AWS projects.

    Does anyone here have any experience of (starting from scratch or with no AWS resources) setting up policies/users/resources/configurations via something similar to the Deployment Managers of GCP and Azure?.. preferably something declarative or via templates?

    Bash-my-AWS looks like a great step towards the goal I have in mind but I may also just be unaware of other tooling or AWS capabilities.

  • by efitz on 1/2/20, 6:18 AM

    Interacting with individual DNS records in Route 53 is very hard using AWSCLI. I wrote a Python wrapper around the Route 53 API to make it easier to do command line records management (and also to do dynamic DNS with your own Route 53 hosted domain):

    https://github.com/ericfitz/r53

  • by alpb on 1/1/20, 7:33 PM

    Is this primarily required because AWS CLI is not good enough at listing resources in desired format (json, jsonpath, yaml, table..)?
  • by dopylitty on 1/1/20, 5:00 PM

    If you want to easily manipulate your AWS environment from the command line use the AWS cmdlets for PowerShell. The fact that PowerShell cmdlets work on objects instead of text makes them miles better than this or the AWS CLI because you don't spend most of your time figuring out how to wrangle text into meaningful output.
  • by ak217 on 1/1/20, 7:23 PM

    I have developed something similar on top of the AWS CLI that incorporates a bunch of integrations with other tools like the cloudinit and various bits of Batch-related instrumentation: https://github.com/kislyuk/aegea
  • by iCarrot on 1/2/20, 7:43 AM

    The first thing I'd do after installing this is to alias prefixing "aws-" to every commands. I like namespacing things as I suck at remembering names...
  • by pensatoio on 1/1/20, 3:56 AM

    What really sells me on this tool is the ability to examine the underlying awscli command and transformations. I’ll be giving this a go in the new year!