Soru

Zorluk: OrtaAPI Development and Integration with Amazon API Gateway

A developer is designing an integration for an Amazon API Gateway REST API. The API needs to receive incoming JSON payloads from clients and write them directly into an Amazon SQS queue without using an intermediate AWS Lambda function. Which two configurations must the developer perform in API Gateway to implement this integration? (Select TWO.)

  1. Configure the integration type as 'AWS Service', select Amazon SQS as the target service, and define an integration request mapping template to format the client's JSON payload.Cevap
  2. Create an IAM role that allows the API Gateway service principal to assume it, grant the role `sqs:SendMessage` permission, and specify the role's ARN as the integration's execution role.Cevap
  3. C
    Configure a custom Lambda authorizer that validates incoming client credentials, assumes an IAM role with SQS permissions, and attaches the resulting AWS credentials to the API Gateway integration request header.
  4. D
    Configure the integration type as 'Lambda Proxy' and write a custom mapping template under the integration request settings to structure the JSON payload for Amazon SQS.
  5. E
    Create an IAM execution role with `sqs:SendMessage` permissions and configure its trust policy to trust the Amazon SQS service principal (`sqs.amazonaws.com`) as the identity provider.

Cevap

To integrate Amazon API Gateway directly with Amazon SQS, configure the integration type as 'AWS Service', select Amazon SQS as the target service, and define an integration request mapping template. Additionally, create an IAM role that allows the API Gateway service principal to assume it, grant the role `sqs:SendMessage` permission, and specify the role's ARN as the integration's execution role.
To integrate Amazon API Gateway directly with Amazon SQS without using an intermediate AWS Lambda function, you must configure an 'AWS Service' integration type, select Amazon SQS, and use a mapping template to format the client's payload. Additionally, API Gateway requires an IAM execution role with permissions to perform the `sqs:SendMessage` action on the destination queue, and the role's trust policy must allow the API Gateway service principal to assume it.

Adım Adım Çözüm

1
Determine the correct integration type for directly interfacing API Gateway with Amazon SQS.
Select the 'AWS Service' integration type in API Gateway, and choose Amazon SQS as the target service.
This bypasses Lambda entirely, sending requests directly from API Gateway to SQS, reducing latency and cost.
2
Configure the payload transformation using a mapping template in API Gateway.
Create an Integration Request mapping template for the incoming client content-type to transform client data into the SQS request format.
Amazon SQS requires specific request parameters (such as MessageBody) to receive messages, which client JSON requests do not natively match.
3
Establish secure authorization between API Gateway and Amazon SQS.
Create an IAM role that grants API Gateway permission to write to the SQS queue, and assign this role to the Execution Role field of the integration.
API Gateway must assume an IAM role with sufficient permissions to authenticate and write messages to SQS.

Anahtar Kavram

API Gateway AWS Service Integrations
Bu soruyu puanla