Join our Newsletter — 33% off our NHI Course
Home› Guides› Cloud Shell and Console Session Security: Controls for…
Guide Cloud Security

Cloud Shell and Console Session Security: Controls for AWS, Azure and Google Cloud

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 8 November 2026 15 min read
On this page

Browser-based cloud shells give anyone with a console session an authenticated command line, persistent storage and outbound internet access, which makes a stolen console session far more dangerous and creates an exfiltration path that many organisations never review. AWS CloudShell, Azure Cloud Shell and Google Cloud Shell are convenient for administrators, but they inherit the signed-in identity's permissions, keep files in a home directory across sessions and sit outside most endpoint controls. This guide explains how each shell handles credentials, storage, networking and session limits, the risks that follow, and the controls each provider documents to restrict, isolate, log and disable the service. It is written for cloud security engineers, platform teams and identity architects. Platforms are listed alphabetically; order is not a ranking. Provider documentation was checked on 8 November 2026 and limits change, so confirm current values before relying on them.

Key takeaways

  • The shell is the console identity with a terminal attached. AWS documents that CloudShell uses the IAM credentials used to sign in to the console; Azure Cloud Shell authenticates automatically; Google Cloud Shell prompts the user to authorise credentials on first use of an API. Whoever holds the console session holds the shell.
  • Home directories persist and are a credential hiding place. AWS keeps 1 GB per Region for 120 days after last use, Azure mounts a 5 GB Azure Files share if a storage account is chosen, and Google keeps a 5 GB home directory until 120 days without access. Keys and tokens saved there outlive the session.
  • Outbound internet means a data path. AWS warns that internet access creates a risk of data export. All three shells can reach the internet by default, and all three offer some form of upload and download through the browser.
  • Each provider offers a different control set. AWS uses IAM actions such as cloudshell:PutCredentials and cloudshell:GetFileUploadUrls; Azure offers virtual network isolation and network blocking of *.console.azure.com; Google offers an Admin console Cloud Shell access setting and ephemeral mode.
  • Protect the session first. Phishing-resistant MFA, short console sessions, conditional access and privileged access workstations reduce the chance that an attacker ever reaches a shell.

How the three cloud shells work

All three services provide a provider-managed Linux environment per user, launched from the web console, preloaded with the provider's CLI. The differences that matter for security are summarised below, using each provider's own documentation.

AspectAWS CloudShellAzure Cloud ShellGoogle Cloud Shell
CredentialsUses the IAM credentials used to sign in to the console, forwarded by cloudshell:PutCredentialsAuthenticates automatically for Azure CLI and Azure PowerShellPrompts the user to authorise access on first use of an API or tool needing credentials
Persistent storage1 GB per Region in $HOME; kept 120 days after last session in that Region5 GB Azure Files share in a storage account (clouddrive), or no storage account; $HOME without storage is deleted at session end5 GB home directory, not expandable; deleted after 120 days without access
Idle timeout20 to 30 minutes (10 minutes in AWS GovCloud (US))20 minutes without interactive activityVM terminates after 40 minutes of inactivity; non-interactive sessions end after 40 minutes
Maximum sessionAbout 12 hoursNot stated in the pages checked12 hours
NetworkOutbound public internet; no inbound ports, no public IP; optional VPC environmentsMicrosoft-managed container by default; optional deployment into a customer virtual network using Azure RelayShort-lived Google-managed VM not shown in your projects
Concurrency and quotasUp to 10 shells per Region per account; monthly Regional quota20 concurrent users per tenant50 hours per week by default
Ephemeral optionVPC environments have no persistent storageNo storage account required optionEphemeral mode: files lost when the session ends

Availability notes. AWS: CloudShell storage is free at 1 GB per Region; VPC environments are limited to two per IAM principal. Azure: the storage account and, for virtual network isolation, Azure Relay are billed. Google: the 50-hour weekly quota is the default, and Google Workspace for Education blocks Cloud Shell for all users by default on an age basis.

Threats and risks

RiskHow it arisesATT&CK v20
Session hijack becomes command executionA stolen console cookie or adversary-in-the-middle phishing gives the attacker the console, and the shell gives them the CLI with the same permissionsT1539 Steal Web Session Cookie; T1078.004 Cloud Accounts
Credentials left in the home directoryUsers save access keys, service account key files, kubeconfig files or tokens in $HOME, which persists across sessionsT1552.001 Credentials In Files
Persistence through startup filesGoogle runs $HOME/.customize_environment as root at boot, and shell profiles such as .bashrc run in every shell; a modified file executes on the victim's next sessionTreat as unauthorised change to user environment
Data exportBrowser upload and download, or outbound internet from the shell to attacker storageExfiltration over web services
New long-lived credentialsAn attacker in the shell creates access keys or service account keys for persistenceT1098.001 Additional Cloud Credentials
Token theft from the shellTokens available inside the environment are copied and reused elsewhereT1528 Steal Application Access Token
Bypass of network controlsThe shell runs outside corporate egress filtering and endpoint monitoring by defaultVisibility gap rather than a technique

The common thread is identity. A cloud shell does not add permissions, but it removes friction: an attacker who would otherwise need to install tools or extract tokens from a browser can run the CLI directly. See the Session Hijacking and Cookie Theft Guide.

AWS CloudShell controls

  • Launch permissions: launching requires cloudshell:CreateEnvironment, cloudshell:CreateSession, cloudshell:GetEnvironmentStatus and cloudshell:StartEnvironment. AWS offers the AWSCloudShellFullAccess managed policy and suggests building custom policies from the CloudShellPolicy template. It notes that AdministratorAccess and PowerUserAccess style policies also allow CloudShell.
  • Deny entirely: a Deny on cloudshell:* blocks the service for the principals it applies to. Apply it through a service control policy in AWS Organizations to cover whole OUs; see the AWS Organizations and SCPs Guide.
  • Block browser file transfer: deny cloudshell:GetFileDownloadUrls and cloudshell:GetFileUploadUrls. AWS states plainly that users can still transfer files with clients such as wget, so this reduces casual transfer, not determined exfiltration.
  • Stop credential forwarding: deny cloudshell:PutCredentials so the console credentials are not forwarded; users must then configure credentials themselves inside the shell. Use this where shells are allowed only for low-privilege tasks.
  • VPC environments: run CloudShell inside your own VPC so traffic follows your routing and egress controls. AWS documents no persistent storage for VPC environments and no browser upload or download.
  • Logging: CloudTrail records CloudShell API calls with event source cloudshell.amazonaws.com, including createEnvironment, createSession, putCredentials, getFileUploadUrls and getFileDownloadUrls. The CLI calls made from the shell appear under each target service's events, not as CloudShell events. See the AWS CloudTrail Guide.

Azure Cloud Shell controls

  • Block at the network: Microsoft documents restricting access to *.console.azure.com (or *.console.azure.us in US Government) to stop connections, while noting this does not cover all entry points such as VS Code for the Web and Windows Terminal; blocking every entry point in a tenant needs a support ticket.
  • Virtual network isolation: deploying Cloud Shell into a customer virtual network lets administrators manage resources that have only private IP addresses, keeps the storage account free of public access, and can restrict Cloud Shell use to the virtual network. Azure Relay carries the browser connection, with one hybrid connection per administrator per session, closed when the session ends. See the Azure Virtual Network Security Guide.
  • Storage choice: users choose between mounting a storage account (clouddrive, persistent) and no storage account. Files in clouddrive persist and are visible in the Storage browser; with no storage account, $HOME is deleted when the session ends. Treat Cloud Shell storage accounts as sensitive and apply the controls in the Azure Storage Security Guide.
  • Azure Policy interaction: a policy that denies Microsoft.Storage/storageAccounts/write causes a 403 RequestDisallowedByPolicy when a first-time user tries to create Cloud Shell storage, which can be used deliberately to force the no-storage option.
  • Personal data reset: resetting user settings ends the session and unmounts the storage account, but Microsoft notes the Azure file share is not deleted. Include those shares in leaver and data retention processes.
  • Logging: activity performed with Azure CLI or PowerShell from the shell appears in the Azure Activity Log under the user's identity. See the Azure Monitor, Activity Log and Diagnostic Settings Guide.

Google Cloud Shell controls

  • Admin disable: in the Google Admin console, Cloud Shell settings under Google Cloud Platform let administrators turn off Cloud Shell access, or turn it off for specific users through an access group.
  • Ephemeral mode: starts faster and discards files created in the session, removing the persistent home directory risk for users who do not need it.
  • Startup script awareness: $HOME/.customize_environment runs as root when the VM boots. Review it, together with shell profiles, during incident response, because it is a natural persistence point.
  • Home directory lifecycle: the 5 GB home directory is deleted only after 120 days without access, and deletion is permanent. Users can reset by deleting $HOME and restarting, which provisions a new VM.
  • Acceptable use: Google prohibits coin mining and network scanning from Cloud Shell, and violations can lead to Cloud Shell being disabled for the account. Alerts from Google about such use on a corporate account should be treated as a possible compromise.
  • Logging: API calls made with gcloud from the shell appear in Cloud Audit Logs under the user's principal. See the Google Cloud Audit Logs and Log Sinks Guide.

Where identity fits

Cloud shells are an identity problem with a terminal on top. The controls that matter most sit in the identity layer.

Deciding policy: allow, restrict or disable

OptionWhen it fitsTrade-off
Disable for all usersAdministration is done from managed workstations or a bastion; regulated environmentsAdministrators lose a convenient break-fix tool; make sure break-glass procedures do not depend on it
Allow for a named admin group onlyMost organisations; platform teams need it, business users do notRequires group maintenance and periodic review
Allow with isolation (AWS VPC environments, Azure virtual network isolation, Google ephemeral mode)Shell use is common and egress or storage is the main concernExtra setup and, on Azure, Relay and storage cost; slower start-up
Allow with transfer limitsLow-risk accounts, sandboxes, trainingTransfer limits are bypassable; AWS notes wget still works

Small organisations often rely on cloud shells because they lack managed admin workstations; in that case keep them but enforce phishing-resistant MFA, ephemeral or no-storage options and a ban on storing keys. Large organisations should restrict shells to an admin group, route them through private networking where offered, and alert on use by anyone else.

Implementation steps

  1. Measure current use. Query CloudTrail for eventSource cloudshell.amazonaws.com, review Azure sign-in and Activity Log data for portal-originated CLI activity, and check Google Admin settings and audit logs. List who uses shells and why.
  2. Agree the policy per platform. Choose disable, admin-only or isolated, and document the reason and owner.
  3. Pilot restrictions. AWS: attach the Deny policies (transfer, PutCredentials or cloudshell:*) to a pilot group before an SCP. Azure: pilot virtual network isolation with one admin team, or block *.console.azure.com from a test network segment. Google: apply the Cloud Shell access setting to a pilot group.
  4. Roll out in rings. Expand from pilot to all non-admin users, then to admins as isolated options mature.
  5. Clean up stored data. Ask users to remove credentials from shell home directories; for Azure, inventory Cloud Shell storage accounts and file shares; for leavers, include shell storage in deprovisioning.
  6. Add detections. See Detection and measurement below.
  7. Roll back safely. Each control is reversible: detach the IAM policy or SCP statement, remove the network block, or re-enable the Google setting for a group. Keep the change records so rollback is quick during an incident that needs shell access.

Detection and measurement

  • Use by unexpected principals: alert on CloudTrail createSession or createEnvironment by principals outside the approved admin group; equivalent CLI activity originating from Azure or Google portal shells by non-admin users.
  • File transfer events: alert on getFileUploadUrls and getFileDownloadUrls, especially after a new or unusual sign-in. AWS supports an EventBridge pattern with source aws.cloudshell and eventSource cloudshell.amazonaws.com.
  • Credential creation from a shell: correlate CreateAccessKey or service account key creation with a recent shell session for the same principal.
  • Sign-in risk then shell use: a risky or new-location console sign-in followed quickly by shell use and permission changes is a strong compromise signal.

Metrics:

  • Number of principals able to launch a cloud shell, per platform, against the approved list.
  • Percentage of shell sessions by principals with phishing-resistant MFA.
  • File transfer events per month and the share investigated.
  • Credential files found in shell home directories or Cloud Shell file shares during reviews (target zero).
  • Mean time to detect shell use by an unapproved principal.

Common failure patterns

  • Assuming the shell is sandboxed from production. It carries the user's full permissions; an administrator's shell is an administrator.
  • Treating transfer blocking as data loss prevention. AWS itself notes wget still works. Use network isolation where egress matters.
  • Forgetting persistent storage at offboarding. Azure file shares survive a settings reset, and AWS and Google home directories persist for 120 days after last use.
  • Blocking only one Azure entry point. Blocking *.console.azure.com leaves VS Code for the Web and Windows Terminal; Microsoft says a support ticket is needed to block all entry points.
  • No alerting on shell activity. CloudShell events are logged by default in CloudTrail event history, but few teams build rules for them.
  • Running automation in a personal shell. Scripts that depend on one person's session break when they leave and blur accountability; move them to pipelines with workload identities.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev. 5AC-17 Remote Access; AC-12 Session Termination; AC-2 Account Management; AU-2 Event Logging; SC-7 Boundary ProtectionShells are remote administrative access with sessions, accounts, logs and network boundaries
NIST CSF 2.0PR.AA-05 Access permissions defined, managed, enforced and reviewed; PR.PS-04 Log records generated for continuous monitoringRestricting who can launch shells and logging their use
CIS Controls v8.1Control 5 Account Management; Control 6 Access Control Management; Control 8 Audit Log ManagementAdmin-only access, MFA and log review
ISO/IEC 27001:2022 Annex A8.2 Privileged access rights; 8.15 Logging; 8.18 Use of privileged utility programsA cloud shell is a privileged utility
MITRE ATT&CK v20T1539, T1078.004, T1552.001, T1098.001, T1528Threats in the risk table

Practitioner checklist

  • Inventory who can launch cloud shells on AWS, Azure and Google Cloud, and compare with an approved admin list.
  • Choose disable, admin-only or isolated mode per platform and document the owner.
  • AWS: apply Deny statements for cloudshell:* (non-admins), file transfer and, where needed, cloudshell:PutCredentials; consider VPC environments.
  • Azure: decide on virtual network isolation; block *.console.azure.com where shells are not allowed and raise a support request to cover all entry points.
  • Google: set Cloud Shell access in the Admin console by group and promote ephemeral mode.
  • Require phishing-resistant MFA and managed devices for console access.
  • Ban storing access keys, service account keys and kubeconfig credentials in shell home directories, and review for them.
  • Build alerts for shell use by unapproved principals, file transfers and credential creation after shell sessions.
  • Include Cloud Shell storage in leaver processes and data retention.
  • Check startup files (.bashrc, .customize_environment) during incident response.

Standards and references

Related NHI Mgmt Group resources: AWS Security Guide · Microsoft Azure Security Guide · Google Cloud Security Guide · Session Hijacking and Cookie Theft Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 8 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.