What should the Security Engineer do to meet these requirements?
Create an Inline IAM user policy that allows for Amazon EC2 access for the contractor’s IAM user.
Create an IAM permissions boundary policy that allows Amazon EC2 access. Associate the contractor’s IAM account with the IAM permissions boundary policy.
Create an IAM group with an attached policy that allows for Amazon EC2 access. Associate the contractor’s IAM account with the IAM group.
Create an IAM role that allows for EC2 and explicitly denies all other services. Instruct the contractor to always assume this role.
Explanations:
While creating an inline IAM user policy that allows for Amazon EC2 access would grant the contractor the necessary permissions, it does not restrict access to only EC2. The contractor could still potentially receive permissions from other policies or groups, which would allow access to other AWS services.
Creating an IAM permissions boundary policy that allows Amazon EC2 access and associating it with the contractor’s IAM account is the best solution. This boundary policy restricts the maximum permissions that can be granted to the IAM user, ensuring that even if additional permissions are assigned elsewhere, they cannot exceed those defined in the boundary. Thus, the contractor will only have access to EC2.
Creating an IAM group with an attached policy that allows for Amazon EC2 access would grant the contractor access to EC2; however, it does not prevent the contractor from being assigned additional permissions through other policies or groups. This means the contractor could potentially access other AWS services, contrary to the requirement.
Creating an IAM role that allows for EC2 access and explicitly denies all other services is not an optimal solution because the contractor would need to assume this role, and there could still be scenarios where the contractor’s original permissions allow for access to other services. IAM roles also do not inherently restrict permissions to only what is defined in the role if the user has other permissions.