IAM Policy Question using conditions

0

Hi Team

I need to write a policy for one of the service where I dont see condition support (https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html) For Actions in (CreateKeysAndCertificate, CreatePolicyVersion). {Dependent Actions/Conditions are not supported for these permissions)

Am not sure how to write the condition. For now this is what I wrote. { "Version": "20212-10-17", "Statement: : [ { "Sid": "IOTPermissions", "Effect": "Allow", "Action": [ "iot:CreateKeysAndCertificate", "iot:CreatePolicyVersion" ], "Resource": "arn:${Partition}:iot:${Region}:${Account}:/" } ] }

I know how to write or use the condition if the action supports based on documentation

I want to use either aws:ResourceTag/aws:RequestTag/aws:TagKeys with some KeyValue (ex. Department is the Key and Value will be FinanceTeam)

kumar
질문됨 2달 전162회 조회
1개 답변
1

Hello.

I think the policy would probably be something like this:
When you look at the document table for "iot:CreateKeysAndCertificate", the resource is blank, so you cannot set anything other than "*".
"iot:CreatePolicyVersion" allows you to specify "aws:ResourceTag" when the resource is "policy*", so I thought it would be as follows.
https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html

{ 
    "Version": "20212-10-17", 
    "Statement": [
        {
            "Sid": "IOTPermissions", 
            "Effect": "Allow",
            "Action": [
                "iot:CreateKeysAndCertificate"
            ],
            "Resource": "*"
        },
        {
            "Sid": "test",
            "Effect": "Allow",
            "Action": [
                "iot:CreatePolicyVersion"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/Department": "FinanceTeam"
                }
            }
        }
    ]
}
profile picture
전문가
답변함 2달 전
profile pictureAWS
전문가
검토됨 2달 전

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

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

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

관련 콘텐츠