Articles → AWS → Restrict The EC2 Launch Using Service Control Policy
Restrict The EC2 Launch Using Service Control Policy
Steps
- Create an AWS organization and add an account
- Create an organizational unit
- Move the account to OU
- Enable the service control policy
- Create the service control policy for EC2
- Attach the service control policy
- Switch role
- Launch an EC2 instance
Create An AWS Organization And Add An Account
Create An Organizational Unit
Click to Enlarge
Click to Enlarge
Move Account To OU
Click to Enlarge
Click to Enlarge
Enable The Service Control Policy
Click to Enlarge
Click to Enlarge
Click to Enlarge
Click to Enlarge
Create The Service Control Policy For EC2
Click to Enlarge
Click to Enlarge
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "RequireMicroInstanceType",
"Effect": "Deny",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringNotEquals":{
"ec2:InstanceType":"t2.micro"
}
}
}
]
}
Click to Enlarge
Attach The Service Control Policy
Click to Enlarge
Click to Enlarge
Switch Role
Click to Enlarge
Click to Enlarge
Click to Enlarge
Launch An EC2 Instance
Click to Enlarge