boto3-oversize
Messages published using Amazon SNS have a maximum size of 256KiB, which can be a limitation for certain use cases. AWS provides an extended client library for Java that transparently uploads messages exceeding this threshold to S3 and restores them when the messages are received. This Python package provides the same functionality for boto3.
Installation
- Create an Amazon S3 bucket that will store message payloads that exceed the maximum size.
- While the Java library deletes payloads from S3 when they are retrieved, this is not appropriate when there are multiple subscribers to the topic. Instead, apply a S3 lifecycle configuration to expire the message payloads after a reasonable length of time, e.g., 14 days.
- Install this package, e.g.,
pip install boto3-oversize. - Define the
OVERSIZE_PAYLOAD_BUCKET_NAMEenvironment variable as the name of the bucket you created; ensure your AWS access credentials have permission to callPutObjectandGetObjectin the root of the bucket.
Usage
The library provides replacement implementations of the core boto3 entry points that transparently
apply the necessary changes to the SNS and SQS clients, both for the low-level client and service
resource. Simply reference boto3_oversize instead of boto3.
Low-level client example
import boto3_oversize
sns_client = boto3_oversize.client('sns')
response = sns_client.create_topic(Name='example-large-payload-topic')
sns_client.publish(TopicArn=response['TopicArn'], Message='example-message')
Service resource example
import boto3_oversize
sqs_client = boto3_oversize.resource('sqs')
queue = sqs_client.create_queue(QueueName='example-large-payload-queue')
messages = queue.receive_messages()
Implementation
Calls to publish messages are intercepted and the message body sized check against the limit, reduced by a small percentage to consider SNS message envelope overhead if raw message delivery is not enabled. If the message exceeds this threshold, it is uploaded to an S3 bucket and the SNS message replaced with the object ARN.
When receiving messages, the SQS client checks if the entire message body appears to be an S3 object ARN. If it is, the object is retrieved from S3 and returned to the caller as the message body.
Metadata
Release files for boto3-oversize 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| boto3_oversize-0.1.4.tar.gz | 4.7 kB | Without provenance | Details for boto3_oversize-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| boto3_oversize-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for boto3_oversize-0.1.4-py3-none-any.whl |
Total release size: 10.9 kB
Release files / boto3_oversize-0.1.4.tar.gz
| Download URL | boto3_oversize-0.1.4.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85b170b4cce391a524012754125a40b5735a0b7523986e961ff511ccdb109ace
|
|
BLAKE2b-256 checksum How to use checksums |
5ae9815a16072245cd3c6d0065f24f614cb33deab711d6c5466279de6ab077f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Release files / boto3_oversize-0.1.4-py3-none-any.whl
| Download URL | boto3_oversize-0.1.4-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8fc02c35935fd8131a1a963fbc1ad6410ead072f0220a46cea0ab4bfe2d2d188
|
|
BLAKE2b-256 checksum How to use checksums |
6fdc17d8720da7b6f816e052fd7d3ec59d0bd363f010ceb1f4c2a3160686ddad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Security for boto3-oversize 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.