Skip to content

S3 Object Access Lambda Endpoint and API Gateway REST Integration

0

qq: S3 Object Lambda Access points. Has anyone successfully integrated one with API Gateway REST GET method? When I try to Test this using the object lambda alias via the API then all I get is PermanentRedirect response and a new alias to use which doesn't work. The purpose of the Lambda is to filter PII out of an object.

<?xml version="1.0" encoding="UTF-8"?>

<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Endpoint>object-lambda-ap-q6mimwwpwso8pjbskpk7cjbaeuw1a--ol-s3.s3.eu-west-1.amazonaws.com</Endpoint><Bucket>object-lambda-ap-q6mimwwpwso8pjbskpk7cjbaeuw1a--ol-s3</Bucket><RequestId>TQPXA71SV1EVN7M5</RequestId><HostId>AT3bLm2fWxa0tcPKCTmWhF5ANrcwH7A1eFtMe9NfqzenHXr0cjNEyrhdSSto8TzyZmXCXs5LNT4=</HostId></Error>

I know the bucket works fine via the API Gateway Proxy because if I use the bucket alias then I get a list of objects just fine. I've been using this tutorial and modifying it to get a simple demo going (https://docs.aws.amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-s3.html)

Does anyone know the secret to using a S3 Object Lambda Access points in a REST API call?

1 Answer
0

Hello, The error message you're encountering indicates that the name of an SQS FIFO queue in your AWS CloudFormation template does not adhere to the naming conventions required by AWS. Specifically, the rules for FIFO (First-In-First-Out) queues are: -The name must end with the .fifo suffix. -The name can only include alphanumeric characters, hyphens (-), or underscores (_). -The name must be between 1 and 80 characters in length.

Steps to Resolve the Issue

  1. Check the SQS Queue Names in Your Serverless Configuration: Review your serverless.yml or other configuration files where you define SQS queues. Ensure that the names for any FIFO queues follow the correct naming conventions.
  • Resources:
  • MyQueue:
    
  •   Type: AWS::SQS::Queue
    
  •   Properties:
    
  •     QueueName: my-queue.fifo
    
  •     FifoQueue: true
    

Make sure:

The queue name ends with .fifo. The name only includes allowed characters. 2) Correct the Queue Names: If any of your FIFO queues have names that don't adhere to these rules, update them. For instance, if you have a queue name like my.queue.fifo, change it to my-queue.fifo.

After making the necessary changes, redeploy your project: serverless deploy Here’s an example configuration for a FIFO queue in serverless.yml:

  • Resources:
  • MyFifoQueue:
    
  •   Type: AWS::SQS::Queue
    
  •   Properties:
    
  •     QueueName: my-fifo-queue.fifo
    
  •     FifoQueue: true
    

In this example: MyFifoQueue is the logical name in CloudFormation. QueueName is set to my-fifo-queue.fifo, complying with FIFO queue naming requirements.

answered a year ago
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.