Require IMDSv2 for new EC2 instances (declarative policy)
Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.
Require IMDSv2 for new EC2 instances (declarative policy) is an AWS guardrail written in declarative policies. Sets instance metadata defaults to http_tokens required and enforced, so new EC2 launches use IMDSv2 token-backed sessions. AWS documents that the account status report shows the current status of the attributes a declarative policy supports for the accounts in scope.
More identity and privilege guardrails ยท About Declarative policies
{
"ec2_attributes": {
"instance_metadata_defaults": {
"http_tokens": {
"@@assign": "required"
},
"http_put_response_hop_limit": {
"@@assign": "4"
},
"http_endpoint": {
"@@assign": "enabled"
},
"instance_metadata_tags": {
"@@assign": "enabled"
},
"http_tokens_enforced": {
"@@assign": "enabled"
}
}
}
}
- Blocks
- Sets instance metadata defaults to http_tokens required and enforced, so new EC2 launches use IMDSv2 token-backed sessions.
- Breaks
- AWS says to make sure no instances are making IMDSv1 calls before setting http_tokens to required, and recommends a hop limit of at least 2 when it is required. (source)
- Test before applying
- As for every Declarative policies guardrail: how to test before enforcing
- Mechanism
- Declarative policies: The configuration of a supported AWS service attribute in the accounts, OUs or organization they are attached to, including actions by service-linked roles.
- Taken from
- provider documentation, provider documentation
What the source says
"instance_metadata_defaults: {" (read 10 Nov 2026).
On what it breaks: "Before setting http_tokens to required (IMDSv2 must be used), make sure that none of your instances are making IMDSv1 calls."
Related guardrails
- Storage accounts should prevent shared key accessAzure, Azure Policy (built-in definitions), identity and privilege
- Azure Key Vault should use the RBAC permission modelAzure, Azure Policy (built-in definitions), identity and privilege
- Azure SQL Database should have Microsoft Entra-only authentication enabledAzure, Azure Policy (built-in definitions), identity and privilege
- Prevent root credentials management in member accountsAWS, Service control policies (SCPs), identity and privilege
- Deny the root user except for S3 bucket policy changesAWS, Service control policies (SCPs), identity and privilege
- Deny critical IAM user actionsAWS, Service control policies (SCPs), identity and privilege
Related pages
Sources
- Require IMDSv2 for new EC2 instances (declarative policy), read 10 Nov 2026
- How to test it first, read 10 Nov 2026
Last reviewed 16 Nov 2026.