例如 AWS EC2 Full:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "ec2:*",
"Effect": "Allow",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "elasticloadbalancing:*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "cloudwatch:*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "autoscaling:*",
"Resource": "*"
}
]
}
而加上 region 限制,則是替每一個權限添加限定,此例是日本地區:
"Condition": {
"StringEquals": {
"ec2:Region": "ap-northeast-1"
}
}
成果:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "ec2:*",
"Effect": "Allow",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:Region": "ap-northeast-1"
}
}
},
{
"Effect": "Allow",
"Action": "elasticloadbalancing:*",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:Region": "ap-northeast-1"
}
}
},
{
"Effect": "Allow",
"Action": "cloudwatch:*",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:Region": "ap-northeast-1"
}
}
},
{
"Effect": "Allow",
"Action": "autoscaling:*",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:Region": "ap-northeast-1"
}
}
}
]
}
沒有留言:
張貼留言