
At some important times of the year, such as holidays, black Friday, audit time,… the system needs to operate effectively to ensure it serves the business’s goals. Therefore, as a cloud admin and criteria of zero trust, you need to ensure that there are no unexpected resource deletion incidents during the above times.
So we will practice this lab based on the time of January 26, 2026
Create IAM Policy
IAM
Policies
Create policy in JSON data format instead of Visual. Select JSON
Scan the entire current code and press the Delete button
Copy the following code into the Policy editor box.
Noted: With format yyyy-mm-dd and timezone as UTC, you need:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Deny",
"Action": "ec2:TerminateInstances",
"Resource": "arn:aws:ec2:*:148922931563:instance/*",
"Condition": {
"DateGreaterThan": {
"aws:CurrentTime": "2026-01-25"
},
"DateLessThan": {
"aws:CurrentTime": "2026-01-27"
}
}
}
]
}

Scroll down and select Next
In the Policy name section, enter: EC2_TimeRestrict
In the Description section, enter: Restrict terminate EC2 in one week


Add policy EC2_TimeRestrict to group CostTest


EC2_TimeRestrict.

Check Permissions policies
EC2EC2_Time
t3.small



Check Permissions policies with a different time period



