API Gateway Caching
CLI Commands
Manage your API Gateway cache from the command line.
sls caching status
Show the current cache cluster state:
sls caching statusOutput:
[interlace-caching] --- Cache Status ---
[interlace-caching] Enabled: true
[interlace-caching] Size: 0.5 GB
[interlace-caching] Status: AVAILABLE
[interlace-caching] Stage: development
[interlace-caching] API ID: abc123xyzsls caching flush
Flush all cached responses for a stage:
sls caching flush
sls caching flush --stage production --region us-west-2Use flushOnDeploy: true in your config to flush automatically after every deploy:
custom:
interlaceCaching:
enabled: true
flushOnDeploy: truesls caching preview
Dry-run. Print every patch operation a sls deploy would apply, without calling AWS write APIs (updateStage / flushStageCache). Read-only AWS calls (getStage, REST API ID resolution) still happen.
sls caching preview
sls caching preview --stage productionOutput:
[interlace-caching] --- Cache Preview (dry-run) ---
[interlace-caching] REST API: abc123def4
[interlace-caching] Stage: production
[interlace-caching] Cluster: enabled
[interlace-caching] Size: 0.5 GB
[interlace-caching] Default TTL: 300s
[interlace-caching] Operations: 6 (would chunk into 1 UpdateStage call(s))
[interlace-caching]
[interlace-caching] replace /*/*/caching/enabled → false
[interlace-caching] replace /cacheClusterEnabled → true
[interlace-caching] replace /cacheClusterSize → 0.5
[interlace-caching] replace /~1users~1{id}/GET/caching/enabled → true
[interlace-caching] replace /~1users~1{id}/GET/caching/ttlInSeconds → 600
[interlace-caching] replace /~1users~1{id}/GET/caching/dataEncrypted → true
[interlace-caching]
[interlace-caching] No AWS write APIs were called. Run `sls deploy` to apply.Use this in CI gates, code review, or before applying breaking config changes in production.
sls caching disable
Fully disable the cache cluster on AWS. This is the safe offboarding command — run it before removing the plugin from serverless.yml:
sls caching disable
sls caching disable --stage productionOutput:
[interlace-caching] Disabling cache cluster for stage 'production'...
[interlace-caching] ✅ Cache cluster disabled successfully.
[interlace-caching]
[interlace-caching] You can now safely remove the plugin from your serverless.yml:
[interlace-caching]
[interlace-caching] 1. Remove "@interlace/serverless-api-gateway-caching" from plugins
[interlace-caching] 2. Remove the "interlaceCaching" section from custom
[interlace-caching] 3. Remove "caching" from function http events
[interlace-caching] 4. Run "sls deploy" to applySee the removal guide for the complete offboarding procedure.