LeetQuiz Logo
Privacy Policy•contact@leetquiz.com
© 2025 LeetQuiz All rights reserved.
AWS Certified Developer - Associate

AWS Certified Developer - Associate

Get started today

Ultimate access to all questions.


A developer is tasked with setting up Amazon ECS (Elastic Container Service) container instances to forward their log data to Amazon CloudWatch Logs, which allows for real-time monitoring and storage of log files. For the container instances to successfully transmit this log data to CloudWatch Logs, an IAM (Identity and Access Management) policy must be established. This IAM policy should grant the necessary permissions for the container instances to utilize the CloudWatch Logs APIs.

Which IAM policy should be created to meet these requirements?

Exam-Like



Explanation:

Overall explanation Correct option:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogStreams" ], "Resource": [ "arn:aws:logs:::*" ] } ] } Before your container instances can send log data to CloudWatch Logs, you must create an IAM policy to allow your container instances to use the CloudWatch Logs APIs, and then you must attach that policy to ecsInstanceRole.

This policy has one statement that grants permissions to create log groups and log streams, to upload log events to log streams, and to list details about log streams.

The wildcard character () at the end of the Resource value means that the statement allows permission for the logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents, and logs:DescribeLogStreams actions on any log group. To limit this permission to a specific log group, replace the wildcard character () in the resource ARN with the specific log group ARN

Incorrect options:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": [ "arn:aws:logs:::*" ] } ] } Permission to list details of the log stream needs to be attached to this policy. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents, "ecs:DescribeServices" ], "Resource": [ "arn:aws:logs:" ] } ] }```

  • ecs:DescribeServices permission is not needed, but logs:DescribeLogStreams permissions are needed for the policy to perform as expected.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogGroups" ], "Resource": [ "arn:aws:logs:::*" ] } ] } ```

logs:DescribeLogGroups is an erroneous permission here.

Powered ByGPT-5