Question

Difficulty: MediumAPI Development and Integration with Amazon API Gateway

A developer is designing a high-throughput REST API using Amazon API Gateway. To minimize latency, operational cost, and code maintenance, the API must place incoming message payloads directly into an Amazon Simple Queue Service (Amazon SQS) queue without utilizing an intermediate AWS Lambda function. Which configuration in API Gateway meets these requirements?

  1. Configure the API method with an AWS Service integration, select Simple Queue Service (SQS) as the AWS service, set the Action to SendMessage, and configure an IAM execution role with permission to write to SQS.Answer
  2. B
    Configure the API method with a Lambda proxy integration, and set the integration endpoint directly to the Amazon SQS queue HTTPS URL using the queue-owner credentials.
  3. C
    Configure the API method with a custom Lambda authorizer that receives the payload, validates it, and writes it directly to the SQS queue before returning an IAM policy.
  4. D
    Configure the API method with a mock integration, and use an integration mapping template to forward the payload directly to the SQS endpoint while enabling CORS.

Answer

Configure the API method with an AWS Service integration, select Simple Queue Service (SQS) as the AWS service, set the Action to SendMessage, and configure an IAM execution role with permission to write to SQS.
The correct answer provides a direct AWS Service integration targeting SQS. Using the AWS Service integration type allows API Gateway to map HTTP requests directly to SQS SendMessage actions, authenticating via an IAM execution role and avoiding the cost, latency, and maintenance of Lambda compute.

Step-by-Step Solution

1
Determine the appropriate integration type for bypassing intermediate compute services.
Select the AWS Service integration type.
This integration type enables API Gateway to interact directly with other AWS service APIs without requiring a Lambda function or an EC2 instance.
2
Configure the integration parameters for the SQS SendMessage operation.
Choose SQS as the AWS Service, set the HTTP method to POST, and specify SendMessage in the Action field.
This instructs API Gateway to map the client's HTTP request details into the format expected by the SQS SendMessage API query parameter or payload.
3
Configure authentication and permission settings for API Gateway.
Create an IAM role with sqs:SendMessage permission for the target queue and associate it as the execution role in the integration request.
API Gateway requires temporary security credentials to call the SQS service securely on behalf of the client.

Key Concept

API Gateway AWS Service integration allows direct communication between API Gateway and AWS services (like SQS, DynamoDB, or Kinesis) without a Lambda execution layer, reducing request latency and runtime execution costs.
Rate this question