# 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.

```json
{
  "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](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ec2_syntax.html))
- **Test before applying:** As for every Declarative policies guardrail: [how to test before enforcing](/mechanisms/declarative-policy/)
- **Mechanism:** [Declarative policies](/mechanisms/declarative-policy/): 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](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ec2_syntax.html), 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 access](/guardrails/azure-policy-storage-no-shared-key/): Azure, Azure Policy (built-in definitions), identity and privilege
- [Azure Key Vault should use the RBAC permission model](/guardrails/azure-policy-keyvault-use-rbac/): Azure, Azure Policy (built-in definitions), identity and privilege
- [Azure SQL Database should have Microsoft Entra-only authentication enabled](/guardrails/azure-policy-sql-entra-only/): Azure, Azure Policy (built-in definitions), identity and privilege
- [Prevent root credentials management in member accounts](/guardrails/aws-scp-deny-member-root-credentials/): AWS, Service control policies (SCPs), identity and privilege
- [Deny the root user except for S3 bucket policy changes](/guardrails/aws-scp-deny-root-except-s3-bucket-policy/): AWS, Service control policies (SCPs), identity and privilege
- [Deny critical IAM user actions](/guardrails/aws-scp-deny-critical-iam-user-actions/): AWS, Service control policies (SCPs), identity and privilege

## Related pages

- [Enforce an Amazon Bedrock guardrail on model inference (declarative policy) (AWS Declarative policies)](/guardrails/aws-declarative-bedrock-guardrail-enforcement/)
- [Opt out of AI service content use organization-wide (declarative policy) (AWS Declarative policies)](/guardrails/aws-declarative-ai-services-opt-out/)
- [Permissions boundary limiting a user to S3, CloudWatch and EC2 (AWS IAM permissions boundaries)](/guardrails/aws-pb-restrict-user-to-s3-cloudwatch-ec2/)

## Sources

- Require IMDSv2 for new EC2 instances (declarative policy): https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ec2_syntax.html (read 10 Nov 2026)
- How to test it first: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_declarative.html (read 10 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://cloudgovernancetools.com/guardrails/aws-declarative-require-imdsv2/
