A SysOps administrator is setting up a nightly automation task using AWS Systems Manager (SSM) Maintenance Windows to run a command on a fleet of Amazon EC2 instances. The maintenance window is configured to use a custom service role named MaintenanceWindowServiceRole to run the task. The administrator has attached an IAM policy to their own IAM user account that contains the following statement:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:RegisterTaskWithMaintenanceWindow",
"ssm:UpdateMaintenanceWindowTask"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::111122223333:role/MaintenanceWindowServiceRole"
}
]
}
When the administrator attempts to register the task with the maintenance window specifying MaintenanceWindowServiceRole as the service role, the operation fails with an 'Access Denied' error. The trust policy of MaintenanceWindowServiceRole correctly trusts ssm.amazonaws.com. What should the administrator do to resolve this issue?
- Replace the sts:AssumeRole permission in the administrator's IAM policy with the iam:PassRole permission for the MaintenanceWindowServiceRole.Answer
- BAdd sts:AssumeRole to the trust policy of the administrator's IAM user.
- CModify the trust policy of MaintenanceWindowServiceRole to trust the administrator's IAM user ARN instead of the Systems Manager service principal.
- DAdd the iam:PassRole action to the trust policy of MaintenanceWindowServiceRole to allow the Systems Manager service to pass the role.