Cloud Security

IMDSv2 Migration for EC2: A Safer Rollout Checklist

November 16, 2026 · 7 min read · By CloudAI Security
IMDSv2 Migration for EC2: A Safer Rollout Checklist

IMDSv2 migration is safest when you identify software that still makes tokenless metadata requests, test how each workload obtains a token, and only then require tokens on its EC2 instances. When IMDSv2 is required, IMDSv1 cannot be used. Changing the setting before checking application and agent behavior can turn a security improvement into a credential-availability incident.

This guide offers a workload-by-workload rollout method, not a claim that one instance setting eliminates metadata risk. The decision record is the useful output: for each instance group, capture its metadata dependencies, observed tokenless use, container behavior, launch configuration, test result, and rollback owner. The method and product claims below were checked against the linked AWS and OWASP pages on November 16, 2026; no production deployment or measured outcome is implied.

Map metadata dependencies

Start with the applications and agents that run on each instance group, including bootstrap components and short-lived jobs. Identify which ones obtain instance metadata or credentials, who maintains them, and whether their supported libraries can request metadata with a session token. An inventory based only on the main application misses software that runs during startup or incident response. Treat an unknown dependency as a test requirement, not as evidence that migration is safe.

OWASP describes IMDSv2 as defense in depth against some SSRF cases, not a complete SSRF fix. That distinction sets the scope of this work. Requiring metadata tokens addresses one route to metadata access; it does not repair a URL-fetching application that can be induced to contact other internal services. Keep application-level destination validation and network protections in the separate SSRF workstream. If a team cannot name the software that needs metadata, it cannot meaningfully approve a setting change for that group.

For a hypothetical image-processing service, the inventory might list the application, a monitoring agent, and a startup component. The team would test each component in a disposable instance built from the same image and launch configuration as production. This is an example of how to structure a test, not a report that those components use any particular metadata version.

Test before enforcing tokens

AWS says the MetadataNoToken metric tracks IMDSv1 calls and recommends reaching zero before requiring IMDSv2. Examine that signal for the instance being changed during representative workload activity. A quiet interval with no traffic is not a substitute for running the paths that normally obtain credentials: startup, scheduled processing, recovery, and routine application work. Record which paths were exercised so another engineer can interpret the observation.

Next, test a canary from each distinct instance group. Confirm that the application and its agents can obtain the metadata they need using their normal supported mechanisms; do not treat a successful manual request as proof that the application works. Check the actual workload after the token requirement is applied in the canary environment. If a dependency fails, investigate its software support or configuration before expanding the rollout. Keep the pre-change setting and a responsible rollback owner in the change record, but do not make restoring tokenless access the permanent fix.

The test should also cover an instance with no business need for metadata. For that case, assess whether disabling metadata access altogether is feasible rather than maintaining an unnecessary endpoint. AWS warns that disabling access can break software that relies on it, so this decision still requires a dependency test. A passing test means the specified paths worked under the tested configuration; it does not prove that every future deployment uses identical software.

Set hop limits deliberately

AWS notes that a metadata response hop limit of one can cause problems in container environments. The limit applies to the response carrying the token, so a workload that succeeds on an instance host may behave differently when its process runs behind a container network boundary. Test the real execution path before choosing a value. Do not increase the limit simply to make an unexplained failure disappear: first establish whether the component legitimately needs metadata and whether its requests use the supported token flow.

Use a small comparison in the change record: host process versus containerized process; token acquisition versus subsequent metadata access; expected credential behavior versus observed behavior. A failure at token acquisition calls for a different diagnosis from an application that receives metadata but cannot use its credentials. Document the selected limit and the reason it works for the tested workload. A larger limit is a compatibility choice, not a substitute for restricting which processes can reach metadata.

If the environment uses multiple images or network arrangements, test them separately rather than copying one result across the fleet. The security objective is a working token requirement with the narrowest operational exception the workload actually needs. Unexplained exceptions should stop rollout for that instance group.

Check launch-time exceptions

AWS gives instance launch settings precedence over account defaults, with AMI settings considered afterward. An account default alone therefore does not establish what every newly launched instance will use. Inspect the effective settings of a canary launched through the same template or deployment path as production. Check existing instances separately: an account-level launch default does not retroactively change them.

This is where teams can misread a successful migration. Existing instances may have been changed and tested while a launch template still specifies an optional token setting, or a regional account default may differ from the setting assumed by the application owner. Record the intended setting, the configuration layer that supplies it, and the setting observed on a newly launched instance. If the values disagree, resolve the configuration ownership problem before calling the rollout complete.

Keep this task separate from broader identity administration. An encryption-key deletion safeguard asks whether dependent data remains readable; an overlooked storage-path inventory asks where copies of data may reside. Neither validates EC2 metadata behavior. They are useful adjacent checks only when the same workload change also affects keys or data locations.

Use the rollout checklist

The following checklist is an editorial decision aid for a change owner. Complete it per instance group rather than marking the whole fleet ready because one canary passed:

  1. Identify the group. Record its owner, application, image, launch path, agents, and metadata-dependent tasks. Mark unknown dependencies explicitly.
  2. Observe real activity. Examine tokenless-use signals while representative startup, scheduled, and application paths run; preserve the observation window in the change record.
  3. Test a matching canary. Apply the intended token requirement in a controlled instance and verify normal application behavior, not just a standalone metadata request.
  4. Check container behavior. If processes run in containers, test token acquisition through their actual network path and justify the selected response hop limit.
  5. Inspect the next launch. Compare the effective metadata options on a newly launched canary with the intended account, image, and launch settings.
  6. Expand with a stop condition. Proceed group by group; stop on unexplained tokenless use, failed credential access, or inconsistent launch settings. Assign an owner to each exception.

The next practical step is to choose one representative instance group and fill in this checklist before changing a broader fleet. A migration is complete only when the tested workload still functions and both existing and newly launched instances have the intended effective metadata settings. Retain exceptions as explicit risks rather than silently treating them as completed work.

Sources