SCP - Require tag Project on every resource

0

Hello,

I'm looking into SCPs, and I see that's possible to require a tag for EC2 for example with the following policy:

{
      "Sid": "DenyRunInstanceWithNoProjectTag",
      "Effect": "Deny",
      "Action": "ec2:RunInstances",
      "Resource": [
        "arn:aws:ec2:*:*:instance/*",
        "arn:aws:ec2:*:*:volume/*"
      ],
      "Condition": {
        "Null": {
          "aws:RequestTag/Project": "true"
        }
      }
    }

But what in case when I want to create a policy which would deny creation or any modification of any resource when it doesn't have tag Project. Can I simply use wildcard for action and resource, like below?

{
      "Sid": "DenyResourcesWithNoProjectTag",
      "Effect": "Deny",
      "Action": "*",
      "Resource": "*",
      "Condition": {
        "Null": {
          "aws:RequestTag/Project": "true"
        }
      }
    }
질문됨 4달 전138회 조회
1개 답변
1

Hello.

If you set this, all resources that do not have tags set will become Deny, so some services will become inoperable.
For example, you may encounter problems such as not being able to select an AMI even if you want to start EC2.
Therefore, I think it is necessary to set the required action in "Action" and which resource to target in the "Resource" section.
https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_tagging.html

profile picture
전문가
답변함 4달 전
  • If you set this, all resources that do not have tags set will become Deny, so some services will become inoperable.

    But that would only apply to resources which can be tagged, right? And may be inoperable until they are tagged with Project, right?

  • Yes, services that allow tagging may become unavailable.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠