Enable Content Encoding in AWS API Gateway during deployment
A serverless plugin to enable Content Encoding feature in API Gateway for lambda function response compression.
$ yarn add -D serverless-content-encoding
$ npm install --save-dev serverless-content-encoding
Add the plugin and its configuration to your
plugins: - serverless-content-encoding custom: contentEncoding: minimumCompressionSize: 0 # Minimum body size required for compression in bytes
minimumCompressionSizemust be an Integer which greater than or equal 0.
contentEncodingis not configured,
minimumCompressionSizewill be set to default value which is 0 bytes.
This plugin will be triggered during deployment process
$ serverless deploy
This plugin is to enable Content Encoding on API Gateway for response compression. If your are looking for binary files support, please use serverless-apigw-binary
Thanks @evgenykireev for the recommendation of using
MinimumCompressionSize in CloudFormation instead of CreateDeployment API