September 2017

Scheduled events using AWS Lambda & Cron Jobs

Almost any application needs to be able to run tasks on a schedule. This is usually achieved by setting up cron jobs on a server to run periodically. When we bring containers into the mix, we’ll notice quickly that running a cron daemon inside a container goes against one of the principles of (at least) Docker: “Only run one command in a container”. Sure, there are ways to get around this easily. You could concatenate commands and run them in […]

This post describes a problem that seems custom to ECS: Using a single task definition for multiple environments, and is part of my mini-series of posts: Common challenges in containerizing your application with Amazon ECS. Problem Description During our migration to Docker and ECS, one of our goals is to have multiple environments (QA, Staging, Production) use the same containers and, ideally, the same ECS task definitions. In order to achieve this goal, each cluster of Docker EC2 hosts needs […]

Provisioning scripts for EC2 instances in Auto-Scaling Group AWS CloudFormation allows us to define MetaData (AWS::CloudFormation::Init) that gets normally executed as part of an EC2 instance UserData. This is particularly helpful when launching EC2 instances as part of an auto-scaling group, as it allows us to run the same provisioning scripts on every instance in a more organized fashion. Problem: Updating a running EC2 instance in an Auto-Scaling Group When we modify the UserData that’s part of an AutoScaling LaunchConfiguration, […]