AWS Tag policy not working

-1

I am trying to test the following tag policy

{
  "tags": {
    "InfraOwner": {
      "tag_key": {
        "@@assign": "InfraOwner"
      },
      "tag_value": {
        "@@assign": [
          "ashish.sharma2@gmail.com"
        ]
      }
    }
  }
}

But it is not working as i can assign any random value for InfraOwner tag also Also please help to modify policy to use a wildcard to ensure that InfraOwner tag value should always end with @gmail.com

1 Answer
0

It sounds like the tag policy you have defined is not working as expected. Here are a few things to check:

Make sure that the tag policy is enabled. You can do this by navigating to the Tag policies page in the AWS Management Console and verifying that the policy is enabled.
Verify that the policy is applied to the correct resources. Tag policies only apply to resources that are created or modified after the policy is enabled.
Check the syntax of the policy. The policy you provided looks correct, but it's possible that there is a syntax error or typo that is causing the policy to fail.

Regarding your second question, you can modify the policy to use a wildcard to ensure that the InfraOwner tag value always ends with "@gmail.com". Here's an example policy that does this:


{
  "tags": {
    "InfraOwner": {
      "tag_key": {
        "@@assign": "InfraOwner"
      },
      "tag_value": {
        "@@endsWith": "@gmail.com"
      }
    }
  }
}
  • This policy uses the "@@endsWith" condition operator to ensure that the InfraOwner tag value ends with "@gmail.com".

  • Note that this policy will only allow values that end with "@gmail.com", so if you want to allow other email domains as well, you will need to modify the policy accordingly.

if this answer helps, please ensure to leave a thumbs up.

I hope this helps! Let me know if you have any further questions.

profile pictureAWS
answered a year 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