Ensure that the Content Encoding feature is enabled for your Amazon API Gateway APIs in order to facilitate API payload compression. Once the feature is enabled, the API Gateway service allows compression of response bodies based on client's Accept-Encoding header. API payload compression is triggered when the response body size is greater than or equal to the threshold configured as the minimum compression size (in bytes). You can set this threshold to a non-negative integer between 0 and 10485760 (10M bytes). The compression types supported by Amazon API Gateway service are GZIP, DEFLATE, and IDENTITY.
This rule can help you with the following compliance standards:
- MAS
- NIST4
For further details on compliance standards supported by Conformity, see here.
This rule resolution is part of the Conformity Security & Compliance tool for AWS.
efficiency
Amazon API Gateway allows your client to call your API with compressed payloads using one of the supported compression types. API Gateway service supports decompression of the request payload, however, you must configure your API to enable compression of the response payload. Enabling content encoding (i.e. compression) for your API payload will help you improve your API performance and reduce bandwidth utilization.
Audit
To determine if content encoding is enabled for your Amazon API Gateway APIs, perform the following actions:
Remediation / Resolution
To enable payload compression for your Amazon API Gateway APIs using the Content Encoding feature, perform the following actions:
References
- AWS Documentation
- Enabling payload compression for an API
- Enable payload compression for an API
- Receive an API Response with a Compressed Payload
- AWS Command Line Interface (CLI) Documentation
- apigateway
- get-rest-apis
- get-rest-api
- update-rest-api
- CloudFormation Documentation
- Amazon API Gateway resource type reference
- Terraform Documentation
- AWS Provider