Richard Clayton

How to Use the Instance Role Credentials Manually on an EC2 Instance

A couple of days ago I found myself needing to use the AWS CLI to perform some actions using the IAM Role of the local EC2 instance (and not my own -- partly because I didn't want to use/leave my credentials on the machine).

Crawling through the AWS documentation, I pieced together the steps one should follow to perform this . . .

Read More

July 04, 2018

Container Services: Logging and Reporting

Logging and Exception Reporting are two obvious operational features every service must include. As we learned in the last post, Application Support in Docker-based Microservice Environments, building and deploying microservices makes implementing log infrastructure significantly more difficult.

The most difficult problem DevOps . . .

Read More

March 21, 2018

Use State Machines!

FSMs are not as complex as you think and they make your code better.

What is a State Machine?

Finite State Machines (FSM, or in the context of this post, simply "State Machines") are a methodology for modeling the behavior of an entity with an established lifecycle. The lifecycle is defined by an enumerated set of states known at the time of implementation (this is where the term . . .

Read More

March 17, 2018

Scheduling Execution in Node.js

Differences between setTimeout, setImmediate, and process.nextTick.

A commonly misunderstood concept in Node.js is the difference between setTimeout, setImmediate, and process.nextTick. While all three functions are used to schedule the execution of a function, it is important to understand when Node.js will execute them.

Consider the following example:

setImmediate(() => console.log('Set . . .

Read More

Posted in: nodejs

March 14, 2018

Application Support in Docker-based Microservice Environments

How to provide essential services with minimal application involvement.


Operationalizing microservices is difficult and that difficulty has been exacerbated by how much the landscape has changed over the last 5 years. Personally, I've worked on a few microservice architectures and experienced the evolution of thoughts, patterns, and technologies that have brought us to where we are . . .

Read More

March 10, 2018

Reduce Test Boilerplate with Generic Test Functions

I wanted to quickly mention a trick I use to reduce the boilerplate code you'll often encounter when executing similar test cases. Instead of defining each test separately:

const { describe, it } = require('mocha');
const { expect } = require('chai');

const app = require('../../index.js');
 . . .

Read More

Posted in: nodejs

March 07, 2018

The case against the generic use of PATCH and PUT in REST APIs

There is a lot of confusion among developers on how to implement updates using a REST API. The tools we are given (PATCH and PUT) don't actually map cleanly to how we would implement an update in our business code. Let's start by considering what those HTTP verbs mean:

PATCH: perform a partial update to a resource, . . .

Read More

March 07, 2018