Request compression
Note
For help in understanding the layout of settings pages, or in interpreting the Compatibility with AWS SDKs table that follows, see Settings pages.
AWS SDKs and tools can automatically compress payloads when sending requests to AWS services that support receiving compressed payloads. Compressing the payload on the client prior to sending it to a service may reduce the overall number of requests and bandwidth required to send data to the service, as well as reduce unsuccessful requests due to service limitations on the payload size. For compression, the SDK or tool selects an encoding algorithm that is supported by both the service and the SDK. However, the current list of possible encodings consists only of gzip, but it may expand in the future.
Request compression can be especially useful if your application is using Amazon CloudWatch. CloudWatch is a monitoring and observability service that collects monitoring and operational data in the form of logs, metrics, and events. One example of a service operation that supports compression is CloudWatch's PutMetricDataAPI method.
Configure this functionality by using the following:
disable_request_compression
- shared AWSconfig
file settingAWS_DISABLE_REQUEST_COMPRESSION
- environment variableaws.disableRequestCompression
- JVM system property: Java/Kotlin only-
Turns on or off whether the SDK or tool will compress a payload prior to sending a request.
Default value:
false
Valid values:
-
true
– Turn off request compression. -
false
– Use request compression when possible.
-
request_min_compression_size_bytes
- shared AWSconfig
file settingAWS_REQUEST_MIN_COMPRESSION_SIZE_BYTES
- environment variableaws.requestMinCompressionSizeBytes
- JVM system property: Java/Kotlin only-
Sets the minimum size in bytes of the request body that the SDK or tool should compress. Small payloads may become longer when compressed, thus, there is a lower limit where it makes sense to perform compression. This value is inclusive, a request size greater than or equal to the value is compressed.
Default value: 10240 bytes
Valid values: Integer value between 0 and 10485760 bytes inclusive.
Compatibility with AWS SDKs
The following SDKs support the features and settings described in this topic. Any partial exceptions are noted. Any JVM system property settings are supported by the AWS SDK for Java and the AWS SDK for Kotlin only.
SDK | Supported | Notes or more information |
---|---|---|
AWS CLI v2 | Yes | |
SDK for C++ | Yes | |
SDK for Go V2 (1.x) |
Yes | |
SDK for Go 1.x (V1) | No | |
SDK for Java 2.x | Yes | |
SDK for Java 1.x | No | |
SDK for JavaScript 3.x | Yes | |
SDK for JavaScript 2.x | No | |
SDK for Kotlin | Yes | |
SDK for .NET 3.x | Yes | |
SDK for PHP 3.x | Yes | |
SDK for Python (Boto3) |
Yes | |
SDK for Ruby 3.x | Yes | |
SDK for Rust | Yes | |
SDK for Swift | No | |
Tools for PowerShell | Yes |