Working with AWS CloudShell - AWS CloudShell

Working with AWS CloudShell

This section describes how to interact with AWS CloudShell and perform specific actions with supported applications.

You can navigate CloudShell interface features from the AWS Management Console and Console Toolbar.

The following screenshot indicates several key AWS CloudShell interface features.


               Key features of the AWS CloudShell interface.
  1. AWS CloudShell command line interface that you use to run commands by using your preferred shell. The current shell type is indicated by the command prompt.

  2. The terminal tab, which uses AWS Region where AWS CloudShell is currently running.

  3. The Actions menu, which provides options for changing the screen layout, downloading and uploading files, restarting your AWS CloudShell, and deleting your AWS CloudShell home directory.

    Note

    The Download option isn't available when you launch CloudShell on the Console Toolbar.

  4. The Open in new browser tab, which provides the option to access your CloudShell session in a full screen.

  5. The Preferences option, which you can use to customize your shell experience.

  6. The bottom bar, which provides the following options to:

    • Launch CloudShell from the CloudShell icon.

    • Provide feedback from the Feedback icon. Choose the type of feedback that you want to submit, add your comments, and then choose Submit.

      • To submit feedback for CloudShell, choose one of the following options:

        • From the console, launch CloudShell, and choose Feedback. Add your comments, and then choose Submit.

        • Choose CloudShell on the Console Toolbar, on the lower left of the console, and then choose Open in new browser tab icon, Feedback. Add your comments, and then choose Submit.

      Note

      The Feedback option isn't available when you launch CloudShell on the Console Toolbar.

    • Learn about our privacy policy and terms of use, and customize cookie preferences.

Working in AWS Regions

The current AWS Region that you're running in is displayed above the command line interface.


            Key features of the AWS CloudShell interface.

You can choose an AWS Region to work in by selecting a specific Region using the Region selector. After you change Regions, the interface refreshes as your shell session connects to a different compute environment that's running in the selected Region.

Important

You can use up to 1 GB of persistent storage in each AWS Region. Persistent storage is stored in your home directory ($HOME). This means that any personal files, directories, programs, or scripts that are stored in your home directory are all located in one AWS Region. Moreover, they're different from those that are located in the home directory and stored a different Region.

The long-term retention of files in persistent storage is also managed on a per-Region basis. For more information, see Persistent storage.

Specifying your default AWS Region for AWS CLI

You can use environment variables to specify configuration options and credentials required to access AWS services using AWS CLI. The environment variable that specifies the default AWS Region for your shell session is set in either when you launch AWS CloudShell from a specific Region in the AWS Management Console or when you choose an option in the Region selector.

Environment variables have precedence over AWS CLI credentials files that are updated by aws configure. So, you can't run the aws configure command to change the Region that's specified by the environment variable. Instead, to change the default Region for AWS CLI commands, assign a value to the AWS_REGION environment variable. In the examples that follow, replace us-east-1 with the Region that you're in.

Bash or Zsh
$ export AWS_REGION=us-east-1

Setting the environment variable changes the value that's used until either at the end of your shell session or when you set the variable to a different value. You can set variables in your shell's startup script to make the variables persistent across future sessions.

PowerShell
PS C:\> $Env:AWS_REGION="us-east-1"

If you set an environment variable at the PowerShell prompt, the environment variable saves the value for only the duration of the current session. Alternatively, you can set the variable for all future PowerShell sessions by adding the variable to your PowerShell profile. For more information about storing environment variables, see the PowerShell documentation.

To confirm that you've changed the default Region, run the aws configure list command to display the current AWS CLI configuration data.

Note

For specific AWS CLI commands, you can override the default Region using the command line option --region. For more information, see Command line options in the AWS Command Line Interface User Guide.

Working with files and storage

Using AWS CloudShell's interface, you can upload files to and download files from the shell environment. For more information about downloading and uploading files, see Getting started with AWS CloudShell.

To ensure any of the files you add are available after your session ends, you should know the difference between persistent and temporary storage.

  • Persistent storage: You have 1 GB of persistent storage for each AWS Region. Persistent storage is in your home directory.

  • Temporary storage: Temporary storage is recycled at the end of a session. Temporary storage is in the directories that are outside your home directory.

Important

Make sure to leave files that you want to keep and use for future shell sessions in your home directory. For example, suppose that you move a file out of your home directory by running the mv command. Then, that file is recycled when the current shell session ends.

Working with Docker

AWS CloudShell fully supports Docker without installation or configuration. You can define, build and run Docker containers inside AWS CloudShell. You can deploy Docker-based resources, such as Lambda functions based on Docker containers, via the AWS CDK Toolkit as well as build Docker containers and push them to Amazon ECR repositories via the Docker CLI. For detailed steps on how to run both of these deployments, see the following tutorials:

There are certain restrictions and limitations with using Docker with AWS CloudShell:

  • Docker has limited space in an environment. If you have large individual images, or too many pre-existing Docker images, it can cause issues that might prevent you from pulling, building, or running additional images. For more information on Docker, see the Docker Documentation guide.

  • Docker is only supported in certain Regions. For information on which Regions are supported with Docker, see Docker Regions.

  • If you encounter issues when using Docker with AWS CloudShell, see the Troubleshooting section of this guide for information on how to potentially resolve these issues.