Bird
0
0

Given this AWS CLI command sequence:

medium📝 service behavior Q4 of 15
AWS - CloudWatch
Given this AWS CLI command sequence:
aws logs create-log-group --log-group-name TestGroup
aws logs create-log-stream --log-group-name TestGroup --log-stream-name Stream1
aws logs put-log-events --log-group-name TestGroup --log-stream-name Stream1 --log-events timestamp=1609459200000,message="Start"

What will happen if you try to put log events to a non-existing log stream Stream2 in TestGroup?
AThe log stream will be created automatically and logs added
BThe command will fail with a ResourceNotFoundException error
CThe logs will be sent to the default log stream
DThe logs will be discarded silently
Step-by-Step Solution
Solution:
  1. Step 1: Understand AWS CloudWatch Logs behavior on missing streams

    When putting log events, the log stream must exist; otherwise, AWS returns a ResourceNotFoundException error.
  2. Step 2: Confirm no automatic creation

    AWS does not auto-create log streams on put-log-events; you must create them explicitly.
  3. Final Answer:

    The command will fail with a ResourceNotFoundException error -> Option B
  4. Quick Check:

    Put log events to missing stream = error [OK]
Quick Trick: Log streams must exist before sending logs [OK]
Common Mistakes:
MISTAKES
  • Assuming streams auto-create on log event put
  • Thinking logs go to a default stream
  • Believing logs are silently dropped

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes