SCS-C02 exam dumps

SCS-C02 practice question 315 of 504

AWS Certified Security - Specialty. Expert level, Amazon Web Services. Free question with the correct answer and a full explanation.

SCS-C02 Question 315

Single answer

An organization wants to grant an IAM user the ability to start and stop EC2 instances, but only in a specific AWS region. They create the following policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:StartInstances",
        "ec2:StopInstances"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:RequestedRegion": "us-east-1"
        }
      }
    }
  ]
}

However, after attaching the policy, the user reports they cannot start or stop the instances. What is the MOST likely reason for this issue?

  1. A

    The policy's Resource field is set to "*", which is overly permissive and causes the policy to be ignored.

  2. B

    The IAM user does not have explicit permissions to describe EC2 instances, which is required for starting or stopping them.

  3. C

    The aws:RequestedRegion condition key is invalid, causing the policy to fail validation.

  4. D

    The IAM user also needs an explicit ec2:DescribeInstances permission in the same policy for it to work.

Show answer and explanation

Correct answer: B

Explanation

When starting or stopping EC2 instances, AWS requires the ec2:DescribeInstances permission to fetch instance details. This permission is not included in the policy presented, which results in the user being unable to start or stop instances even though the StartInstances and StopInstances actions are allowed. Adding the ec2:DescribeInstances permission would resolve this issue.

  • A. Incorrect.

    The Resource field being set to "*" is valid in this context, as it means the policy applies to all EC2 instances. This is not the cause of the issue.

  • B. Correct.

    The IAM user does not have explicit permissions to describe EC2 instances. The ec2:DescribeInstances permission is required because AWS needs to query the instance details during the start and stop operations.

  • C. Incorrect.

    The aws:RequestedRegion condition key is valid and used correctly in this policy to restrict the actions to the us-east-1 region. This is not the cause of the issue.

  • D. Incorrect.

    While adding ec2:DescribeInstances permission is necessary, it does not need to be in the same policy. Permissions can be granted using multiple policies attached to the user or role.

Timed practice exam

Take a SCS-C02 practice test under exam conditions

65 questions in 170 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam