Jane Doe
Pro Plan
Managing sensitive information like API keys, passwords, and certificates is a critical part of building secure cloud applications. Google Cloud Secret Manager is a fully managed service that helps you store, manage, and access secrets securely in Google Cloud Platform (GCP).
Secret Manager provides a central place to store secrets and control access using IAM policies. It allows you to version secrets, audit access, and integrate with other GCP services, making secret management simple and secure.
gcloud secrets create my-secret --replication-policy="automatic"gcloud secrets versions add my-secret --data-file="my-secret.txt"With this setup, your Cloud Run service will have access to secrets as environment variables, and you can rotate secrets without redeploying your containers.
steps: # build step... - name: "gcr.io/google.com/cloudsdktool/cloud-sdk:slim" id: Deploy entrypoint: gcloud args: - run - services - update - $_SERVICE_NAME - "--platform=managed" - >- --image=$_AR_HOSTNAME/$_AR_PROJECT_ID/$_AR_REPOSITORY/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA - >- --labels=managed-by=gcp-cloud-build-deploy-cloud-run,commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID - "--region=$_DEPLOY_REGION" - "--quiet" - "--update-secrets=AUTH_SECRET_KEY=dev-AUTH_SECRET_KEY:latest" # Inject secret as runtime ENV var - "--update-secrets=OPENAI_API_KEY=dev-OPENAI_API_KEY:latest" # Inject secret as runtime ENV var - "--update-secrets=PINECONE_API_KEY=dev-PINECONE_API_KEY:latest" # Inject secret as runtime ENV var - "--update-secrets=POSTGRES_PASSWORD=dev-POSTGRES_PASSWORD:latest" # Inject secret as runtime ENV var - "--update-secrets=SENDGRID_API_KEY=dev-SENDGRID_API_KEY:latest" # Inject secret as runtime ENV varimages: # image definition...options: # options...tags: # tags...
Google Cloud Secret Manager provides a secure, scalable, and integrated solution for managing secrets in cloud applications. By centralizing secret storage and access, you can improve your security posture, simplify secret rotation, and ensure compliance with best practices and regulatory requirements.