A SysOps Administrator is using the AWS CLI to configure an existing AWS CloudTrail trail to send log events to an Amazon CloudWatch Logs log group. The administrator has already created the target log group and an IAM role named CloudTrail-Delivery-Role that includes the required permissions for CloudWatch Logs. However, when running the aws cloudtrail update-trail command to associate the role and log group with the trail, the CLI returns an AccessDeniedException error.
Which action should the administrator take to resolve this error?
- AModify the trust policy of the CloudTrail-Delivery-Role to trust the cloudtrail.amazonaws.com service principal and allow the sts:AssumeRole action.
- Attach an IAM policy to the administrator's IAM user that grants the iam:PassRole permission for the CloudTrail-Delivery-Role resource.Cevap
- CAdd a statement to the S3 bucket policy of the logging bucket to allow cloudtrail.amazonaws.com to perform the sts:AssumeRole action.
- DConfigure an Amazon EventBridge rule that triggers an AWS Systems Manager Automation runbook to automatically grant CloudTrail access to the log group.
Cevap
Attach an IAM policy to the administrator's IAM user that grants the iam:PassRole permission for the CloudTrail-Delivery-Role resource.
To associate an IAM role with an AWS service (such as CloudTrail) via the AWS CLI or API, the IAM entity executing the configuration command must have the iam:PassRole permission for that specific role. If this permission is missing, the AWS API returns an AccessDeniedException during the setup configuration.
Adım Adım Çözüm
Anahtar Kavram
IAM role delegation via iam:PassRole during CloudTrail CloudWatch Logs configuration
Tahmini Süre:1m 30s