Q17 — AWS SAA-C03 Ch.16
Question 17 of 100 | ← Chapter 16
Q1217. A company runs an application on Amazon EC2 instances behind an Application Load Balancer (ALB). The company wants to create a public APl for the application that uses JSON Web Tokens (JWT) for authentication. The company wants the API to integrate directly with the ALB.Which solution will meet these requirements?
- A. Use Amazon API Gateway to create a REST API.
- B. Use Amazon API Gateway to create an HTTP API. ✓
- C. Use Amazon API Gateway to create a WebSocket API.
- D. Use Amazon API Gateway to create a gRPC API.
Correct Answer: B. Use Amazon API Gateway to create an HTTP API.
Explanation
To meet the requirements of creating a public API for an application running on Amazon EC2 instances behind an Application Load Balancer (ALB) that uses JSON Web Tokens (JWT) for authentication and integrates directly with the ALB, the most suitable solution is:B. Use Amazon API Gateway to create an HTTP API.Analysis:Amazon API Gateway HTTP API:Functionality: HTTP APIs are designed to be lightweight and cost-effective for building RESTful APIs. They provide built-in support for JWT authorization, making them ideal for scenarios where JWT authentication is required.Integration with ALB: HTTP APIs can be configured to integrate directly with an ALB. This allows the API Gateway to route incoming requests to the ALB, which then distributes the traffic to the appropriate EC2 instances.JWT Authentication: HTTP APIs support JWT authorization out of the box, allowing you to easily implement JWT-based authentication for your API.Amazon API Gateway REST API (Option A):Functionality: REST APIs are more feature-rich than HTTP APIs and support a wide range of integration types, including ALB. However, they may be overkill for simple RESTful APIs that only require JWT authentication.Consideration: While REST APIs can be used, HTTP APIs are generally more cost-effective and simpler to configure for this specific use case.Amazon API Gateway WebSocket API (Option C):Functionality: WebSocket APIs are designed for real-time, bidirectional communication between clients and servers. They are not suitable for building RESTful APIs that use JWT authentication and integrate with an ALB.Amazon API Gateway gRPC API (Option D):Functionality: gRPC APIs are used for building high-performance, efficient APIs using Protocol Buffers. They are not designed for RESTful APIs and do not support JWT authentication out of the box in the same way that HTTP APIs do. Additionally, gRPC APIs do not integrate directly with ALB in the same manner as HTTP or REST APIs.In summary, using Amazon API Gateway to create an HTTP API is the most suitable solution for creating a public API that uses JWT authentication and integrates directly with an ALB. HTTP APIs provide the necessary functionality at a lower cost and with simpler configuration compared to REST APIs for this specific use case.