A public API for a image sharing application is deployed on API Gateway. Clients must authenticate with standards-based tokens issued by an external OpenID Connect provider. Which authorization mechanism should be used?
Trap 1: A VPC endpoint policy
A VPC endpoint policy governs access to the API through a VPC endpoint, controlling which principals and actions can use that private connection. It does nothing to authenticate individual application users on the public internet, and it cannot validate OIDC tokens or establish user identity. It is an authorization mechanism for network-level access, not a user authentication mechanism.
Trap 2: API keys only
API keys issued by API Gateway identify the calling client application for usage plans and throttling quotas, but they are shared secrets that can be extracted and reused. They do not verify an end user's identity, carry no claims about the user, and provide no support for standard federation or OIDC token validation. In a public image-sharing app, API keys alone leave the API open to any client that obtains a key, making them unsuitable for secure user authentication.
Trap 3: IAM authorization for all internet users
IAM authorization on API Gateway requires the caller to sign requests with AWS credentials (SigV4) and is designed for AWS principals like EC2 roles or Lambda functions. Internet users of a public image-sharing app typically do not have AWS IAM credentials, and exposing temporary AWS credentials to every end user is both insecure and operationally unmanageable. It also lacks built-in support for OIDC identity federation for arbitrary public users.
- A
A VPC endpoint policy
Why it fails: A VPC endpoint policy governs access to the API through a VPC endpoint, controlling which principals and actions can use that private connection. It does nothing to authenticate individual application users on the public internet, and it cannot validate OIDC tokens or establish user identity. It is an authorization mechanism for network-level access, not a user authentication mechanism.
- B
API keys only
Why it fails: API keys issued by API Gateway identify the calling client application for usage plans and throttling quotas, but they are shared secrets that can be extracted and reused. They do not verify an end user's identity, carry no claims about the user, and provide no support for standard federation or OIDC token validation. In a public image-sharing app, API keys alone leave the API open to any client that obtains a key, making them unsuitable for secure user authentication.
- C
JWT authorizer configured for the OpenID Connect issuer
A JWT authorizer configured with the OpenID Connect issuer validates the JSON Web Token signature, expiry, and issuer at the API Gateway edge before allowing the request. This offloads authentication so the backend can trust claims such as the user's unique subject identifier and custom scopes without managing sessions or cryptographic verification code. It is the most appropriate, operationally lightweight option for authenticating external OIDC-based users on a public API.
- D
IAM authorization for all internet users
Why it fails: IAM authorization on API Gateway requires the caller to sign requests with AWS credentials (SigV4) and is designed for AWS principals like EC2 roles or Lambda functions. Internet users of a public image-sharing app typically do not have AWS IAM credentials, and exposing temporary AWS credentials to every end user is both insecure and operationally unmanageable. It also lacks built-in support for OIDC identity federation for arbitrary public users.