Service account key rotation  |  IAM Documentation  |  Google Cloud (2024)

Service account keys are private keys that let youauthenticate as a service account.Key rotation is the process of replacing your existing keys with new keys andthen invalidating the replaced keys. We recommend that you routinelyrotate all keys that you manage, including your service account keys.

Rotating service account keys can help reduce the risk posed by leaked or stolenkeys. If a key is leaked, it might take bad actors days or weeks to discover thekey. If you regularly rotate your service account keys, there's a higher chancethat the leaked keys will be invalid by the time a bad actor gets them.

Having an established process for rotating service account keys also helps youact quickly if you suspect that a service account key has been compromised.

How often to rotate keys

We recommend rotating your keys at least every 90 days to reducethe risk posed by leaked keys.

If you believe that a service account key has been compromised, we recommendthat you rotate it immediately.

Key rotation process

To rotate service account keys, do the following:

  1. Identify the service account keys that need to be rotated.
  2. Create new keys for the same service accounts.
  3. Replace the existing keys with the new keys across all applications.
  4. Disable the replaced keys and monitor the applications to confirm that theywork as expected.
  5. Delete the service account keys that were replaced.

You can complete these steps by using a centralized secret management service,or by using a custom notification system.

Centralized secret management service

Many centralized secret management services, like HashiCorp Vault, provide automatic secret rotation. You can use these servicesto store and rotate your service account keys.

We don't recommend using Google Cloud's Secret Manager to storeand rotate service account keys. This is because, to accessSecret Manager secrets, your application needs an identity thatGoogle Cloud can recognize. If your application already has an identitythat Google Cloud can recognize, then your application can use thatidentity to authenticate to Google Cloud instead of using a serviceaccount key.

The same concept applies for other cloud-based secret management services, likeAzure KeyVault and AWS Secret Manager. If an application already has an identitythat these cloud providers can recognize, your application would be able to usethat identity to authenticate to Google Cloud instead of using a serviceaccount key.

Custom notification system

Another approach to service account key rotation is to create a system thatsends notifications when keys need to be rotated. For example, you could createa system that sends alerts when it detects keys that were created more than90 days ago.

First, you need to identify the keys that need to be rotated. To identify thesekeys, we recommend using Cloud Asset Inventory to search for all service accountkeys that were created before a certain time.

For example, the following command lists all service account keys that werecreated before 2023-03-10 00:00:00 UTC in the organization with the ID123456789012:

gcloud asset search-all-resources \ --scope="organizations/123456789012" \ --query="createTime < 2023-03-10" \ --asset-types="iam.googleapis.com/ServiceAccountKey" \ --order-by="createTime"

To learn more about searching resources in Cloud Asset Inventory, see Searchingresources.After identifying the keys that need to be rotated, you can send outnotifications to the appropriate teams.

When someone is notified to rotate a key, they should do the following:

  1. Create a new key for the same service account.
  2. Replace the existing key with the new key across all applications.
  3. Disable the key that they replaced and monitor theapplications to confirm that they work as expected.
  4. After they confirm that the applications are working as expected, delete thereplaced key.

Expiring service account keys

We don't recommend using expiring service account keys for key rotation. This isbecause expiring keys can cause outages if they aren't rotated properly. Formore information about the use cases for expiring service account keys, seeexpiry times for user-managed keys.

What's next

Service account key rotation  |  IAM Documentation  |  Google Cloud (2024)
Top Articles
Why students at prestigious high schools still cheat on exams
Top 8 Highest Paying Companies Worldwide in 2024
Knoxville Tennessee White Pages
Is Sam's Club Plus worth it? What to know about the premium warehouse membership before you sign up
Cold Air Intake - High-flow, Roto-mold Tube - TOYOTA TACOMA V6-4.0
Wizard Build Season 28
Readyset Ochsner.org
Apex Rank Leaderboard
Elden Ring Dex/Int Build
Atrium Shift Select
Skip The Games Norfolk Virginia
Oppenheimer & Co. Inc. Buys Shares of 798,472 AST SpaceMobile, Inc. (NASDAQ:ASTS)
Elizabethtown Mesothelioma Legal Question
Missing 2023 Showtimes Near Landmark Cinemas Peoria
Sony E 18-200mm F3.5-6.3 OSS LE Review
Gino Jennings Live Stream Today
Munich residents spend the most online for food
Tamilrockers Movies 2023 Download
Katherine Croan Ewald
Diamond Piers Menards
The Ultimate Style Guide To Casual Dress Code For Women
Site : Storagealamogordo.com Easy Call
Is Windbound Multiplayer
Filthy Rich Boys (Rich Boys Of Burberry Prep #1) - C.M. Stunich [PDF] | Online Book Share
Integer Division Matlab
Sandals Travel Agent Login
Horn Rank
Ltg Speech Copy Paste
Random Bibleizer
Craigslist Fort Smith Ar Personals
The Clapping Song Lyrics by Belle Stars
Poe T4 Aisling
R/Sandiego
Kempsville Recreation Center Pool Schedule
Rogold Extension
Beaver Saddle Ark
Log in or sign up to view
A Man Called Otto Showtimes Near Amc Muncie 12
Powerspec G512
Saybyebugs At Walmart
2007 Jaguar XK Low Miles for sale - Palm Desert, CA - craigslist
Miami Vice turns 40: A look back at the iconic series
Love Words Starting with P (With Definition)
Tlc Africa Deaths 2021
Youravon Com Mi Cuenta
Nope 123Movies Full
Kushfly Promo Code
Diario Las Americas Rentas Hialeah
Game Akin To Bingo Nyt
Marion City Wide Garage Sale 2023
Latest Posts
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 5571

Rating: 4.6 / 5 (76 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.