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?

asked 2 years ago315 views
2 Answers
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
EXPERT
Matt-B
answered 2 years ago
0

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

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions