- Notifications
You must be signed in to change notification settings - Fork4.2k
Universal Command Line Interface for Amazon Web Services
License
aws/aws-cli
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This package provides a unified command line interface to Amazon WebServices.
Jump to:
This README is for the AWS CLI version 1. If you are looking forinformation about the AWS CLI version 2, please visit thev2branch.
The aws-cli package works on Python versions:
- 3.8.x and greater
- 3.9.x and greater
- 3.10.x and greater
- 3.11.x and greater
- 3.12.x and greater
On 2022-05-30, support for Python 3.6 was ended. This follows thePython Software Foundationend of supportfor the runtime which occurred on 2021-12-23.
On 2023-12-13, support for Python 3.7 was ended. This follows thePython Software Foundationend of supportfor the runtime which occurred on 2023-06-27.For more information, see thisblog post.
Attention!
We recommend that all customers regularly monitor theAmazon WebServices Security Bulletinswebsiteforany important security bulletins related to aws-cli.
The AWS CLI version 1 was made generally available on 09/02/2013 and is currently in the full support phase of the availability life cycle.
For information about maintenance and support for SDK major versions and their underlying dependencies, see theMaintenance Policy section in theAWS SDKs and Tools Shared Configuration and Credentials Reference Guide.
Installation of the AWS CLI and its dependencies use a range of packagingfeatures provided bypip
andsetuptools
. To ensure smooth installation,it's recommended to use:
pip
: 9.0.2 or greatersetuptools
: 36.2.0 or greater
The safest way to install the AWS CLI is to usepip in avirtualenv
:
$ python -m pip install awscli
or, if you are not installing in avirtualenv
, to install globally:
$ sudo python -m pip install awscli
or for your user:
$ python -m pip install --user awscli
If you have the aws-cli package installed and want to upgrade to thelatest version, you can run:
$ python -m pip install --upgrade awscli
This will install the aws-cli package as well as all dependencies.
Note
On macOS, if you see an error regarding the version ofsix
thatcame withdistutils
in El Capitan, use the--ignore-installed
option:
$ sudo python -m pip install awscli --ignore-installed six
On Linux and Mac OS, the AWS CLI can be installed using abundledinstaller.The AWS CLI can also be installed on Windows via anMSIInstaller.
If you want to run thedevelop
branch of the AWS CLI, see theDevelopment Version section ofthe contributing guide.
See theinstallationsection of the AWS CLI User Guide for more information.
Before using the AWS CLI, you need to configure your AWS credentials.You can do this in several ways:
- Configuration command
- Environment variables
- Shared credentials file
- Config file
- IAM Role
The quickest way to get started is to run theaws configure
command:
$ aws configureAWS Access Key ID: MYACCESSKEYAWS Secret Access Key: MYSECRETKEYDefault region name [us-west-2]: us-west-2Default output format [None]: json
To use environment variables, do the following:
$ export AWS_ACCESS_KEY_ID=<access_key>$ export AWS_SECRET_ACCESS_KEY=<secret_key>
To use the shared credentials file, create an INI formatted file likethis:
[default]aws_access_key_id=MYACCESSKEYaws_secret_access_key=MYSECRETKEY[testing]aws_access_key_id=MYACCESSKEYaws_secret_access_key=MYSECRETKEY
and place it in~/.aws/credentials
(or in%UserProfile%\.aws/credentials
on Windows). If you wish to place theshared credentials file in a different location than the one specifiedabove, you need to tell aws-cli where to find it. Do this by setting theappropriate environment variable:
$ export AWS_SHARED_CREDENTIALS_FILE=/path/to/shared_credentials_file
To use a config file, create an INI formatted file like this:
[default]aws_access_key_id=<default access key>aws_secret_access_key=<default secret key># Optional, to define default region for this profile.region=us-west-1[profile testing]aws_access_key_id=<testing access key>aws_secret_access_key=<testing secret key>region=us-west-2
and place it in~/.aws/config
(or in%UserProfile%\.aws\config
on Windows). If you wish to place the config file in a differentlocation than the one specified above, you need to tell the AWS CLIwhere to find it. Do this by setting the appropriate environmentvariable:
$ export AWS_CONFIG_FILE=/path/to/config_file
As you can see, you can have multipleprofiles
defined in both theshared credentials file and the configuration file. You can then specifywhich profile to use by using the--profile
option. If no profile isspecified thedefault
profile is used.
In the config file, except for the default profile, youmust prefixeach config section of a profile group withprofile
. For example, ifyou have a profile named "testing" the section header would be[profile testing]
.
The final option for credentials is highly recommended if you are usingthe AWS CLI on an EC2 instance.IAMRolesare a great way to have credentials installed automatically on yourinstance. If you are using IAM Roles, the AWS CLI will find and use themautomatically.
In addition to credentials, a number of other variables can beconfigured either with environment variables, configuration fileentries, or both. See theAWS Tools and SDKs Shared Configuration andCredentials ReferenceGuidefor more information.
For more information about configuration options, please refer to theAWS CLI Configuration Variablestopic.You can access this topic from the AWS CLI as well by runningaws help config-vars
.
An AWS CLI command has the following structure:
$ aws <command> <subcommand> [options and parameters]
For example, to list S3 buckets, the command would be:
$ aws s3 ls
To view help documentation, use one of the following:
$ aws help$ aws <command> help$ aws <command> <subcommand> help
To get the version of the AWS CLI:
$ aws --version
To turn on debugging output:
$ aws --debug <command> <subcommand>
You can read more information on theUsing the AWSCLIchapter of the AWS CLI User Guide.
The aws-cli package includes a command completion feature for Unix-likesystems. This feature is not automatically installed so you need toconfigure it manually. To learn more, read theAWS CLI Commandcompletiontopic.
The best way to interact with our team is through GitHub. You canopenan issue andchoose from one of our templates for guidance, bug reports, or featurerequests.
You may find help from the community onStackOverflow with the tagaws-cli or ontheAWS Discussion Forum forCLI. If youhave a support plan withAWS Support, you can also createa new support case.
Please check for open similarissues before openinganother one.
The AWS CLI implements AWS service APIs. For general issues regardingthe services or their limitations, you may find theAmazon Web ServicesDiscussion Forums helpful.
About
Universal Command Line Interface for Amazon Web Services