An Amazon EC2 Auto Scaling group launches Amazon Linux instances and installs the Amazon CloudWatch agent to send logs to Amazon CloudWatch Logs. Instances assume an IAM role with a policy that currently allows publishing custom metrics to CloudWatch. Instances run in a private subnet with internet access through a NAT gateway. The CloudWatch Logs agent is running and correctly configured, and network connectivity to AWS is verified, but no logs appear in CloudWatch Logs. What should the security engineer do to ensure logs are published?
Choose an answer
Tap an option to check your answer.
Correct answer: Update the IAM policy attached to the instance role to include the required CloudWatch Logs permissions (for example, logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents)..
Why this is the answer
The problem states that the instances can publish custom metrics to CloudWatch, but not logs. This indicates a permissions issue specific to CloudWatch Logs. The CloudWatch agent requires specific IAM permissions, such as logs:CreateLogGroup, logs:CreateLogStream, and logs:PutLogEvents, to send logs to CloudWatch Logs. Updating the IAM policy attached to the instance role with these permissions will resolve the issue. Modifying the Auto Scaling service-linked role is incorrect because this role manages Auto Scaling actions, not instance-level permissions for sending logs. Updating the IAM policy to include "AWS Logs API actions" is too vague; the specific CloudWatch Logs permissions are needed. Adding an interface VPC endpoint for CloudWatch Logs is unnecessary because the instances already have internet access via a NAT Gateway, which allows communication with AWS service endpoints.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed