Put Amazon Cognito authentication with MFA in front of a Fargate application on an ALB
Short answer
A Create a Cognito user pool requiring MFA and configure an ALB listener rule to authenticate through the hosted UI.
Question
Key Takeaways
ALB supports native authentication with a Cognito user pool, so the identity check happens at the listener before traffic ever reaches the Fargate tasks, which is what allows an unmodified third-party application to sit behind an authenticated endpoint.
A third-party Docker image runs as a Fargate service behind an Application Load Balancer, and only a specific list of users may reach it from the internet. The application cannot be changed and cannot be integrated with an identity provider, and every user must authenticate with multi-factor authentication.
Common mistake: Attaching a resource policy to the Fargate service to require MFA. Resource policies on a compute service do not enforce end-user authentication, and IAM identities are for AWS principals such as roles and users signing API calls, not for interactive browser sessions arriving through a load balancer.
Expert Analysis
Why the Answer Is Correct
An Amazon Cognito user pool holds the specific list of permitted users and can be configured to require MFA, which satisfies both the user allowlist and the multi-factor requirement. The Application Load Balancer can be configured to authenticate users against a Cognito user pool on its listener, using the hosted UI sign-in flow, so the authentication challenge is presented before any request is forwarded to the Fargate service. Because the enforcement point is the load balancer rather than the application, the third-party container image needs no changes and no identity provider integration, which is exactly the constraint given.
Why the Other Options Are Wrong
B: IAM users with MFA and a resource policy on the Fargate service do not authenticate interactive browser traffic arriving through an ALB, so the service would still be reachable without authentication. C: IAM Identity Center is built for granting access to AWS console and applications, and ALB resource protection does not provide the interactive per-user MFA flow described, so it cannot enforce the allowlist on inbound internet traffic. D: Amazon Amplify does not provide a user pool, and there is no Amplify hosted UI that an ALB listener rule can delegate authentication to, so the option is not a valid service combination.
Community Comment Notes
The community voted unanimously 100 to 0 for A, citing the AWS re:Post knowledge center article on authenticating with a Cognito user pool at an Application Load Balancer, and multiple commenters independently identified Cognito as the only service in the list that can front an unmodified application with a user allowlist and MFA.
Official Reference
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-authenticate-users.html
This link opens the official vendor documentation in a new tab.
Community Votes
100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 8 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 8
-
JMAN1 👍 9 Answered AA? As GPT says, In this scenario, setting up a user pool in Amazon Cognito allows you to define the specific list of users who can access the application. You can configure the user pool to require multi-factor authentication (MFA), ensuring an additional layer of security for user authentication. Configuring the ALB listener rule to require authentication through the Amazon Cognito hosted UI means that users attempting to access the application through the ALB will be redirected to the Cognito hosted UI for authentication, where they'll need to provide their credentials and MFA code. This setup ensures that only authenticated users from the specific user pool with MFA will have access to the application, meeting the requirements without modifying the application itself.
-
career360guru 👍 4 Answered AAs application can not be changed to integrate with Identity provider and users needs to be authenticated from internet using Cognito is the only possible solution among the options.
-
duriselvan 👍 3A ans https://repost.aws/knowledge-center/cognito-user-pool-alb-authentication
-
tmlong18 👍 1 Answered AAnswer is A ALB authentication only integration with: Cognito AWS_IAM Lambda authorizer
-
clevvve 👍 1B&C is for accessing aws resources
Show 3 more comments
-
thotwielder 👍 6web application = Cognito
-
igor12ghsj577 👍 1A sounds OK
-
career360guru 👍 1 Answered AAnswer is A
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All SAP-C02 Questions
Access 85 questions with complete answers and detailed explanations.
View Full SAP-C02 Practice Test →