Skip to content

Instantly share code, notes, and snippets.

Use AWS CLI and jq to do some things

I'm just getting up to speed on AWS, and so I'm learning my way around the CLI. It's nice and easy to do lots of things from the CLI, like querying, creating and destroying instances and images. There are lots of fiddly bits involved in parsing output so it can be used by a script or something, though, so here are some notes.

Tools

AWS CLI

Obviously you need the AWS CLI. It's an easy install using pip. Go here to find documentation and other install methods.

Create an AMI using Packer

What is Packer?

Packer is a tool from Hashicorp that allows you to create machine images in a variety of formats from a single spec file. This can be a very powerful thing when you want to automate the deployment of applications to a variety (or even just more than one, really) platforms.

In our case, we want to deploy an application to VMware and AWS, and soon to Docker. Doing that with a single spec file gives us

  • platforms that are consistent, even if they're different

ownCloud on Raspberry Pi running Pidora

The what you say?

I won a Raspberry Pi at the IBM booth at DevOps Enterprise Summit 2014!

Raspberry Pi is awesome and delicious. What's not to love about a $35 computer the size of a deck of cards?

I've been using a Pi for some time now connected to an external drive that acts as my backup server. I use duplicity to SSH files to the Pi storage. Simple, easy and effective. It's been working great for years, but lately I've been wanting something more modern, something that I can use to both store files and retrieve them easily, from computers and phones. You know, like Dropbox.

@brasey
brasey / Webcam stops working on Fedora 20.md
Last active August 29, 2015 14:09
Webcam stops working on Fedora 20

Webcam stops working on Fedora 20

Tech stack

  • Dell XPS 12
  • Fedora 20
  • Google Chrome 38.0.2125.111 (64-bit) or
  • Cheese or
@brasey
brasey / Generate a Linux password hash suitable for shadow file.md
Last active July 3, 2020 00:56
Generate a Linux password hash suitable for shadow file

Generate a Linux password hash suitable for shadow file

Need

Someone gives me a password to configure for a local Linux user account. We're managing local user accounts with Puppet, which needs a hash just like the one that's in /etc/shadow. Setting the password through manual means is not an option.

Solution

This Python foo:

@brasey
brasey / Masterless Puppet using a Puppetfile.md
Created November 18, 2014 20:58
Masterless Puppet using a Puppetfile

Masterless Puppet using a Puppetfile

The problem

When running Puppet in masterless mode, meaning there is no Puppet Master for the node to connect to, one of the problems you have to solve is how to get all your Puppet modules onto the node. Without going into all the possible ways of doing this, one nice and clean way to solve the problem is to use a Puppetfile.

If you know what a Ruby gemfile is, you can guess what a Puppetfile is. If you don't, think of a very simple list declaring the modules that a node should get, including ways to get those modules. Like this:

forge 'forge.puppetlabs.com'
@brasey
brasey / Too many authentication failures for username.md
Last active August 29, 2015 14:09
Too many authentication failures for username

Too many authentication failures for username

The problem

I was getting this error when trying to SSH to a brand new CentOS 7 VM I was setting up. I hadn't even done anything yet, so I was confused until I realized I had hit the 'MaxAuthTries' limit configred in /etc/ssh/sshd_config on the VM by issuing a single command.

I have a few (ok, 9) SSH keys in my ~/.ssh directory. When you issue an SSH connection request without specifying which key to use via the -i option, SSH tries to use each key.

The default MaxAuthTries value on a CentOS 7 box is 6.

@brasey
brasey / Create kickstart ISO image for RHEL.md
Created January 6, 2015 18:28
Create kickstart ISO image for RHEL

Create kickstart ISO image for RHEL

Notes

I'm mounting the downloaded disk image in a directory called 'cd'.

I'm creating the new disk image in a directory called 'cd.new'.

Steps

@brasey
brasey / Where to put files on a Linux system.md
Created January 15, 2015 21:38
Where to put files on a Linux system

Where to put files on a Linux system

How did I only just find this?

man hier
@brasey
brasey / Install VMware Workstation on Linux 3.19 kernel.md
Created March 30, 2015 12:50
Install VMware Workstation on Linux 3.19 kernel

Install VMware Workstation on Linux 3.19 kernel

VMware Workstation fails to install on 3.19 kernel. Luckily, VMware is on the ball. Just need to patch and compile to make it work.

Arch Wiki

Copypasta:

Since 3.19 kernel the vmnet module will fail to build.