Removing the Plugin
How to safely remove the caching plugin without ghost billing.
If you remove the plugin from serverless.yml without disabling the cache first, the cache cluster continues running on AWS and you will be billed for it indefinitely.
Why is this necessary?
API Gateway cache clusters are provisioned resources that cost real money — see the official AWS API Gateway pricing page under "API caching" for the per-region rate. They are not part of your CloudFormation stack — they're managed via the UpdateStage API at deploy time.
When you remove a caching plugin and redeploy:
- CloudFormation doesn't know about the cache cluster → it stays running
- No plugin hooks fire → nothing disables it
- You get ghost billing until you manually disable it in the AWS console
The sls caching disable command solves this.
Safe Removal Procedure
Step 1: Disable the cache on AWS
sls caching disable --stage development
sls caching disable --stage production
# Repeat for each stage that has caching enabledStep 2: Edit serverless.yml
Remove the plugin, the config, and all endpoint caching:
plugins:
- - '@interlace/serverless-api-gateway-caching'
custom:
- interlaceCaching:
- enabled: true
- clusterSize: '0.5'
- ttlInSeconds: 300
functions:
getUser:
handler: src/handler.get
events:
- http:
path: /users/{id}
method: get
- caching:
- enabled: true
- cacheKeyParameters:
- - name: request.path.idStep 3: Deploy clean
sls deploy --stage development
sls deploy --stage productionStep 4: Uninstall the package
npm uninstall @interlace/serverless-api-gateway-cachingpnpm remove @interlace/serverless-api-gateway-cachingyarn remove @interlace/serverless-api-gateway-cachingbun remove @interlace/serverless-api-gateway-cachingWhat about sls remove?
If you're deleting the entire stack (not just removing the plugin), the cleanup happens automatically. Our before:remove:remove hook disables the cache cluster before CloudFormation deletes the API Gateway.
sls remove --stage development # cache is automatically disabled firstThe manual disable step is only needed when removing the plugin while keeping the service running.
Already have ghost billing?
If you've already removed a caching plugin (ours or the community one) without disabling the cache:
- Go to AWS Console → API Gateway → your API → Stages → your stage
- Under Settings, find Cache Settings
- Set Enable API cache to
false - Click Save Changes
Or use the AWS CLI:
aws apigateway update-stage \
--rest-api-id YOUR_API_ID \
--stage-name production \
--patch-operations op=replace,path=/cacheClusterEnabled,value=false \
--profile interlace