serverless-application-model icon indicating copy to clipboard operation
serverless-application-model copied to clipboard

how to enable api gateway cache ttl using methodSettings in yaml format?

Open sjain2015 opened this issue 8 years ago • 2 comments

How to enable api gateway cache ttl using methodSettings ? I am using this in template yaml but it does not work, it is not enabling caching at method level. Any thing missing here. Please help.

  CacheClusterEnabled: true
  CacheClusterSize: "1.6"
  MethodSettings: 
     - ResourcePath: "/*"
       CachingEnabled: true
       CacheTtlInSeconds: 600 
       HttpMethod: "GET"

sjain2015 avatar Nov 21 '18 13:11 sjain2015

Please see the documentation regarding the encoding to "~1" https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-stage-methodsetting.html#cfn-apigateway-stage-methodsetting-resourcepath. Hopefully this will solve your problem.

brettstack avatar Nov 27 '18 18:11 brettstack

It might be that you need to specify "/~1*" or "~1*".

brettstack avatar Nov 27 '18 19:11 brettstack