A SysOps Administrator is setting up VPC Flow Logs to capture traffic for a critical application and stream it to an Amazon CloudWatch Logs log group. The administrator creates an IAM role named FlowLogDeliveryRole with a trust policy that allows the vpc-flow-logs.amazonaws.com service principal to assume the role. The role has an attached IAM policy granting logs:CreateLogStream and logs:PutLogEvents permissions. When the administrator attempts to create the flow log using the AWS CLI command 'aws ec2 create-flow-logs', the command returns an AccessDenied error. Which of the following is the most likely cause of this issue?
- The administrator's IAM identity does not have the iam:PassRole permission for the FlowLogDeliveryRole resource.Cevap
- BThe trust policy of the FlowLogDeliveryRole must grant the logs.amazonaws.com service principal permission to assume the role.
- CThe CloudWatch Logs log group does not have a resource-based policy that explicitly grants write permissions to the flow logs service.
- DThe AWS CLI command must be initiated via an AWS Systems Manager Automation runbook triggered by an Amazon EventBridge rule to successfully pass the credentials.
Cevap
The administrator's IAM identity does not have the iam:PassRole permission for the FlowLogDeliveryRole resource.
The correct answer is the option stating that the administrator's IAM identity does not have the iam:PassRole permission. When configuring an AWS service like VPC Flow Logs to run actions on your behalf, you must pass an IAM role to the service. To do this, your IAM user or role must have the iam:PassRole permission for that specific target role. Without this permission, the create-flow-logs API call fails with an AccessDenied error.
Adım Adım Çözüm
Anahtar Kavram
IAM PassRole requirement for AWS service configuration
Tahmini Süre:2m 30s