A secret is confidential data such as a password or API key. Keep it out of source code and retrieve it at runtime using a compute resource’s identity and narrowly scoped permissions. Fetching a secret at startup—or after an authorization failure—can also support rotation without an outage. section 11.5.2
Choose a protection pattern that fits how the application runs:
- On cloud compute, give the server or container an identity authorized to read only the required secret. section 11.5.2
- On developer-focused hosting platforms, inject secrets through encrypted environment-variable settings during deployment instead. section 11.5.2
- For local development, remove hardcoded secrets and pass them at runtime through an environment variable; a .env file is one suggested pattern. section 11.8
Table 11.2 IAM Setup Basics Across Major Cloud Providers
|
Cloud Provider
|
Virtual Machines
|
Containers & Serverless
|
Core Terminology to Search
|
|
AWS
|
Attach an IAM Role via an EC2 Instance Profile.
|
Assign an IAM Role to the ECS Task Definition or use IRSA
for EKS.
|
IAM Roles, Instance Profiles
|
|
Azure
|
Enable a System-Assigned Managed Identity on the Virtual
Machine.
|
Assign a Managed Identity to the Azure Kubernetes Service
(AKS) pod or Container App.
|
Managed Identities
|
|
Google Cloud
|
Attach a dedicated Service Account to the Compute Engine
instance.
|
Use Workload Identity for GKE or attach a Service Account
to Cloud Run.
|
Service Accounts, Workload Identity
|
|
Alibaba Cloud
|
Attach a RAM Role to the ECS instance.
|
Use RRSA (RAM Roles for Service Accounts) for ACK.
|
RAM Roles, ECS Identity
|
|
Oracle Cloud
|
Configure an Instance Principal for the Compute instance.
|
Use Workload Identity for OKE (Oracle Kubernetes Engine).
|
Instance Principals, Dynamic Groups
|
Compare the compute-identity mechanisms named for virtual machines, containers, and serverless workloads across cloud providers. section 11.5.2



