Amazon aws-shell: Interactive shell of AWS CLI
?
??Aws cli is a unified management tool of AWS (Amazon cloud service). It is developed based on python and is enhanced and encapsulated based on boto. It provides a way to operate aws's full-system product resources in the same way as operating linux commands. The aws-shell introduced in this article is the shell interactive version of Aws cli, providing users with more convenience.
??
Install
Installing aws-shell requires a python environment and pip. You can use pip for installation as follows:
$ pip install aws-shell
Insufficient permissions:
$ sudo pip install aws-shell
During installation of Mac OS X, python dependency Packages may exist. For details, see:
https://github.com/pypa/pip/issues/3165
You can do this now:
sudo pip install aws-shell --upgrade --ignore-installed six
After installing aws-shell, you can run:
$ aws-shell
Exit shell. Press Ctrl-D.
Upgrade aws-shell
If you want to upgrade aws-shell to the latest version, you can run:
$ pip install --upgrade aws-shell
You can also use this upgrade command when you need to upgrade the AWS-CLI (including new services and APIs, then you can apply these new services and upgraded APIs in aws-shell.
Supported python versions
Like aws cli, aws-shell supports the following python versions:
2.6.5+2.7.x3.3.x3.4.x
Configuration
Aws-shell uses the same configuration as aws cli. If you have never used aws cli before, the simplest way is to run the configure command:
$ aws-shellaws> configureAWS Access Key ID [None]: your-access-key-idAWS Secret Access Key [None]: your-secret-access-keyDefault region name [None]: region-to-use (e.g us-west-2, us-west-1, etc).Default output format [None]:aws>
For more information, see:
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
Basic usage
Aws-shell and aws cli commands are the same, but you do not need to add the aws prefix. The following are some command cases:
$ aws-shellaws> ec2 describe-regions{ "Regions": [ { "Endpoint": "ec2.eu-west-1.amazonaws.com", "RegionName": "eu-west-1" }, ...aws> s3 ls2015-12-07 15:03:34 bucket12015-12-07 15:03:34 bucket2aws> dynamodb list-tables --output textTABLENAMES FirstTABLENAMES SecondTABLENAMES Third
Features
Automated completion commands and options:
Aws-shell will automatically complete commands and options based on your input:
Shorthand for completion:
Aws-shell also provides a shorthand example for aws cli options:
Automatic server completion:
Aws-shell also uses boto3, which is the aws sdk for python. Boto3 is used to complete server resources, such as Amazon EC2 instance Ids, Amazon Dynamodb table name, aws iam user name, and Amazon S3 bucket name. This feature is under development. The list of supported resources will be added:
Fuzzy search
Fuzzy search is supported for each automatically supplemented value. Therefore, you can customize commands, options, and values without typing so many characters, such:
The first letter of each federated word: ec2 describe-reserved-instances-offerings-> ec2 drio each word is entered in a short segment: ec2 describe-instances-> ec2 descinst: dynamodb table-> will provide you with all possible
Built-in documentation
Aws-shell will automatically pop up the introduction when you enter the command. It will show you the built-in documentation for CLI options. In addition, there is a separate document interface that displays the commands or options you currently entered.
Fish-Style Automatic recommendations
Aws-shell supports the Fish-style automation suggestion. You can use the right arrow key to complete the suggestion:
Command history
Aws-shell records the commands you run and writes them ~ /. Aws/shell/history. You can use the up and down arrow keys to search and roll back your history:
Toolbar options
Aws-shell has a bottom toolbar that provides some options:
F2: Switch fuzzy match and string match F3: Switch the key of VI and Emacs to bind F4: Switch the Automatic completion of a single complex column F5: Show Hidden help document F10 or Ctrl-D: exit aws-shell
When you switch the toolbar options, your preferences are exists ~ /. Aws/shell/awsshellrc file, so the next time you run aws-shell, you can easily restore it:
Point command
Aws-shell provides additional commands that can be prefixed with ".", with the same effect.
Use. edit to create a shell script
Of course, sometimes you need to use a series of commands in aws-shell, you can directly write a script. In addition, in the History command file, aws-shell can trace all the commands you have used in aws-shell.
You can use the. edit command to browse these commands in the editor, using the Default Editor Environment:
aws> ec2 describe-instancesaws> dynamodb list-tablesaws> .edit
Execute shell commands
Aws-shell integrates some other commands in some aspects. First, you can pass the aws cli command pipeline to other processes and write the output into the file:
aws> dynamodb list-tables --output text | head -n 1TABLENAMES Firstaws> dynamodb list-tables --output text > /tmp/foo.txt
Then, if you want to run shell commands instead of aws cli commands, you can add them to the command! Prefix:
aws> !ls /tmp/foo.txt bar.txt
Aws-shell is still under development and may be incompatible. We look forward to your feedback. We will continue to iterate the aws-shell code.