---
title: "Our Journey Migrating to AWS IMDSv2"
description: "Slack enforced IMDSv2 across roughly 60,000 EC2 instances in hundreds of AWS accounts."
url: "https://swe.quest/articles/our-journey-migrating-to-aws-imdsv2-7a3bae8a33284213"
canonical: "https://slack.engineering/our-journey-migrating-to-aws-imdsv2/"
source: "Slack Engineering"
published: "2023-12-12"
difficulty: "medium"
kind: "Case study"
reading_minutes: 10
tags: ["cloud","security","appsec","infrastructure-as-code","identity-auth"]
---

# Our Journey Migrating to AWS IMDSv2

A post on [Slack Engineering](https://swe.quest/sources/slack.md), published 2023-12-12, 10 min read, Case study. Original: [https://slack.engineering/our-journey-migrating-to-aws-imdsv2/](https://slack.engineering/our-journey-migrating-to-aws-imdsv2/)

## Summary

Slack enforced IMDSv2 across roughly 60,000 EC2 instances in hundreds of AWS accounts. IMDSv2's session tokens, obtained by PUT and sent as a header, blunt SSRF-based credential theft. The team found IMDSv1 callers with the MetadataNoToken CloudWatch metric, a Prometheus dashboard and ImdsPacketAnalyzer, then made shared Terraform modules require tokens via an exclusion-list module and denied IMDSv1 launches with SCPs. Because SCPs don't cover the root account or service-linked roles such as AutoScaling, they added EventBridge/CloudTrail alerts routed to Slack and an EKS-hosted "IMDSv1 Terminator" that continuously forces IMDSv2 on any instance still allowing v1.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [Security](https://swe.quest/tags/security.md) (Security)
- [Application security](https://swe.quest/tags/appsec.md) (Security)
- [Infrastructure as code](https://swe.quest/tags/infrastructure-as-code.md) (Infrastructure)
- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)

## Prerequisites

- AWS EC2 and IAM ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))
- Terraform basics ([easy posts on Infrastructure as code](https://swe.quest/tags/infrastructure-as-code.md?difficulty=easy))
- AWS Organizations and SCPs ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

IMDSv2, AWS EC2, Service Control Policies, Terraform, EventBridge, ImdsPacketAnalyzer, CloudTrail, SSRF

## Related posts

- [Inside Figma: getting out of the (secure) shell](https://swe.quest/articles/inside-figma-getting-out-of-the-secure-shell-990a1f1d9b7e2fa4.md): Figma · 2021-09-02 · Medium · 9 min read · Identity & auth, Cloud platforms, Security
  Figma replaced its SSH bastion hosts with a zero-trust shell access system built on AWS SSO (backed by Okta with WebAuthn and device trust) and AWS Systems Manager Session Manager, so instances need no exposed SSH ports and access uses short-lived, minimally privileged IAM role credentials.
- [Security Disclosure Recommendation: Check for Anomalous AWS Access](https://swe.quest/articles/security-disclosure-recommendation-check-for-anomalous-aws-access-56c87760658990bd.md): Railway · 2026-10-22 · Medium · 2 min read · Incidents & postmortems, Cloud platforms, Identity & auth, Security
  If an AWS access key used with Railway may have been exposed, deactivate it, replace it, redeploy, and audit what it did.
- [Supabase incident on February 12, 2026](https://swe.quest/articles/supabase-incident-on-february-12-2026-796328e8ccb5effc.md): Supabase · 2026-02-13 · Medium · 8 min read · Incidents & postmortems, Cloud platforms, Networking, Infrastructure as code, Deployment
  A new internal monitoring stack deployed into an existing AWS account used a shared construct that enabled VPC Block Public Access in block-bidirectional mode at the regional level.
- [Incident Report: October 21st Security Attack](https://swe.quest/articles/incident-report-october-21st-security-attack-5a78ac26d27c6de1.md): Railway · 2026-11-10 · Medium · 21 min read · Incidents & postmortems, Security, Identity & auth, Multi-tenancy, CI/CD
  An attacker partially escaped filesystem isolation in Railway's multi-tenant build infrastructure and stole a build credential.
- [Tale of 'metadpata': the revenge of the supertools](https://swe.quest/articles/tale-of-metadpata-the-revenge-of-the-supertools-5db481304c48698d.md): Zalando Engineering · 2024-01-22 · Medium · 7 min read · Incidents & postmortems, Configuration management, Deployment, DNS, Cloud platforms
  A one-character typo turning the "metadata" key into "metadpata" in a YAML config caused Zalando's AWS account-management tool to treat the configuration as "no accounts" and then decommission all accounts.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
