예시 1) 서울 리전에서만 EC2를 사용하고자 할때 다른 리전의 EC2 권한을 Deny 시키고 싶습니다.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:*" ], "Condition": { "StringEquals": { "ec2:Region": "ap-northeast-2" } }, "Resource": [ "*" ] }, { "Effect": "Deny", "Action": [ "ec2:*" ], "Condition": { "StringNotEquals": { "ec2:Region": "ap-northeast-2" } }, "Resource": [ "*" ] } ]}
예시 1) 서울, 도쿄 리전에서만 EC2를 사용하고자 할때 다른 리전의 EC2 권한을 Deny 시키고 싶습니다.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:*" ], "Condition": { "StringEquals": { "ec2:Region": "ap-northeast-2" } }, "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "ec2:*" ], "Condition": { "StringEquals": { "ec2:Region": "ap-northeast-1" } }, "Resource": [ "*" ] }, { "Effect": "Deny", "Action": [ "ec2:*" ], "Condition": { "StringNotEquals": { "ec2:Region": [ "ap-northeast-1", "ap-northeast-2" ] } }, "Resource": [ "*" ] } ]}
위의 설정을 적용 후에 IAM Users 나 Group 에 추가해주시면 됩니다.
출처: https://heewon0704.tistory.com/13?category=646309 [희워닝 블로그]