Skip to content

Instantly share code, notes, and snippets.

@devopsblog
Created February 6, 2025 13:04
Show Gist options
  • Save devopsblog/5d4a8d4d6b11d69a425b5165bce340ef to your computer and use it in GitHub Desktop.
Save devopsblog/5d4a8d4d6b11d69a425b5165bce340ef to your computer and use it in GitHub Desktop.
IAM policy age with MFA
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ec2:*",
"Resource": "*"
},
{
"Effect": "Deny",
"Action": ["ec2:StopInstances", "ec2:TerminateInstances"],
"Resource": "*",
"Condition": {
"BoolIfExists": {
"aws:MultiFactorAuthPresent": false
},
"NumericLessThan": {
"aws:MultiFactorAuthAge": "300"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment