Which AWS service is best for implementing a managed WebSocket API?

  1. AWS AppSync
  2. Amazon EC2
  3. Amazon API Gateway ✓
  4. AWS Lambda

Correct answer: Amazon API Gateway

Option C is correct because Amazon API Gateway natively supports WebSocket APIs, maintaining persistent two-way connections between clients and backend services and routing messages based on message content, making it the managed service purpose-built for this use case. Option A is incorrect because AWS AppSync is a managed GraphQL service optimized for real-time data synchronization and GraphQL subscriptions; while it has real-time capabilities, it is not the primary or most straightforward service for a general-purpose WebSocket API. Option B is incorrect because Amazon EC2 is raw compute infrastructure; you could manually run a WebSocket server on EC2, but this requires significant operational overhead and is not a managed WebSocket API solution. Option D is incorrect because AWS Lambda is a serverless function execution service; while Lambda can be invoked by API Gateway WebSocket routes, Lambda itself does not manage WebSocket connections and cannot independently serve as a WebSocket API.

Topic: · api gateway, websocket api, aws managed services, real-time communication

Practice AWS Solutions Architect Associate Questions Free