Every cloud virtual machine that calls a cloud API needs an identity, and each of the four major providers gives that identity to the machine in its own way, through a role, a managed identity, a service account or an instance principal. This map lines up those mechanisms for Amazon Web Services (AWS), Microsoft Azure, Google Cloud and Oracle Cloud Infrastructure (OCI) so that security and identity teams working across more than one cloud can find the equivalent control quickly, ask the right questions of each platform team and avoid long-lived keys on compute hosts.
The focus is the security and identity angle: how a workload on a VM proves who it is, where its short-lived credentials come from, who else on the host can reach them, and how access is granted and revoked. Providers are listed in alphabetical order (AWS, Azure, Google Cloud, OCI) throughout, each gets the same depth, and nothing on this page ranks one provider above another. Every provider fact comes from that provider's own documentation, linked in each section and in the references.
This is an independent guide from NHI Mgmt Group, based on the public documentation of AWS, Microsoft, Google Cloud and Oracle as of November 2026. It is not sponsored or reviewed by any of these vendors. Product features change, so confirm settings against each vendor's current documentation.
Key takeaways
- All four providers offer a way for a VM workload to call cloud APIs without a stored access key: EC2 IAM roles through instance profiles, Azure managed identities, Google Cloud attached service accounts and OCI instance principals.
- In each model the credential is delivered on the host, usually through a link-local metadata endpoint, so anyone who can run code on the VM can usually act with the VM's permissions.
- The identity is a non-human identity in its own right. It needs an owner, a least privilege policy, an inventory entry and a review date, like any other service account.
- Defaults matter. Two of the documented models have a default identity or default behaviour (the Google Cloud default Compute Engine service account and the AWS choice of IMDSv1 or IMDSv2) that should be checked and tightened.
- Revocation works differently on each platform: change or replace the role binding, policy or group membership rather than trying to rotate a secret you never held.
Why compute identity is a non-human identity problem
A VM that reads from a bucket, writes to a queue or fetches a secret is a machine acting with delegated authority. Before platform identities existed, teams solved this by copying an access key or a key file onto the host, into an image or into application configuration. Those keys were long-lived, rarely rotated and often shared between environments. Each provider now documents a native alternative that hands the workload short-lived credentials tied to the machine itself.
That alternative removes the stored secret but does not remove the identity. The role, managed identity, service account or dynamic group still holds permissions, still appears in audit logs and can still be misused by anyone who gains code execution on the host. MITRE ATT&CK describes the misuse of the metadata interface as T1552.005 Cloud Instance Metadata API, a sub-technique of Unsecured Credentials, and the misuse of valid cloud identities as T1078.004 Cloud Accounts. Treating compute identities as first class NHIs, with ownership and review, is the practical defence.
The mapping table
The table lists, for each provider in alphabetical order, the documented mechanism and the setting names used in that provider's own documentation. It is a lookup aid, not a scorecard.
| Security and identity question | AWS (Amazon EC2) | Azure (Virtual Machines and other Azure hosts) | Google Cloud (Compute Engine) | OCI (Compute) |
|---|---|---|---|---|
| Workload identity for the VM | IAM role delivered through an instance profile | Managed identity, system-assigned or user-assigned | User-managed service account attached to the VM | Instance principal, grouped through a dynamic group |
| How many identities per VM | One IAM role per instance; one role can serve many instances | System-assigned: one per resource; user-assigned: can be shared across resources | One service account per VM; one account can be attached to several VMs | Each instance has its own identity; membership of dynamic groups set by matching rules |
| Credential type delivered | Temporary access key pair and session token | Microsoft Entra tokens obtained without managing credentials | Credentials of the attached service account, used through Application Default Credentials | Instance certificates, created, assigned and rotated automatically |
| Where the workload gets it | Instance Metadata Service (IMDS), with IMDSv2 session tokens available | Azure.Identity SDK or MSAL retrieves a token from Entra ID | Attached account credentials via client libraries and the gcloud CLI | Metadata endpoint, for example /opc/v1/identity/cert.pem |
| How access is granted | IAM policies attached to the role | Role assignments to the identity's service principal | IAM roles granted to the service account, combined with access scopes | Policy statements that name the dynamic group |
| Default or legacy behaviour to review | IMDSv1 and IMDSv2 both accepted by default | Choice between system-assigned and user-assigned | Default Compute Engine service account, possibly with the Editor role | compartment_inspect permission granted to all instance principals |
| How to revoke | Replace the instance profile or change the role's policies | Remove role assignments or detach or delete the identity | Change the attached account or its IAM roles | Change the dynamic group policy or remove the instance from the group |
AWS: IAM roles for Amazon EC2
According to the Amazon EC2 user guide on IAM roles, EC2 uses an instance profile as a container for an IAM role. An instance profile can contain only one role, and you can attach only one role to an instance, although the same role can be attached to many instances. When you create a role in the console an instance profile of the same name is created for you; with the CLI, API or SDKs you create them separately.
The application on the instance retrieves a set of temporary credentials and uses them, so no long-term key is stored on the host. AWS notes that EC2 role credentials are not subject to the maximum session duration configured on the role. If you change a role, the change is propagated to all instances that use it. To change the permissions of one instance, AWS says to replace its instance profile, and it does not recommend removing a role from an instance profile because there can be a delay of up to one hour before that change takes effect.
The same page describes a separate instance identity role that every instance has. Its credentials are present in instance metadata whether or not a feature that uses them is enabled, it has no trust policy, and AWS states it can be used only with specific services such as EC2 Instance Connect, GuardDuty Runtime Monitoring and AWS Systems Manager.
For the metadata endpoint itself, the IMDS configuration page explains that IMDSv2 uses session-oriented requests. A PUT request creates a token with a time to live of up to six hours, the token is valid only on the instance that created it, and PUT requests that carry an X-Forwarded-For header are rejected. By default the response to the PUT request has a hop limit of 1. By default an instance accepts IMDSv1, IMDSv2 or both, and you can configure it to accept only IMDSv2; with token usage set to required, requests without a valid token receive a 401 - Unauthorized error.
Security and identity points for AWS: require IMDSv2 on every instance, keep the hop limit at the default unless a documented container need exists, write least privilege policies for each role (AWS suggests IAM Access Analyzer can generate a policy from CloudTrail activity), and track which instance profiles carry which roles.
Azure: managed identities for Azure resources
The Microsoft Entra managed identities overview describes two types. A system-assigned identity is created as part of an Azure resource, shares that resource's life cycle and can only be associated with that single resource. A user-assigned identity is created as a stand-alone Azure resource, has an independent life cycle, must be explicitly deleted and can be associated with more than one resource. Microsoft states that user-assigned identities are the recommended type for Microsoft services.
Both types create a service principal in Microsoft Entra ID. Microsoft says that applications can use managed identities to obtain Entra tokens without managing any credentials, that the credentials are not even accessible to you, and that a managed identity replaces secrets such as access keys or passwords. Code obtains tokens with the Microsoft Authentication Library or the Azure.Identity SDK. The overview names Azure Virtual Machines, Virtual Machine Scale Sets, Service Fabric clusters, Azure Kubernetes clusters and any app hosting platform supported by Azure as resources that can use a managed identity, and it links a full list of supporting services for anything not named.
Security and identity points for Azure: decide deliberately between system-assigned and user-assigned identities, because a shared user-assigned identity spreads its permissions to every resource it is attached to, and its independent life cycle means it can outlive the workload unless someone deletes it. Grant role assignments at the narrowest scope that works, and include managed identities in the same service principal inventory and access reviews as other Entra workload identities.
Google Cloud: service accounts on Compute Engine
The Compute Engine service accounts page explains that a VM can have only one service account attached, the same account can be attached to several VMs, and changes to that account affect all of them. Only user-managed service accounts can be attached, at creation or later. Applications authenticate with the attached account without embedding secret keys or user credentials in the instance, image or code, and Google recommends Application Default Credentials. The guide to creating VMs with service accounts states that Google recommends attaching a user-managed service account to a VM for applications that call Google Cloud APIs, and then granting that account IAM roles.
Two settings need attention. Access scopes are described by Google as the legacy method of specifying authorisation for a VM; access is granted only when both the service account's IAM roles and the instance's access scopes allow it, and the recommended practice is to set the cloud-platform scope and control access through IAM roles. Second, projects with the Compute Engine API enabled get a default service account in the format [email protected]. It is attached by default to VMs created with the gcloud CLI or the console unless you override it, and depending on organisation policy it may be granted the Editor role; Google strongly recommends disabling that automatic grant.
Security and identity points for Google Cloud: create a dedicated user-managed service account per workload, override the default account at VM creation, control access through IAM roles rather than scopes, and review any project where the default account still holds a broad role.
OCI: instance principals and dynamic groups
The OCI page on calling services from an instance defines instance principals as the IAM feature that lets instances act as authorised principals. Each compute instance has its own identity and authenticates using certificates that are automatically created, assigned to the instance and rotated, so you do not need to distribute or rotate credentials on hosts. Oracle states the certificate is rotated multiple times each day and that the rotation frequency cannot be changed.
Instances are grouped through dynamic groups, created at tenancy level, whose membership is set by matching rules; rules can include or exclude instances by compartment or instance OCID. Access is then granted with policy statements of the form Allow dynamic-group <name> to <verb> <resource-type> in compartment <name>. To revoke access, Oracle says you can change the policy on the dynamic group or remove the instance from the group. The certificate can be read from the metadata service at http://169.254.169.254/opc/v1/identity/cert.pem.
Oracle is explicit about the host boundary: any user who can SSH to the instance automatically inherits the privileges granted to it, and the certificates are accessible to all users on the instance. All instance principals also receive the compartment_inspect permission, which cannot be revoked. The Audit service records the instance OCID as the principalId of each API call.
Security and identity points for OCI: write tight matching rules so that only intended instances join a dynamic group, scope policies to a compartment rather than the tenancy where possible, and restrict who can log in to instances whose groups hold powerful permissions.
Serverless functions and app hosting
Function and app hosting services sit on top of the same identity systems. Of the pages used for this map, only the Azure overview names app hosting platforms directly, stating that any app hosting platform supported by Azure can use a managed identity. For AWS, Google Cloud and OCI function and hosting services, this page makes no service-specific claims; confirm the identity model in each provider's documentation for the specific service before you rely on it. The same questions apply to every one of them: which identity runs the code, who can change the code that runs under it, what that identity can reach, and whether any static key has been added to environment variables as a shortcut.
Serverless code often has a shorter path from a code change to production than VM workloads. That makes deployment permissions part of the identity question: anyone who can update a function can, in effect, act as the function's identity.
The shared host boundary
Across all four documented models the credential reaches the workload through the host. AWS serves temporary credentials through IMDS, OCI serves instance certificates through its metadata endpoint, and the Google Cloud and Azure SDKs obtain tokens from the environment where the code runs. The practical consequence is the one Oracle states plainly: whoever can run code on the machine can act with the machine's permissions.
That shifts several controls from identity teams to platform teams. Server-side request forgery in a web application on the VM, a compromised dependency, or an over-broad SSH or remote desktop group can each turn into cloud API access. Defences include requiring session-oriented metadata access where it is offered, limiting interactive access to hosts, running only one workload per identity, and detecting API calls from the VM's identity that come from outside the VM.
Governance model for compute identities
Whatever the provider, a workable governance model for compute identities includes the same elements. Every role, managed identity, service account and dynamic group should have a named owner and a stated purpose. Permissions should be written for the workload, not copied from a template. Identities should be created and removed by the same pipeline that creates and removes the compute, so that orphaned identities do not accumulate. Reviews should look at actual use: AWS documents generating policies from CloudTrail activity, and OCI documents that its Audit service records the instance OCID as the principal; check each provider's logging documentation for the equivalent field.
Map each provider's controls to your control framework once and reuse the mapping. NIST SP 800-53 AC-6 Least Privilege covers the scope of each identity's permissions and IA-5 Authenticator Management covers the shift from stored keys to platform-issued credentials.
Common failure patterns
- Access keys or key files placed on VMs or in images even though a native identity mechanism is available.
- One broad role, managed identity or service account shared by many unrelated workloads, so a compromise of any host exposes all of them.
- The Google Cloud default Compute Engine service account left attached with a broad role.
- AWS instances still accepting IMDSv1 requests, or with the hop limit raised without a documented need.
- OCI dynamic group matching rules written at tenancy scope so that more instances join than intended.
- User-assigned Azure identities left in place after the resources that used them were deleted.
- Broad interactive access to hosts whose identities hold administrative cloud permissions.
- Deployment rights to functions and hosted apps granted more widely than the permissions of the identity they run as.
Practitioner checklist
- Inventory every compute identity in each cloud: EC2 instance profiles and roles, Azure managed identities, Google Cloud attached service accounts and OCI dynamic groups.
- Remove stored access keys and key files from VMs, images and app configuration where a native identity can replace them.
- On AWS, require IMDSv2 and keep the response hop limit at 1 unless a documented need exists.
- On Google Cloud, override the default Compute Engine service account and disable the automatic Editor grant.
- On OCI, scope dynamic group matching rules and policies to compartments.
- On Azure, record why each identity is system-assigned or user-assigned, and delete unused user-assigned identities.
- Give each workload its own identity with least privilege permissions, and review them against audit log activity where the provider records it.
- Restrict SSH, remote desktop and deployment access to the people who should hold the workload's cloud permissions.
- Alert on use of a compute identity from outside its expected hosts.
Standards and references
- AWS: IAM roles for Amazon EC2
- AWS: Configure the Instance Metadata Service options
- Microsoft: What are managed identities for Azure resources?
- Google Cloud: Service accounts on Compute Engine
- Oracle: Calling services from an instance
- MITRE ATT&CK: T1552.005 Cloud Instance Metadata API
- NIST: SP 800-53 Rev. 5
Related NHI Mgmt Group resources: Cloud Workload Identity Buyer's Guide · Cross-cloud workload identity federation · Containers vs Serverless Security