Monday, April 3, 2017

Rebuild AMI using SSM Automation

In the previous post I used Packer to remove block device mappings from Ubuntu AMI to ensure EC2 auto-recovery is working. While Packer is a fantastic tool with many features, it is synchronous in its nature and requires active SSH connection to the temporary instance in order to bake new AMI.

Can we get similar results with AWS tools alone? Indeed, we can!

In December of 2016, at the re:Invent, AWS announced a slew of interesting new features for their Amazon EC2 Systems Manager (a.k.a. SSM). The initial documentation and tutorials were sparse, so their capabilities weren't immediately clear. One of these new features, Automation, offers functionality similar to Packer, so I decided to learn more about it by applying to my simple use case.

Monday, March 20, 2017

Ensure EC2 auto-recovery by rebuilding AMI with Packer

Problem: Amazon EC2 auto recovery fails if machine image has ephemeral block device mappings defined (even when no instance store volumes are attached).

  1. Specify custom block device mapping during instance launch.
  2. Rebuild Ubuntu AMI (with automation).
This post shows how to achieve the later using Packer by HashiCorp.

Thursday, February 19, 2015

Enable "Developer options" on Android

Since release of Android 4.2 the "Developer options" menu is not visible in the Settings by default. Regular users won't miss it, but for those of us who like to tinker with ADB and need the "USB debugging" option enabled, here's how to get it back:
  1. Go to the "Settings" menu.
  2. Scroll to the bottom and tap "About phone" menu.
  3. Scroll to the bottom and tap on "Build number" seven (7) times.
After this your "Developer options" should be back in the "Settings" menu and you be able to start voiding your warrantee like a hacker. "You are now a developer!"

Saturday, November 29, 2014

Homebrew cheat sheet and workflow

If you are a Mac owner and a serious *NIX user, you're probably aware of Homebrew.

I have a few of my favorite tools installed with brew and I like to keep my "Cellar" clean and up-to-date. Here's my commonly used commands and my typical workflow.

Never forget about man's best friend - "man". Use man to get the list of commands and options that can be used with brew:

man brew

To list software you currently have installed with version numbers, use:

brew list --versions

To see just the software, which is not a dependency of another:

brew leaves

To keep the Homebrew itself up-to-date, and fetch the newest version from GitHub:

brew update

After updating the brew, check which formulae have an updated version available, display detailed version information to see if you have more than one older version laying around:

brew outdated --verbose

See any app that you no longer need and want to get rid of them? Check the dependencies for all installed formulae:

brew deps --installed

For even more detailed picture, show the dependencies for all installed formulae as a tree:

brew deps --installed --tree

As a final precaution before removing a formula, see what other installed formulae use it as a dependency:

brew uses --installed formula

Uninstall formulae and all their older versions:

brew remove --force formulae

Upgrade remaining formulae:

brew upgrade

Show what will be removed by cleanup command, but do not actually remove anything:

brew cleanup -ns

Clean the "Cellar" removing any older versions of installed formulae and clearing old downloads from the Homebrew download-cache. Additionally, scrub the cache, removing downloads for even the latest versions of formula, which are downloaded, but not installed:

brew cleanup -s

Thursday, March 13, 2014

Add time stamp to a file name from CLI

I often find myself in need to append a time stamp to a file name, but always forget the right command line parameters. Here's a quick reminder to myself on how to do just that.

mv filename filename-$(date '+%FT%T')

For those who want to know the details, here's the break down.