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?

gefragt vor 2 Jahren322 Aufrufe
2 Antworten
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
EXPERTE
Matt-B
beantwortet vor 2 Jahren
0

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

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen