MFA Enforcement
Policy Description
What this SCP does
This Service Control Policy (SCP) requires MFA for sensitive operations, ensuring that critical actions like stopping EC2 instances are only performed by properly authenticated users. This adds an important security layer to administrative actions.
By enforcing multi-factor authentication for stopping and terminating EC2 instances, this policy provides an additional security control that prevents unauthorized or accidental shutdown of compute resources, even if a user's credentials are compromised.
Validation Strategy
How to test this SCP works
To validate this SCP, try to stop or terminate EC2 instances with and without MFA.
- Valid test: Launch a test EC2 instance
- Invalid test: Attempt to stop the instance without using MFA (should be denied)
- Valid test: Get temporary credentials using MFA and then attempt to stop the instance (should succeed)
This testing approach confirms that sensitive EC2 operations require multi-factor authentication, providing additional protection against unauthorized actions, even in cases where normal authentication credentials might be compromised.
SCP Policy & Validation Scenarios
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"ec2:StopInstances",
"ec2:TerminateInstances"
],
"Resource": "*",
"Condition": {
"BoolIfExists": {
"aws:MultiFactorAuthPresent": false
}
}
}
]
}