When this happens?
When you push to an existing environment to update the api, you get an error saying "API key not found"
Because your API key has expired. Did you forget to set the expiration to unlimited or renew it?
How to Fix it
These manual steps can help to recover into a stable state from CFN point of view, from that point
APIKeyExpirationEpoch can be used as documented.
There is a solution to recover from this by doing a change set deployment on the nested stack of the API.
Here are the steps:
- Go to CloudFormation Console and turn on nested stacks (keep in mind this link is for region
us-east-1so select yours if different)
- Locate and select the API nested stack which failed to update due to the removed API key, it should have the same prefix as the root stack followed by the API name
- Click on the Update button
- Select the "Update nested stack" option and click "Update stack"
- Select the "Use current template" option and click next
- Set APIKeyExpirationEpoch to -1
- Set CreateAPIKey to 0
- Click "Next"
- Click "Next" on the "Configure stack options screen"
- Check the acknowledgement checkbox(es) in the Capabilities section
After the Changes are calculated you should see a "Remove" action for the "GraphQLAPIKey", if that's the case, proceed.
- Click "Update stack"
The API now should be in an updatable state.