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
Move Account To OU
Enable The Service Control Policy
Create The Service Control Policy For EC2
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "RequireMicroInstanceType",
"Effect": "Deny",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringNotEquals":{
"ec2:InstanceType":"t2.micro"
}
}
}
]
}
Attach The Service Control Policy
Switch Role
Launch An EC2 Instance
| Posted By - | Karan Gupta |
| |
| Posted On - | Monday, May 30, 2022 |