View a markdown version of this page

Amazon SQS - AWS SDK for Python v4

Developer Preview: This documentation covers the AWS SDK for Python v4, which is in Developer Preview and intended for evaluation and testing only. Do not use it for production workloads. For production applications, use the AWS SDK for Python (Boto3). To understand the differences between the two SDKs, see Choosing the right AWS SDK for Python.

Amazon SQS

Amazon Simple Queue Service (Amazon SQS) is a message queuing service. The examples in this section create and manage queues, send and receive messages, and configure long polling to reduce empty responses.

Install the Amazon SQS client before you run the examples in this section.

python -m pip install aws-sdk-sqs

Set up the examples

The examples in this section use the client that the following create_client function returns. Use the client in a with statement, or call client.close() after the last operation, as described in Creating a service client.

Configure an AWS Region and credentials before you run the examples. For more information, see Configuration variables and Credential providers.

Imports

from aws_sdk_sqs import SQSClient, SQSConfig

Code

def create_client() -> SQSClient: config = SQSConfig.resolve() return SQSClient(config=config)