AWS Certified Security – Specialty — Question 446

An Amazon EC2 Auto Scaling group launches Amazon Linux EC2 instances and installs the Amazon CloudWatch agent to publish logs to Amazon CloudWatch Logs. The EC2 instances launch with an IAM role that has an IAM policy attached. The policy provides access to publish custom metrics to CloudWatch. The EC2 instances run in a private subnet inside a VPC. The VPC provides access to the internet for private subnets through a NAT gateway.

A security engineer notices that no logs are being published to CloudWatch Logs for the EC2 instances that the Auto Scaling group launches. The security engineer validates that the CloudWatch Logs agent is running and is configured properly on the EC2 instances. In addition, the security engineer validates that network communications are working properly to AWS services.

What can the security engineer do to ensure that the logs are published to CloudWatch Logs?

Answer options

Correct answer: A

Explanation

The issue is caused by the EC2 instance's IAM role lacking the necessary permissions to write to CloudWatch Logs, as the current policy only permits publishing custom metrics. Updating the attached IAM policy to grant the required CloudWatch API actions will authorize the agent to successfully publish logs. Other options, such as adjusting the Auto Scaling service-linked role or creating a VPC endpoint, are incorrect because the EC2 instance itself runs the agent and already has verified network connectivity to AWS services.