Last active
March 27, 2023 21:19
-
-
Save spasam/4a68f1cefdab81089be3f44767e45dae to your computer and use it in GitHub Desktop.
Prevent the usage of IMDSv1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Deny", | |
| "Action": "*", | |
| "Resource": "*", | |
| "Condition": { | |
| "NumericLessThan": { | |
| "ec2:RoleDelivery": "2.0" | |
| } | |
| } | |
| }, | |
| { | |
| "Effect": "Deny", | |
| "Action": "ec2:RunInstances", | |
| "Resource": "arn:aws:ec2:*:*:instance/*", | |
| "Condition": { | |
| "StringNotEquals": { | |
| "ec2:MetadataHttpTokens": "required" | |
| } | |
| } | |
| }, | |
| { | |
| "Effect": "Deny", | |
| "Action": "ec2:ModifyInstanceMetadataOptions", | |
| "Resource": "*" | |
| }, | |
| { | |
| "Effect": "Deny", | |
| "Action": "ec2:RunInstances", | |
| "Resource": "arn:aws:ec2:*:*:instance/*", | |
| "Condition": { | |
| "NumericGreaterThan": { | |
| "ec2:MetadataHttpPutResponseHopLimit": "1" | |
| } | |
| } | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment