A SysOps administrator is configuring an Amazon ECS task to run on an Amazon EC2 instance. The task must read data from an Amazon S3 bucket. The administrator creates an IAM role named ECSTaskS3AccessRole with an attached policy that allows S3 read access.
The trust policy for ECSTaskS3AccessRole is configured as follows:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ecs.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
When the administrator attempts to run the task using the AWS CLI under the SysOpsAdmin IAM user identity, the command fails with the following error:
`ClientError: An error occurred (AccessDenied) when calling the RunTask operation: User: arn:aws:iam::123456789012:user/SysOpsAdmin is not authorized to perform: iam:PassRole on resource: arn:aws:iam::123456789012:role/ECSTaskS3AccessRole`
Which of the following actions are required to resolve this error and ensure the ECS task can successfully run with the required permissions? (Select TWO.)
- Add an IAM policy statement to the SysOpsAdmin user that allows the iam:PassRole action targeting the ECSTaskS3AccessRole resource ARN.Cevap
- Update the trust policy of the ECSTaskS3AccessRole to list ecs-tasks.amazonaws.com as the trusted service principal instead of ecs.amazonaws.com.Cevap
- CAdd an IAM policy statement to the SysOpsAdmin user that allows the sts:AssumeRole action targeting the ECSTaskS3AccessRole resource ARN.
- DUpdate the trust policy of the ECSTaskS3AccessRole to allow the SysOpsAdmin user to perform the iam:PassRole action.