AWS Certified Security - Specialty Practice Questions

AWS Certified Security - Specialty (SCS-C03) exam preparation

AWS Certified Security - Specialty practice questions in English: 180 questions with explanations. The mock exam has 65 questions and 170 minutes.

AWS Certified Security - Specialty free question 7 / 10 · Domain 4: Identity and Access Management

You want to let people launch only t1, t2 and m3 instances. You allowed ec2:RunInstances and used StringLike in the Condition to limit ec2:InstanceType to t1., t2. and m3.. But no instance of any type can be launched. Which fix matches the official description?

  1. Use a Null condition that sets ec2:InstanceType to false, so that the key must be present
  2. Change StringLike to StringEquals, and list full type names such as t2.micro
  3. Change StringLike to StringLikeIfExists, so the value is checked only for resources that have the key
  4. Keep only a statement that denies everything other than t1, t2 and m3 with StringNotLikeIfExists, and remove the Allow statement
Show the answer and explanation

Answer: C

Why this is correct
When a statement applies to multiple types of resources, a condition key that exists on only one resource type does not match on resources that lack the key, so the statement's Effect does not apply. When you launch an instance, the statement is evaluated against the image, key pair, security groups and so on as well as the instance, and these have no ec2:InstanceType, so the StringLike check fails and no type can be launched. With StringLikeIfExists, the value is checked only when the key is present, and when the key is absent the condition is treated as true.

Why the other options are wrong
"Change StringLike to StringEquals, and list full type names such as t2.micro" … When you launch an instance, the statement is also evaluated against the image, key pair, security groups and others, and they have no ec2:InstanceType. Changing the operator does not change that the condition fails to match on resources without the key.
"Use a Null condition that sets ec2:InstanceType to false, so that the key must be present" … If you require the key to be present, the condition still fails to match on the image, security groups and other resources that have no ec2:InstanceType, so the launch still fails.
"Keep only a statement that denies everything other than t1, t2 and m3 with StringNotLikeIfExists, and remove the Allow statement" … An action is allowed when an identity-based or resource-based policy allows it. If you remove the Allow statement, the launch is not allowed anyway.

Key point
IfExists can be added to the end of the name of any condition operator except Null. However, with a negated operator such as StringNotEqualsIfExists in a Deny statement, the request is denied even when the key is absent. The asterisk in a StringLikeIfExists value works as a partial-match wildcard.

Go to the AWS Certified Security - Specialty practice app (10 free questions; purchase unlocks all questions)

See the full practice set