Installing aws-cli on CentOS 7

There are a number of ways to install the AWS command line tools. Below is the method I favour on CentOS:

[[email protected] ~]$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
[[email protected] ~]$ unzip awscli-bundle.zip
[[email protected] ~]$ cd awscli-bundle/
[[email protected] awscli-bundle]$ sudo ./install -i /usr/local/aws -b /usr/local/bin/aws

Check that was successful with:

[[email protected] ~]$ aws --version
aws-cli/1.16.123 Python/2.7.5 Linux/3.10.0-957.5.1.el7.x86_64 botocore/1.12.113

You can now remove the files extracted:

[[email protected] ~]$ rm -vR ~/awscli-bundle/
[[email protected] ~]$ rm -v ~/awscli-bundle.zip

Configure aws-cli to use your AWS credentials:

[[email protected] ~]$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: eu-west-1
Default output format [None]: json

You can test your AWS credentials with the below command.

[[email protected] ~]$ aws sts get-caller-identity
{
    "Account": "903503371367", 
    "UserId": "AKIAIOSFODNN7EXAMPLE", 
    "Arn": "arn:aws:iam::903503371367:user/andy"
}

It should display your users details if you are authenticated.

Be the first to comment

Leave a Reply