AWS CloudShell

Learn via video courses

Overview

AWS CloudShell is a browser-based terminal that can be used to easily interact with AWS Services using the AWS CLI. AWS CloudShell comes pre-installed with a lot of developer tools and provides 1 GB of persistent storage. AWS CloudShell is completely free to use!

What is AWS CloudShell?

The AWS Command Line Interface (CLI) is a tool offered by AWS to interact with the different AWS Services. You can easily create, view, modify, or even delete resources in AWS using the AWS CLI. AWS CLI is available as a downloadable package on all the major operating systems - Windows, MacOS, and Linux.

What is AWS CloudShell

To extend the functionalities of AWS CLI to the browser, and at the same time provide users with an easy to use Linux terminal, AWS built AWS CloudShell. AWS CloudShell is a browser-based terminal that makes it easy to interact with AWS Services and your resources on AWS. This means you do not need to install any additional software on your system. You can use the same AWS CLI commands in AWS CloudShell without any change in syntax.

Features of AWS CloudShell

AWS CloudShell comes with a lot of features:

  • AWS CLI: The AWS CLI version 2 is pre-installed in AWS CloudShell, and when you launch an AWS CloudShell session using the AWS Console, the AWS credentials you used to sign in are automatically used in the session. This gives you a secure environment to use the AWS CLI and interact with AWS Services.
  • Development Tools: AWS CloudShell lets you easily switch between different shell flavors such as Bash, Powershell, and Z shell. AWS CloudShell sessions also come pre-installed with common development tools like git, make, pip, tar, vim, and wget. AWS CloudShell sessions also have Python and Node.js installed which can be used for scripting.
  • Persistent Storage: AWS CloudShell sessions come with 1 GB of persistent storage at no additional cost. This storage is available in the home directory of the session. Since the storage is persistent, data in the home directory persists between sessions, even when you close your browser.
  • Security: AWS CloudShell is a secure environment and provides granular access to AWS Services using IAM. It also features Safe Paste which prompts users to verify the content being pasted into AWS CloudShell sessions to prevent malicious scripts from getting executed.
  • AWS Managed: AWS CloudShell is fully managed by AWS and hence there is no maintenance. Software updates and patches are automatically pushed by AWS in the background.
  • Customization Options: AWS CloudShell sessions can be customized by modifying text size, light/dark themes, and screen layouts (using multiple tabs). You can also customize the start-up shell scripts.

AWS CloudShell Use Cases

AWS CloudShell has a wide variety of use cases. Let's take a look at a few of them:

  • Interacting With AWS Services: The main use case of using AWS CloudShell is the ease of interacting with different AWS Services using either the AWS CLI or the APIs present in the AWS Software Development Kit (SDK). You can easily create, update, or destroy resources in your AWS Account using the AWS CLI without leaving your browser. AWS CloudShell uses IAM to manage permissions and this ensures granular access to resources.
  • Scripting: AWS CloudShell sessions come with a host of developers tools (vim, wget, pip) and language runtimes (Python, Node.js) pre-installed. This enables users to easily create and execute simple scripts and manage their infrastructure on the browser itself.
  • System Restrictions and Quick Access: AWS CloudShell is useful when the system you are working on has restrictions on which tools can be installed due to company policies or other reasons. AWS CloudShell can also be used when you need to quickly use the AWS CLI or need a Linux-based environment.

AWS CloudShell Endpoints and Quotas

When you want to connect programmatically to an AWS service, you use an endpoint. These endpoints are distributed between the different AWS Regions and have service limits or quotas. Here are the service endpoints and service quotas for AWS CloudShell:

Service Endpoints

Region NameRegionEndpointProtocol
US East (Ohio)us-east-2cloudshell.us-east-2.amazonaws.comHTTPS
US East (N. Virginia)us-east-1cloudshell.us-east-1.amazonaws.comHTTPS
US West (Oregon)us-west-2cloudshell.us-west-2.amazonaws.comHTTPS
Asia Pacific (Mumbai)ap-south-1cloudshell.ap-south-1.amazonaws.comHTTPS
Asia Pacific (Sydney)ap-southeast-2cloudshell.ap-southeast-2.amazonaws.comHTTPS
Asia Pacific (Tokyo)ap-northeast-1cloudshell.ap-northeast-1.amazonaws.comHTTPS
Canada (Central)ca-central-1cloudshell.ca-central-1.amazonaws.comHTTPS
Europe (Frankfurt)eu-central-1cloudshell.eu-central-1.amazonaws.comHTTPS
Europe (Ireland)eu-west-1cloudshell.eu-west-1.amazonaws.comHTTPS
Europe (London)eu-west-2cloudshell.eu-west-2.amazonaws.comHTTPS
South America (São Paulo)sa-east-1cloudshell.sa-east-1.amazonaws.comHTTPS
AWS GovCloud (US-East)us-gov-east-1cloudshell.us-gov-east-1.amazonaws.comHTTPS
AWS GovCloud (US-West)us-gov-west-1cloudshell.us-gov-west-1.amazonaws.comHTTPS

Service Quotas

NameDefaultAdjustableDescription
Data retentionEach supported Region: 120 NoThe number of days that the data in the home directory will be retained after a shell was last accessed.
Home directory sizeEach supported Region: 1 GigabyteNoThe maximum size of your shell's home directory.

Getting Started with AWS CloudShell

In this tutorial, we will be uploading a file to AWS CloudShell and then upload the same file to AWS S3 using AWS CLI commands.

Pre-Requisites

  1. An AWS Account

Steps

1. Login to your AWS Account. Click the AWS CloudShell icon located on the top right.

Getting Started with AWS CloudShell

2. Create a file in your system using notepad. For this tutorial, let's call the file hello-world.txt and let the contents be "Hello World!".

3. From Actions, choose "Upload file". Then select the file you created in Step 2.

Getting Started with AWS CloudShell 2

4. Display the contents of the file using cat.

Getting Started with AWS CloudShell 3

5. Create an AWS S3 bucket and then upload the file to S3.

Getting Started with AWS CloudShell 4

In this tutorial, we learnt how to open the AWS CloudShell terminal, upload files from our own system, and use the AWS CLI to interact with AWS Services like AWS S3.

How to Install Terraform on AWS CloudShell?

Terraform, a popular infrastructure-as-code tool, can be installed in AWS CloudShell. You can then use Terraform to manage your AWS resources.

In this tutorial, let's understand how to install terraform in AWS CloudShell.

1. Login to your AWS Account. Click the AWS CloudShell icon located on the top right.

Getting Started with AWS CloudShell 5

2. Install the terrafrom version manager tfenv.

3. Install the desired version of terraform in AWS CloudShell.

4. Check if terraform was installed correctly by checking which version was installed.

Getting Started with AWS CloudShell 6

Benefits of AWS CloudShell

  • Linux Environment On A Browser: AWS CloudShell provides a convenient Linux Environment on a browser with no extra configuration required. Along with using the AWS CLI, you can also edit files and run scripts.
  • Built-In Security: AWS CloudShell uses your login credential to authenticate, and permissions can be configured using IAM policies. Inactive sessions are automatically stopped. Sessions use Safe Paste which asks you to verify multiline text to ensure you don't post malicious scripts by mistake. All of these security features make AWS CloudShell secure.
  • Developer Friendly: AWS CloudShell is very developer friendly. It uses familiar terminal flavors (Bash, Powershell, and Z shell) and comes pre-installed with frequently used tools (vim, wget, make, pip, etc.). It supports two languages out of the box (Python and Node.js).
  • Familiar Tools: AWS CloudShell contains tools that you will be familiar using - AWS CLI, AWS Elastic Container Service CLI, and AWS Serverless Application Model CLI.

AWS CloudShell VS. Google Cloud Shell VS. Azure Cloud Shell

Similar to how AWS provides AWS CloudShell as a browser-based shell environment for AWS, Google provides Google Cloud Shell for GCP and Microsoft provides Azure Cloud Shell for Azure. Most functionalities across these terminals are the same. Let's take a look at a few key differences:

  1. Storage: Both Google Cloud Shell and Azure Cloud Shell provide 5 GB of persistent storage, whereas AWS CloudShell provides only 1 GB.
  2. Language Support: Google Cloud Shell and Azure Cloud Shell support more programming languages out of the box compared to AWS CloudShell, which supports only two languages.

AWS CloudShell Pricing

AWS CloudShell has no additional charges, i.e., it is free to use. You only need to pay for the other AWS resources you use and interact with in an AWS CloudShell session. There could be some additional charges for data transfer, like uploading/downloading files to/from AWS S3. Data transfer is billed at standard AWS data transfer rates per AWS Service.

Conclusion

  • AWS CloudShell is a browser-based terminal, which can be used to interact with AWS Services using the AWS CLI.
  • It comes with a lot of features - AWS CLI, developer tools, persistent storage, security, AWS managed, and customization options.
  • There are a wide variety of use cases for AWS CloudShell - interacting with AWS Services, scripting, system restrictions, and quick access.
  • AWS CloudShell has fixed service quotas like retaining data present in the home directory for only 120 days and allocating only 1 GB of storage for the home directory.
  • Using AWS CloudShell has a lot of benefits - Linux environment on a browser, built-in security, developer friendly, and familiar tools.
  • Google Cloud Shell and Azure Cloud Shell are similar tools available on GCP and Azure respectively.
  • AWS CloudShell has no additional charges.