I leaked my API key, what do I do? (pushed AWS key to GitHub)

A checklist in the order that limits damage: revoke, check for use, clean up, then prevent the next one.

You leaked an API key: you pushed an AWS key to GitHub, pasted a token into a chat, or it showed up in a build log. This is common and it is recoverable. Work through the steps in order. The first one is the only urgent one.

1. Revoke or rotate the key at the provider

Do this before you delete the commit or the message. It is widely reported that bots scrape public GitHub pushes for credentials within minutes, so assume the key was copied the moment it became public. Deleting the evidence does nothing to a copy someone already has. Revoking the key does.

Create the replacement, deploy it, then kill the old one. If the key is public and has real permissions, kill it first and accept the outage.

For anything else, look for "API keys", "tokens" or "credentials" in the provider's account settings. Database passwords, signing secrets and webhook secrets all count.

2. Check whether the key was used

Look at the provider's audit log for the window between the leak and the revocation.

If you find activity you cannot explain, contact the provider's support and tell your team. Anything an attacker created with the key (users, keys, tokens) survives the key's deletion and has to be removed separately.

3. Clean up the places the key still lives

The key is dead now, so this is tidying, not firefighting. It still matters: scanners keep flagging dead keys, and people copy old values back into use.

4. Make the next leak harder