A developer is configuring a REST API in Amazon API Gateway to act as a front-end proxy for downloading images stored in an Amazon S3 bucket. The client will specify the image name using a path parameter named `imageName`. The developer wants to use a direct AWS Service integration to minimize latency and avoid invoking an AWS Lambda function.
Which two steps are required to configure this integration?
- Configure an IAM role that allows the `s3:GetObject` action on the target S3 bucket, and set this role as the Execution Role in the Integration Request settings.Cevap
- Set the Path Override in the Integration Request to `my-bucket/{image}` and add `image` to the URL Path Parameters mapped from `method.request.path.imageName`.Cevap
- CConfigure a Lambda Authorizer to validate the request and dynamically return the S3 pre-signed URL in the authorizer response context.
- DEnable Lambda Proxy integration on the method, and write a Lambda function to retrieve the object from S3 using the AWS SDK.
- ECreate a Velocity Template Language (VTL) mapping template for the Integration Request to extract the path parameter and pass it as a JSON payload in the request body.
Cevap
To configure a direct Amazon S3 integration in API Gateway without Lambda, you must set up an IAM execution role that allows the `s3:GetObject` action on the target S3 bucket, configure the Integration Request with a Path Override pointing to the bucket and object key placeholder, and map the method request path parameter to that placeholder in the URL Path Parameters section.
The correct steps involve configuring a direct AWS Service integration using an IAM execution role to authorize API Gateway to retrieve S3 objects, and mapping the client-supplied path parameter to the S3 request path override in the URL Path Parameters configuration.
Adım Adım Çözüm
Anahtar Kavram
AWS Service integration allows API Gateway to interact directly with other AWS services like Amazon S3 without incurring the latency and cost of a Lambda function, using IAM execution roles and request path overrides.