AWS Developer Tools Blog
New: Default Payload Compression for Amazon CloudWatch PutMetricData with the AWS SDKs
The AWS SDKs and Tools team is excited to announce support for request compression for the PutMetricData operation of Amazon CloudWatch. When publishing metrics to CloudWatch, the AWS SDKs will now automatically compress the metric data to reduce bandwidth utilization and latency.
Motivation
Compressing request payloads on the client prior to sending them to a service will reduce bandwidth utilization, which can increase transfer speeds. PutMetricData already supports gzip compression, and now the AWS SDKs will automatically compress requests to this operation.
Configuration
This feature is on by default, and the AWS SDKs will begin compressing PutMetricData requests automatically.
You can opt out of this behavior by setting AWS_DISABLE_REQUEST_COMPRESSION
to true
in your environment, or by setting disable_request_compression
to true
in your profile, or the equivalent setting on the client configuration object for each AWS SDK.
Requests that are larger in size than a configurable threshold will be compressed. The default value of the compression threshold is 10,240 bytes. You can configure this threshold via AWS_REQUEST_MIN_COMPRESSION_SIZE_BYTES
in your environment, or by setting request_min_compression_size_bytes
in your profile, or the equivalent setting on the client configuration object for each AWS SDK.
For example, the following is a profile that lowers the threshold for when the AWS SDKs will compress requests.
Next steps
You can upgrade to the latest version of the supported SDKs to take advantage of compression when publishing CloudWatch metric data. To see the list of AWS SDKs that currently support this feature, refer to the “Compatibility with AWS SDKs” section on the the “Request Compression” page of the AWS SDKs and Tools Reference Guide. You can report issues or provide feedback on each SDK’s GitHub repository.
About the author: