Skip to content
CMO & CTO
CMO & CTO

Closing the Bridge Between Marketing and Technology, By Luis Fernandez

  • Digital Experience
    • Experience Strategy
    • Experience-Driven Commerce
    • Multi-Channel Experience
    • Personalization & Targeting
    • SEO & Performance
    • User Journey & Behavior
  • Marketing Technologies
    • Analytics & Measurement
    • Content Management Systems
    • Customer Data Platforms
    • Digital Asset Management
    • Marketing Automation
    • MarTech Stack & Strategy
    • Technology Buying & ROI
  • Software Engineering
    • Software Engineering
    • Software Architecture
    • General Software
    • Development Practices
    • Productivity & Workflow
    • Code
    • Engineering Management
    • Business of Software
    • Code
    • Digital Transformation
    • Systems Thinking
    • Technical Implementation
  • About
CMO & CTO

Closing the Bridge Between Marketing and Technology, By Luis Fernandez

EC2 in Practice: Instances as Cattle

Posted on February 28, 2018 By Luis Fernandez
\n

Context

\n\n\n\n

A lot of teams are moving fast on AWS EC2, but many still treat servers like long lived pets. You name them, you log in to fix them, you guard them like a favorite old laptop. Then a kernel patch like the recent Spectre and Meltdown mess hits, the hosts reboot, and your night is gone. There is a quieter and way more boring path that scales better. Treat instances as cattle, let Autoscaling Groups do the heavy lifting, and ship with immutable habits. It is not glamorous, but it keeps pages calmer and bills lower.

\n\n\n\n

Definitions

\n\n\n\n

Instances as cattle: Your EC2 machines are disposable. If one misbehaves, you kill it and a new one replaces it. No names. No hand edits. No guilt.

\n\n\n\n

Pets: A snowflake server you pamper. You SSH in to make tweaks. It drifts away from its siblings and surprises you at the worst time.

\n\n\n\n

Immutable server: You do not change a running box. You ship a new AMI or a predictable boot sequence and roll forward. Old ones die on schedule.

\n\n\n\n

Autoscaling Group: AWS watches a count and health checks. If an instance fails, it launches a new one from your Launch Template or Launch Configuration and joins it behind an ELB or ALB.

\n\n\n\n

Baked AMI: A golden image with the app and dependencies ready to run. Combine with short boot scripts for config and secrets from SSM Parameter Store or Secrets Manager.

\n\n\n\n

Examples

\n\n\n\n

Web tier for a Rails or Node app. Build an AMI using Packer on every successful build. Store config in SSM. Launch with an Autoscaling Group across three AZs and register with an ALB target group. Health checks decide who serves traffic. You deploy with rolling or blue green swaps by flipping target groups. You never SSH. If a box gets weird, you terminate it with a smile.

\n\n\n\n

Batch workers for a queue. The queue is the source of truth. Workers come and go. Use Spot for savings and let the group replace preempted boxes. Store progress in DynamoDB or S3, not on the instance. A replacement can pick up work at any time without losing state.

\n\n\n\n

API with per region traffic. Same recipe. One AMI, two groups, two target groups. Use Route 53 health checks and weighted records. Kill a whole group during game day and watch the other pick up the slack. That is confidence you only get when boxes are cattle.

\n\n\n\n

Counterexamples

\n\n\n\n

Databases. You can run RDS and dodge a lot of pain. If you roll your own on EC2 with EBS volumes, you still want planned pets. They are not throwaway while they hold live data. You can automate rebuilds and failovers, but you will not toss a primary during lunch.

\n\n\n\n

Stateful file servers. If the box has unique data on local disks, you will treat it with care or move that data to EFS or S3 so the compute side can be cattle.

\n\n\n\n

Long running GPU jobs or Windows boxes with manual drivers. If a task lasts days and cannot checkpoint, you might pause before the cattle move. Better to add checkpoints or use managed services where possible.

\n\n\n\n

Decision rubric

\n\n\n\n

Use these quick checks before you pick pets or cattle for EC2:

\n\n\n\n
    \n
  • Can you kill any single instance right now without losing data or user sessions If yes, go cattle.
  • \n
  • Where does state live If it is on S3, RDS, DynamoDB, ElastiCache, or a shared store, go cattle. If it is only on the instance, rethink the design first.
  • \n
  • Can a new instance be ready in under ten minutes If yes, roll forward. If not, invest in a baked AMI or faster boot scripts.
  • \n
  • Do you need SSH to fix things If the honest answer is yes, you are on the pet path. Move fixes into code, AMIs, or user data. Use SSM Session Manager for rare emergencies.
  • \n
  • How do you deploy If it is a manual rsync on a running box, that is a pet smell. Aim for rolling or blue green with two Autoscaling Groups.
  • \n
  • Do you tag and monitor If every instance has tags for service, env, owner and you have alarms on health and replacement rate, cattle works well.
  • \n
  • Cost and volatility tolerance If you want Spot, you need cattle. If on demand only, you still benefit from cattle, just with steadier capacity.
  • \n
\n\n\n\n

Lesson learned

\n\n\n\n

Treating EC2 instances as cattle is not a fad phrase. It is a set of boring habits that pay rent every day. Build or bake, not patch in place. Use Autoscaling Groups and health checks. Keep state out of the box. Prefer no SSH. Practice blue green and rolling releases. Tag everything. Alert on replacement flaps. Recreate often on purpose so you trust the process when AWS asks you to reboot for kernel fixes again.

\n\n\n\n

One more small but sharp trick. If your team is new to this, create a weekly chaos hour. Terminate one instance in each group while you watch graphs. If that ruins the day, great, you found work to do. If nothing happens, that is the sound of cattle doing their job.

\n\n\n\n

From the outside this looks simple. It is. And that is the point. The less special your servers are, the more time you spend on the product that wins users. EC2 in practice rewards folks who keep it simple and disposable.

\n
General Software Software Engineering

Post navigation

Previous post
Next post
  • Digital Experience (94)
    • Experience Strategy (19)
    • Experience-Driven Commerce (5)
    • Multi-Channel Experience (9)
    • Personalization & Targeting (21)
    • SEO & Performance (10)
  • Marketing Technologies (92)
    • Analytics & Measurement (14)
    • Content Management Systems (45)
    • Customer Data Platforms (4)
    • Digital Asset Management (8)
    • Marketing Automation (6)
    • MarTech Stack & Strategy (10)
    • Technology Buying & ROI (3)
  • Software Engineering (310)
    • Business of Software (20)
    • Code (30)
    • Development Practices (52)
    • Digital Transformation (21)
    • Engineering Management (25)
    • General Software (82)
    • Productivity & Workflow (30)
    • Software Architecture (85)
    • Technical Implementation (23)
  • 2025 (12)
  • 2024 (8)
  • 2023 (18)
  • 2022 (13)
  • 2021 (3)
  • 2020 (8)
  • 2019 (8)
  • 2018 (23)
  • 2017 (17)
  • 2016 (40)
  • 2015 (37)
  • 2014 (25)
  • 2013 (28)
  • 2012 (24)
  • 2011 (30)
  • 2010 (42)
  • 2009 (25)
  • 2008 (13)
  • 2007 (33)
  • 2006 (26)

Ab Testing Adobe Adobe Analytics Adobe Target AEM agile-methodologies Analytics architecture-patterns CDP CMS coding-practices content-marketing Content Supply Chain Conversion Optimization Core Web Vitals customer-education Customer Data Platform Customer Experience Customer Journey DAM Data Layer Data Unification documentation DXP Individualization java Martech metrics mobile-development Mobile First Multichannel Omnichannel Personalization product-strategy project-management Responsive Design Search Engine Optimization Segmentation seo spring Targeting Tracking user-experience User Journey web-development

©2025 CMO & CTO | WordPress Theme by SuperbThemes