Question 160:
In your team, AWS Systems Manager is used to maintain EC2 instances. For example, you can run a command to execute a shell script for instances with a tag of “QA”. However, you want to limit the usage of the “Run Command” feature for some IAM users for security concerns. For these specific users, you need an IAM policy to only allow them to run commands for instances that have the “department” tag of “dev1” or “dev2”. Which IAM policy can help you to achieve this requirement?
Answer options:
A. { "Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["*"],
"Resource": "*",
"Condition": {
"StringLike": {
"ssm:resourceTag/department":[ "dev1" ],
"ssm:resourceTag/department":[ "dev2" ]
}}
}]
}
B. { "Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [ "ssm:SendCommand" ],
"Resource":"*",
"Condition":{
"StringNotEquals":{
"ssm:resourceTag/department":[ "dev1", "dev2" ]
}}
}]
}
C. { "Version": "2012-10-17",
"Statement": [{
"Effect":"Allow",
"Action":[ "ssm:SendCommand" ],
"Resource":"*",
"Condition":{
"StringLike":{
"ssm:resourceTag/department":[ "dev1" ],
"ssm:resourceTag/department":[ "dev2" ]
}}
} ]
}
D. { "Version": "2012-10-17",
"Statement": [{
"Effect":"Allow",
"Action":[ "ssm:RunCommand" ],
"Resource":"*",
"Condition":{
"StringLike":{
"ssm:department":[ "dev1" ],
"ssm:department":[ "dev2" ]
} }
} ]
}