0
0
GCPcloud~15 mins

Service account keys management in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Service account keys management
📖 Scenario: You are managing a Google Cloud project. You need to create and manage service account keys securely to allow applications to authenticate with Google Cloud services.
🎯 Goal: Build a script that creates a service account key, lists existing keys, and deletes a specified key to keep your project secure.
📋 What You'll Learn
Create a service account key for a given service account
List all keys for the service account
Delete a specific key by its ID
💡 Why This Matters
🌍 Real World
Managing service account keys is essential for securing access to Google Cloud resources by applications and services.
💼 Career
Cloud engineers and administrators regularly create, list, and delete service account keys to maintain security and compliance.
Progress0 / 4 steps
1
Create a service account key
Write a command to create a service account key for the service account with email my-service-account@my-project.iam.gserviceaccount.com and save the key to a file named key.json.
GCP
Need a hint?

Use the gcloud iam service-accounts keys create command with the --iam-account flag.

2
List all keys for the service account
Write a command to list all keys for the service account with email my-service-account@my-project.iam.gserviceaccount.com.
GCP
Need a hint?

Use the gcloud iam service-accounts keys list command with the --iam-account flag.

3
Delete a specific service account key
Write a command to delete the service account key with ID 123abc456def789ghi for the service account with email my-service-account@my-project.iam.gserviceaccount.com.
GCP
Need a hint?

Use the gcloud iam service-accounts keys delete command with the key ID and --iam-account flag.

4
Add a confirmation flag to the delete command
Modify the delete command to include the --quiet flag to avoid interactive confirmation prompts.
GCP
Need a hint?

Add --quiet at the end of the delete command.