An Amazon Linux 2 EC2 instance is not sending its logs to CloudWatch Logs even though the CloudWatch agent is running and the agent configuration is correct. Company policy requires all EC2 logs be published to CloudWatch Logs. What should the SysOps administrator check to resolve this?
Choose an answer
Tap an option to check your answer.
Correct answer: Verify that the EC2 instance’s IAM role has CloudWatch Logs permissions: CreateLogGroup, CreateLogStream, PutLogEvents, and DescribeLogStreams..
Why this is the answer
The most common reason for a CloudWatch agent failing to send logs, despite correct configuration and being operational, is insufficient IAM permissions. The EC2 instance needs an IAM role with specific permissions to interact with CloudWatch Logs. These include CreateLogGroup (to create the log group if it doesn't exist), CreateLogStream (to create the log stream), PutLogEvents (to send log data), and DescribeLogStreams (to check existing log streams). Without these, the agent cannot perform its required actions. Installing and configuring the AWS CLI with a cron job is a workaround, not a standard or efficient solution, and bypasses the CloudWatch agent's intended function. Log group retention settings in CloudWatch Logs affect how long logs are kept after they are ingested, not whether they are ingested in the first place. Kinesis Data Streams are for real-time data processing and analytics, not a direct replacement for CloudWatch Logs ingestion via the CloudWatch agent, which is designed to send logs directly to CloudWatch Logs.
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