Error in AWS SQS Redrive from Lambda - boto3 AttributeError: SQS client object has no attribute 'start_message_move_task'

54 Views Asked by At

I'm trying to execute from an AWS Lambda the method to start DLQ redrive. According to documentation, boto3 version must be 1.34.44 or higher. The lambda has 1.34.9 as boto3 version and Python version is 3.8.18.

My code is:

import boto3
SQS = boto3.client("sqs")
dlq_queue_arn = "<dead letter queue arn>"
queue_arn = "<queue arn>"

task_handle = SQS.start_message_move_task(
                  SourceArn=dlq_queue_arn,
                  DestinationArn=queue_arn,
              )

Error trace is:

task_handle = SQS.start_message_move_task(
File "/opt/python/botocore/client.py", line 906, in __getattr__
raise AttributeError(
AttributeError: 'SQS' object has no attribute 'start_message_move_task'

The weird thing is that the code works locally, with the same versions mentioned above.

1

There are 1 best solutions below

0
John Rotenstein On BEST ANSWER

According to Lambda runtimes - AWS Lambda, the Python 3.12 (latest) runtime has boto3-1.28.72. Therefore, it does not support this new command.

You will need to package your own boto3 or upgrade it in-place.

See: AWS Lambda Console - Upgrade boto3 version