Ace Cloud Interviews
Home/AWS Tutorial/CloudShell
🛠️

AWS Developer Tools & CI/CD

CloudShell

Instant browser-based shell with AWS CLI, Python, and common tools pre-installed

AWS CloudShell is a browser-based shell environment that launches instantly with the AWS CLI, Python, Node.js, and common Linux tools pre-installed, and automatically authenticates as the currently logged-in IAM identity - no credentials to configure. It is designed for quick operational tasks, scripting, and CLI exploration directly from the AWS Management Console.

What CloudShell Provides and How It Works

CloudShell gives you a terminal session that inherits the credentials of your current console session. There is nothing to provision - it is available in seconds from the console toolbar.

FeatureDetails
AuthenticationInherits current IAM identity from console session - no setup
Pre-installed toolsAWS CLI v2, Python 3, Node.js, git, jq, pip, npm, bash, vim, nano
Persistent storage1 GB of persistent home directory storage per region
Session durationSessions time out after 20 minutes of inactivity
ComputeShared compute - not for heavy workloads
AvailabilityAvailable in most AWS regions from the console toolbar
Custom installsYou can install additional packages - persist to home directory
💡

CloudShell home directory storage (1 GB) persists between sessions - files you create in $HOME are still there when you reconnect. However, software installed outside $HOME (e.g., /usr/local/bin) does not persist. Install tools to $HOME/bin and add it to your PATH in .bashrc.

CloudShell vs Cloud9: When to Use Which

DimensionCloudShellCloud9
Startup timeSeconds - no provisioningMinutes - EC2 must start
CostFree - no EC2 chargeEC2 instance cost (+ EBS)
Compute powerShared, limitedDedicated EC2 (t3.micro to larger)
IDE featuresTerminal onlyFull code editor, debugger, file tree
Persistent storage1 GB per regionEBS volume size you choose
VPC accessNo direct VPC accessCan be placed in a VPC
Docker supportNo (no privileged access)Yes, with instance profile
Lambda debuggingNoYes, with SAM CLI integration
CollaborationSingle userMulti-user real-time editing
Use caseQuick CLI tasks, ops, scriptingActive development, debugging

Choose CloudShell for: checking resource states, running one-off CLI commands, quick scripting tasks, and situations where you have console access but no local AWS CLI.

Choose Cloud9 for: active software development, Lambda debugging, team collaboration, and when you need persistent compute with VPC network access.

File Upload, Download, and Cross-Region Use

CloudShell supports uploading and downloading files via the Actions menu in the console, useful for moving scripts and configs in and out of the shell session.

bash
# Common CloudShell patterns

# Install a tool to persistent home directory
curl -Lo $HOME/bin/kubectl "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x $HOME/bin/kubectl
export PATH=$HOME/bin:$PATH  # add to .bashrc for persistence

# Quick script with jq
aws ec2 describe-instances \
  --query 'Reservations[*].Instances[*].{ID:InstanceId,State:State.Name}' \
  --output json | jq '.[][] | select(.State == "running")'

# Cross-account operation using role assumption
STS=$(aws sts assume-role --role-arn arn:aws:iam::OTHER_ACCT:role/MyRole --role-session-name shell)
export AWS_ACCESS_KEY_ID=$(echo $STS | jq -r '.Credentials.AccessKeyId')
export AWS_SECRET_ACCESS_KEY=$(echo $STS | jq -r '.Credentials.SecretAccessKey')
export AWS_SESSION_TOKEN=$(echo $STS | jq -r '.Credentials.SessionToken')
⚠️

CloudShell does not have direct VPC access - it runs in an AWS-managed network. You cannot reach private RDS endpoints, EC2 instances in private subnets, or internal load balancers from CloudShell. Use Systems Manager Session Manager or EC2 Instance Connect for accessing private instances.

Limitations and Gotchas

LimitationImpactWorkaround
No VPC accessCannot reach private resourcesUse SSM Session Manager or a bastion host
Shared computeCPU/memory throttling for heavy workloadsUse Cloud9 or a dedicated EC2
20-min inactivity timeoutLong-running scripts may be interruptedUse nohup or run in background with &
1 GB storage limitLarge repos or datasets exceed limitUse S3 as intermediate storage
No DockerCannot build or run containersUse Cloud9 with privileged mode
Region-specific home dirFiles in us-east-1 not visible in eu-west-1Use S3 for cross-region file sharing
Session timeout (20 min idle)Shell process exits, background jobs killedStructure scripts to be resumable
🎯

Interview Focus Points

  • 1How does CloudShell authenticate - what credentials does it use?
  • 2What is the persistent storage model in CloudShell and what are the limits?
  • 3How does CloudShell differ from Cloud9 and when would you choose each?
  • 4What are the main limitations of CloudShell compared to a full development environment?
  • 5Can you access VPC resources from CloudShell? If not, what alternative would you use?
  • 6How would you install and persist a custom tool in CloudShell across sessions?