A telemetry data analysis company is building a REST API using Amazon API Gateway. The API will be consumed by two distinct groups:
1. Internal microservices running on Amazon EC2 instances that need to invoke the API securely using their IAM roles.
2. External customer applications that authenticate against an external identity provider and send a custom JSON Web Token (JWT) containing dynamic billing tier claims.
The developer needs to configure the security and authorization for this API in a way that minimizes custom code for standard authentication, supports fine-grained billing-tier checks, and ensures minimum latency.
Which two configuration steps should the developer perform to meet these requirements?
- Configure AWS_IAM authorization on the API resources accessed by the internal microservices, and grant the EC2 instance profile roles the execute-api:Invoke permission.Answer
- Create an API Gateway Lambda authorizer of type REQUEST to validate the custom JWT and enforce authorization based on the dynamic billing tier claims.Answer
- CConfigure an Amazon Cognito Identity Pool to directly authorize the external custom JWTs at the API Gateway method request level.
- DConfigure a built-in Amazon Cognito User Pool authorizer to validate and decode the external custom JWTs containing the dynamic billing tier claims.
- EConfigure the API method to use a Lambda Proxy integration to inspect the billing tier claims and return a 403 Forbidden status code if unauthorized.
Answer
Configure AWS_IAM authorization on the API resources accessed by the internal microservices with execute-api:Invoke permissions, and create an API Gateway Lambda authorizer of type REQUEST to validate the custom JWT and enforce billing tier claims.
The correct configuration requires utilizing AWS_IAM authorization for callers that possess IAM credentials (the internal microservices), and implementing a custom Lambda authorizer of type REQUEST to handle external clients sending custom JWTs with proprietary billing claims. This setup ensures that API Gateway offloads standard authentication natively and handles complex claims verification securely before hitting backend integrations.
Step-by-Step Solution
Key Concept
API Gateway Authorizers and IAM Access Control