If you’re using AWS CloudFormation you might have come across clouds-aws. If not you might want to have a look at it on GitHub.

It makes managing CloudFormation stacks from the shell fairly easy. It keeps a local representation of the stack as a Template (JSON or YAML) and a YAML-file holding the parameter values for the stack.

Until now an update to an existing stack had to be performed in the dark, meaning that there was no possibility to dry-run or predict a stack update before going for it without a safety net other than the built-in rollback capability.

The new feature introduced in 0.3.8 brings now change sets to the game allowing to stage a stack update and inspect the changes in detail before actually executing the change.

To get clouds simply run pip install clouds-aws. You can then dump an existing stack with clouds dump <stack name>, then edit the stack and create a new change set with clouds change create <stack name> <change name> which will print out an overview of the changes.

If you need more detail you can inspect the full detail AWS API returns for the change you can describe the change in either YAML or JSON format: clouds change describe --yaml <stack name> <change name>.

When everything is to your liking you execute the change with clouds change execute --events <stack name> <change name>. The –events in this example will poll for stack events until the stack reaches a stable state.

If you ever need to combine all first pages of a bunch of PDF files into a single file you can use this script. Comes in handy to prepare train tickets for turning them in for tax returns. They come with two pages one of which is only the TOS which I don’t want to print to save the environment and resources.

I just had the need to check a record on all NS servers of a zone to see whether they had been updated with the new zone config and returned the correct IP addresses for the name.

In the CLI this is quite a considerable amount of typing. That’s why I created a small script for it:

 

If you like to work with AWS on the CLI you can easily open the AWS by using a specially crafted link that logs you in using the credentials from your shell environment. To assemble the link you can use this little Python script:

Due to popular demand (read: colleagues asking) I put this little script online which I originally found when googling the web for a way to reduce the count of commits that contain syntax errors in my Puppet recipes.

It will not find all errors (e.g. cyclic or broken requires) but it reduces the risk of overlooking copy&paste errors or typos a lot.

Update: I found the original source on GitHub

Have you ever tried working with a huge monolith of SVN repo that has lived for ages and seen a bazillion commits in its time? Then you might have experienced unpleasant times waiting for some process to chew through all that nasty pile of code.

Here is how I handle these behemoths – just checkout the subpath I need leaving all the history behind:

This code snippet will fetch the latest revision the subpath was edited and do a sparse shallow checkout using git as client.

The following snippet for your ~/.zshrc will look for .aws_profile in the a directory after entering it. In case the file exists it will use the asp function to set your profile according to the content of the file.

This feature is meant to be used in conjunction with the clouds tool for easy CloudFormation stack management from the shell that can be found here: https://github.com/cristim/clouds

You can add as much code as you like to be executed on changing the current directory (e.g. activate a Python virtualenv) but be sure not to overload it or changing directories can become a pain.

In order to use one of multiple profiles in your awscli config you need to set AWS_DEFAULT_PROFILE in your environment. This can easily be done with the following snippet in your ~/.zshrc . Profile names will be autocompleted. E.g.: asp development will activate the development profile from the config section above.

All your profiles live inside ~/.aws/config: