2 Answers
- Newest
- Most votes
- Most comments
0
Yes I am trying to achieve this thing but I want to achieve this by using AWS SCP. All post which I have seen they all have same json file as mine. But while implementation it is not working.
answered 2 years ago
0
I guess you are trying to achieve something like this: https://aws.amazon.com/premiumsupport/knowledge-center/iam-policy-tags-deny/ (Sid: AllowRunInstancesWithRestrictions1)
Your policy can be modified as follow:
{
"Effect": "Deny",
"Action": [
"ec2: CreateTags",
"ec2: RunInstances"
],
"Resource": [
"arn:aws:ec2:*:*:instance/*",
"arn:aws:ec2:*:*:volume/*"
],
"Condition": {
"StringNotLike": {
"aws:RequestTag/cost_center": "?*"
}
}
}
answered 2 years ago
Relevant content
- asked a year ago
- Accepted Answerasked 9 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
So what condition type you are using?
ForAllValues:StringEquals? Or StringNotLike?
I have used Both but no luck.
Can you also post the policy you use with StringNotLike to see if there is any other issue?
Your policy with
means all your new EC2 instances need to have a tag
environment
and the tag value must be exactlytrue
Is this what you expect and what you get?