Cf Shell: Streamlining CloudFormation Development with a Familiar Approach

  • 5 minute read

As Amazon Web Services has grown into the vast platform that it is today, it has created many opportunities for innovation: in how we interact with the products and how we fit all the pieces together. AWS's API-based nature has allowed an ecosystem of products to arise, all piggybacking on each other, ultimately enabling developers to explore unique ways to use their products.

To take advantage of these qualities, I set out to create Cf Shell, a Node.js application built specifically for CloudFormation developers. It explores a different use case for the familiar techniques used in Bash. View the source and learn how to start using it on Github

Cf Shell address two major functionalities: architecture collaboration and super smooth interaction with resources.

Architecture Collaboration

Projects such as CloudFormation, Terraform, and Heat have been created to merge the AWS products, allowing developers to write a single configuration file describing sizable systems. These projects allow developers to simply “run” text files in the cloud like you would run a bash script on your computer. Most importantly, they allow collaboration of architectures. One can download a single Solr Cloud CloudFormation and run it on AWS in minutes. Cf Shell attempts to expose some familiarity between creating a CloudFormation stack and create a Unix directory, exposing how powerful these features really are.

cfshell01b.png

Cf Shell allows you to create and delete stacks with the ‘mk’ and ‘rm’ command just as easily as you would create and delete a directory.

 

Interacting with Resources

As product integration becomes more seamless and the number of resources increases, our need to track and monitor them increases equally. It was obvious to me, while using CloudFormation, that there was a need for better interaction with the resources in my stacks. I often found myself scavenging through the EC2 console for ip addresses or values of various volume tags. Simply sshing into an instance in an auto scaling group could take 10 clicks and 3 page loads in the AWS console before I was able to find the ASG, then the instance, then the ip address, and then make my way back to the terminal to run the command.

 

Cf Shell attempts to solve this problem by enabling the ability to explore and analyze CloudFormed AWS resources in the most natural way possible, without being affected by the shape of the infrastructure beneath it. By mimicking the behavior of the Bash shell, and organizing the resources in a tree structure, it creates a seamless integration between traversing cloud components and ordinary terminal use.

cfshell00b.png

This picture shows the ‘cd’ command used to change your path to an Auto Scaling Group and list the instances in it with ‘ls’. To go even further you can ‘cd’ to an instance and use various command on the instance level. This one, ‘stats’, displays the output of ‘top’.

 

Some more Cf Shell built-in commands:

  • mk, rm - Perform quick stack operations.
  • cat /var/log/auth.log - Cat a file on an instance.
  • ls - List and view the health states of various AWS resources.
  • stats - Inspect the CPU and memory usage of an instance.
  • vols - List all the volumes that are attached to the instances in an ASG.
  • ssh - Start ssh sessions to an instance.
  • sshrand - Start an ssh session to any random instance in an ASG.
  • sshall - Or just ssh into all the instances in the ASG.

And many more!

Cf Shell has replaced the EC2 and CloudFormation console in my workflow. With its simple plugin architecture, it has the ability to expand quickly to replace even more. I invite anyone as neck-deep in CloudFormation as me to try Cf Shell. If you like the concept, tell me what you like about it or what features it could use.

Help me mold this project into a practical tool many teams can benefit from.