Service Control Policy - Availability Zones

0

I know we can (and have) locked down access to specific AWS regions. My question is, is it possible to lockdown AZ's with service control policies?

已提問 2 年前檢視次數 322 次
2 個答案
0

Yes you can do this, this policy blocked me from launching an ec2 instance in "us-east-1a"

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Statement1",
      "Effect": "Deny",
      "Action": [
        "ec2:*"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "ForAnyValue:StringEquals": {
          "ec2:AvailabilityZone": [
            "us-east-1a"
          ]
        }
      }
    }
  ]
}

Decoded failure message

{
  "allowed": false,
  "explicitDeny": true,
  "matchedStatements": {
    "items": [
      {
        "statementId": "Statement1",
        "effect": "DENY",
        "principals": {
          "items": [
            {
              "value": "xxxxxxxxxxxxxxxx"
            }
          ]
        },
        "principalGroups": {
          "items": []
        },
        "actions": {
          "items": [
            {
              "value": "ec2:RunInstances"
            },
            {
              "value": "ec2:*"
            }
          ]
        },
        "resources": {
          "items": [
            {
              "value": "*"
            }
          ]
        },
        "conditions": {
          "items": [
            {
              "key": "ec2:AvailabilityZone",
              "values": {
                "items": [
                  {
                    "value": "us-east-1a"
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  },
profile pictureAWS
專家
Matt-B
已回答 2 年前
0

You can add an inline policy and add a condition to to restrict access to availability zone.

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南