Using AWS CLI

Using AWS CLI

The AWS CLI is a tool for managing AWS services. You can control many AWS services from the command line and easily automate AWS operations by creating script files containing multiple commands.

The AWS CLI is pre-installed and pre-configured in CloudShell.

  1. Check the AWS CLI version: aws --version CloudShell

  2. List all S3 buckets in the account: aws s3 ls CloudShell

  3. List all EC2 instances in the account: aws ec2 describe-instances

CloudShell

  1. Now we will upload a file to CloudShell.
  • First, create a file named test.txt and fill in any content you like.

CloudShell

  • Next, go to CloudShell, click Action -> Upload file, then select the file you just created.

CloudShell

  • A notification confirms the file was uploaded successfully.

CloudShell

  • Enter the ls command and you will see the file you just uploaded.

CloudShell

  • Enter cat test.txt to view the content of the uploaded file.

CloudShell

  • Next, we will download a file from CloudShell to your local machine.
  • Create a new file using touch test1.txt, then enter vi test1.txt to edit the file.
  • Press i to begin editing. Type the content Hello FCAJ!. Then press ESC and type wq to save and exit.

CloudShell

CloudShell

  • Type ls to see the name of the file you just created. Then click Action -> Download file.

CloudShell

CloudShell

  • Enter the name of the file you want to download, click Download, and the file will be saved to your machine.

CloudShell

  • Open the file on your local machine.

CloudShell