DVA-C02 Security Practice Question
A developer is deploying an application on EC2 instances behind an Application Load Balancer (ALB). The application must authenticate users using an identity provider (IdP) that supports OpenID Connect (OIDC). What is the MOST secure way to offload authentication to the ALB?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Configure the ALB with an OIDC identity provider and use the authenticate-oidc action.
The ALB supports OIDC authentication natively through the `authenticate-oidc` action, which securely offloads user authentication to the IdP. This is the most secure and efficient approach because it keeps authentication at the edge of the load balancer. Option B is incorrect because Lambda@Edge is used with CloudFront, not directly with ALB. Option C is incorrect because IAM federation is for granting AWS API access, not for web application authentication. Option D is incorrect because while Cognito User Pools can be used with ALB, the question specifies the organization already has an OIDC-compliant IdP; the ALB's native integration is more direct and secure than adding Cognito as an intermediary.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Configure the ALB with an OIDC identity provider and use the authenticate-oidc action.
Why this is correct
The Application Load Balancer (ALB) natively supports OpenID Connect (OIDC) authentication through its `authenticate-oidc` action. This allows the ALB to delegate user authentication to an external OIDC identity provider (IdP). When a user attempts to access the application, the ALB redirects them to the IdP for login. Upon successful authentication, the IdP returns an ID token to the ALB, which validates it and then forwards the request to the backend EC2 instances, optionally injecting user claims as HTTP headers. This offloads authentication from the application code.
- ✗
Use AWS Lambda@Edge to authenticate users at the CloudFront edge.
Why it's wrong here
AWS Lambda@Edge functions are designed to run at CloudFront edge locations, triggered by viewer requests or origin responses for a CloudFront distribution. Since the application is deployed on EC2 instances behind an Application Load Balancer (ALB) and there is no mention of CloudFront in the architecture, Lambda@Edge is not an appropriate solution for authenticating users directly at the ALB layer. It operates at a different network boundary and cannot intercept or authenticate requests destined for an ALB.
- ✗
Use IAM federation to trust the IdP and assign IAM roles to users.
Why it's wrong here
IAM federation is primarily used to grant temporary AWS API credentials to users from an external identity provider, allowing them to access AWS services and resources directly (e.g., S3, EC2, Lambda) via the AWS Management Console or CLI. It is not designed for authenticating end-users to a web application running on EC2 instances for web session management. While it provides authentication, its purpose is for programmatic or console access to AWS resources, not for application-level user authentication.
- ✗
Use Amazon Cognito User Pools and configure the ALB to use Cognito as the authentication provider.
Why it's wrong here
While Amazon Cognito User Pools are OIDC compliant and can function as an identity provider, the most direct and efficient solution when an *existing* OIDC identity provider is already in use is for the ALB to integrate with it directly. Configuring Cognito as an intermediary would introduce an additional service and potential complexity, as Cognito would either need to federate with the existing OIDC IdP or manage its own user directory, which is unnecessary if direct ALB OIDC integration is feasible and simpler.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
One of 1,135 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.