-1

My company has 2 Google Maps API keys that we have been using for several years. They started charging us for their use in June 2018. At that point and for several month afterwards, I could go to the Google Cloud Platform console and see the API keys listed, along with usage etc. Now when I go to the GCP console, it does not show those API keys. However, Google is still charging our credit card every month for their use.

I'm wondering what happened, and if it has happened to anyone else. If I could see the API keys, I could edit them, change their restrictions, etc.

1 Answers1

2

If you're confident that you're checking the correct project, you may wish to review your audit logs to see whether the API Key was deleted by one of the project's authenticated accounts:

For ${PROJECT}, the following should list API key-related actions:

PROJECT=[[YOUR-PROJECT]]

LOGNAME="projects/${PROJECT}/logs/cloudaudit.googleapis.com%2Factivity"
METHOD="google.api.apikeys.v1.ApiKeys"

gcloud logging read "logName=\"${LOGNAME}\" protoPayload.methodName:\"${METHOD}\"" \
--project=${PROJECT} \
--format="value(protoPayload.authenticationInfo.principalEmail,protoPayload.methodName,timestamp)"

I created then deleted an API key to confirm the behavior.

My logs show (abbreviated):

[me]    google.api.apikeys.v1.ApiKeys.DeleteApiKeys 2020-04-07T19:21:40.301Z
[me]    google.api.apikeys.v1.ApiKeys.PatchApiKey   2020-04-07T19:18:38.395Z
[me]    google.api.apikeys.v1.ApiKeys.CreateApiKey  2020-04-07T19:18:20.721Z
halfer
  • 18,701
  • 13
  • 79
  • 158
DazWilkin
  • 12,847
  • 5
  • 24
  • 48
  • Google provides a cross-platform Cloud SDK often called `gcloud` for the name of the command. See: https://cloud.google.com/sdk. You may use the filter from the command in the Cloud Console too: https://console.cloud.google.com/logging?project=${PROJECT} replacing the value of `${PROJECT}` – DazWilkin Apr 08 '20 at 23:06