Request compression - AWS SDKs and Tools

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 AWS config file setting
AWS_DISABLE_REQUEST_COMPRESSION - environment variable
aws.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 AWS config file setting
AWS_REQUEST_MIN_COMPRESSION_SIZE_BYTES - environment variable
aws.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.