Gestire secret e configurazione nel cloud
Inietti le credenziali in sicurezza durante l'esecuzione.
Gestire secret e configurazione nel cloud è una lezione MLOps Academy gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento MLOps Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso MLOps Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
Keep Secrets Out of Images
A database password baked into an image leaks to anyone who pulls it. Inject secrets at runtime instead, never at build time. 🔐
Config vs Secrets
Plain settings like a model path are config. Sensitive values like API keys are secrets. Both stay outside the image, handled differently.
Env Vars for Plain Config
Non-sensitive settings ride in as environment variables at deploy time. The same image then behaves differently in staging and production.
gcloud run deploy model-api --set-env-vars MODEL_STAGE=ProductionRead Them in Code
Your app reads those values with os.environ. Provide a sensible default so the code still runs locally without every variable set.
stage = os.environ.get("MODEL_STAGE", "Staging")Use a Secret Manager
Real secrets belong in a secret manager like AWS Secrets Manager or Google Secret Manager. It encrypts, versions, and audits access.
Reference, Do Not Embed
You attach a secret by reference, and the platform mounts the value at runtime. The secret never appears in your deploy command.
gcloud run deploy model-api --set-secrets API_KEY=api-key:latestMount as Env or File
A secret can land as an environment variable or a mounted file. Certificates and long keys are often cleaner read from a file path.
Grant Least Privilege
Give the service account only the secrets it truly needs. This least privilege rule shrinks the blast radius if a token ever leaks.
Rotate Without Redeploying
Pin secrets to a version like latest, then rotate by adding a new version. New instances pick it up with no image rebuild needed.
Never Log a Secret
Logs are stored and widely readable, so a printed key is as good as public. Scrub secrets from output and from error traces alike.
One Image, Many Environments
With config and secrets external, a single image runs everywhere. You change behavior by swapping variables, not by rebuilding.
Quick Check
Let us check the safe way to handle an API key.
Recap
You split config from secrets, injected both at runtime, used a secret manager, and rotated safely. One image now runs anywhere. 🔑
Domande Frequenti
La lezione «Gestire secret e configurazione nel cloud» è gratuita?
Sì — il testo completo di «Gestire secret e configurazione nel cloud» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso MLOps Academy, passa a CoddyKit PRO. Il corso MLOps Academy include 4 lezioni in totale.
Cosa imparerò in «Gestire secret e configurazione nel cloud»?
Inietti le credenziali in sicurezza durante l'esecuzione. Eserciti MLOps Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare MLOps Academy?
Non è richiesta alcuna esperienza precedente. MLOps Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «Gestire secret e configurazione nel cloud»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione MLOps Academy?
Sì. Ogni lezione MLOps Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Inviare l'immagine a un registry
- Distribuire su un runtime per container serverless
- Configurare autoscaling e concorrenza
- Gestire secret e configurazione nel cloud