Capture Cognito auth events in CloudTrail, store in S3, and query with Athena
Short answer
B Use CloudTrail to capture Cognito events in S3 and query InitiateAuth/SignUp with Athena.
Question
Key Takeaways
Cognito authentication attempts surface as CloudTrail management events (InitiateAuth for sign-in, SignUp for registration), so CloudTrail → S3 → Athena (B) is the correct capture-and-query pipeline. Cognito does not emit user auth activity to CloudWatch logs by default (A's CloudWatch path and D's metrics/dashboard are insufficient for querying individual attempts). B is correct; A was a minority alternative.
To capture both successful and unsuccessful Cognito login attempts and query them, use AWS CloudTrail, which records Cognito API calls such as InitiateAuth and SignUp (with event source cognito-idp.amazonaws.com), deliver the logs to an S3 bucket, and query the events with Amazon Athena. Cognito does not stream raw login-activity logs to CloudWatch by default, so CloudTrail is the source of truth for auth events.
Common mistake: Assuming Cognito sends login activity to CloudWatch (A/D)—by default auth events are CloudTrail management events, not CloudWatch log streams, so you cannot query individual attempts there. Using CloudWatch metrics/dashboards (D)—they aggregate, they do not let you query specific InitiateAuth/SignUp events. CloudTrail + Athena (B) is the queryable source.
Expert Analysis
Why the Answer Is Correct
Amazon Cognito authentication activity (InitiateAuth for sign-in, SignUp for registration) is recorded as AWS CloudTrail management events with event source cognito-idp.amazonaws.com. Delivering those CloudTrail logs to an S3 bucket and querying them with Amazon Athena lets the company both capture and analyze successful and unsuccessful login attempts.
Why the Other Options Are Wrong
A relies on Cognito sending user-activity logs to CloudWatch and a Lambda export, but Cognito auth events are CloudTrail events, not CloudWatch log streams, so querying is unreliable there. C similarly assumes CloudTrail-to-CloudWatch monitoring covers querying, which it does not. D uses CloudWatch metrics/dashboards, which aggregate and do not allow querying individual events. B is correct.
Community Comment Notes
Community voted B (80), with A a 20 minority. Commenters noted CloudTrail logs all Cognito API calls including login attempts (InitiateAuth) to S3, and Athena queries them; A's CloudWatch path was seen as less complete for querying. B confirmed.
Official Reference
https://docs.aws.amazon.com/cognito/latest/developerguide/cloudtrail.html
This link opens the official vendor documentation in a new tab.
Community Votes
80% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 4 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 4
-
Pmktechno 👍 2 Answered BAWS CloudTrail provides detailed logs of all API calls made to Amazon Cognito, including login attempts. Amazon S3 is used to store these logs, ensuring they are easily accessible and durable. Amazon Athena allows you to run SQL queries on the logs stored in S3, making it straightforward to filter and analyze the data for specific events, such as InitiateAuth, which corresponds to login attempts. This setup ensures that you can capture both successful and unsuccessful login attempts and query the data efficiently.
-
sypaladinzi 👍 1 Answered BB is the Answer: CloudTrail logs all API calls to Cognito, including login attempts (InitiateAuth events). S3 stores the logs for analysis. Athena allows querying these logs for successful and unsuccessful login attempts using event names (InitiateAuth) and sources (cognito-idp.amazonaws.com).
-
Ucy 👍 1 Answered BB is correct CloudTrail to deliver logs to an Amazon S3 bucket. Use Amazon Athena to query the logs
-
jdx000 👍 1 Answered AA is the answer
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.