How to enable caching on path and query string parameters in API Gateway using the Serverless framework Having previously about the untrodden path to enable caching on API Gateway request parameters in the framework 0.5.X, it’s a little disappointing that it’s still not officially fixed in the 1.X versions… blogged Serverless The Problem The problem is two-fold: there’s currently no way to specify caching should be enabled for path & query string parameters the template 1.X generates for is missing a few optional fields, these missing fields stop you from manually enable caching in the management console too CloudFormation Serverless API Gateway API Gateway after you deploy your Lambda function with associated API, if you go to the management console and enable caching on path or request parameters you will get an error saying “Invalid cache key parameter specified”. The Workaround A friend pointed me to a to modify the template that auto-generates for you. neat trick CloudFormation Serverless 1.X After the project is deployed, you can go to and view the template that has generated. These templates are pretty big (and poorly formatted), so I find it easier to open them up in the view and use that view to navigate to the endpoint I’m looking for. CloudFormation Serverless Designer When you click on a resource in the Designer, it’ll also highlight it in the YAML, write down the resource name. Once you find the resource template for the endpoint, write down its name. Now go back to the file in your project, and add the resource name to the section at the bottom. You only need to include fields that you want to update or add to the template. serverless.yml resources The syntax for an method looks like this: CloudFormation API Gateway see for more detail http://amzn.to/2px6ITq We also need to fill in some blanks for the section: Integration see for more detail http://amzn.to/2oJsC1P After some trial-and-error, the minimum set of fields I had to add are: Redeploy with Serverless and the path parameter is enabled for caching: Wrap Up I hope you have found this post useful, though I’m surprised by the lack of information out there during my research and the lack of official support from the framework. Serverless You know of a better way to do this, please let me know in the comments. Links Modifying auto generated Serverless v1.0 AWS CloudFormation resources Like what you’re reading? Check out my video course and learn how to run a serverless application in production. Production-Ready Serverless We will cover topics including: authentication & authorization with API Gateway & Cognito testing & running functions locally project organization strategies CI/CD centralised logging monitoring distributed tracing with X-Ray tracking correlation IDs performance & cost optimization error handling config management canary deployment VPC security leading practices for Lambda, Kinesis, and API Gateway and include all the latest changes announced at the recent AWS re:Invent conference! _See it. Do it. Learn it! Production-Ready Serverless: Operational Best Practices introduces you to leading patterns and…_bit.ly Production-Ready Serverless