How to Install aws cli :

  • Windows Download and run the Windows Installer 64 bits or 32 bits.
  • Mac et Linux Python 2.6.5 or later version required.Installation via pip.
$ pip install awscli

Before you run any commands, set your default credentials, using command :

$ aws configure
    AWS Access Key ID [None]: AKDSJKOIMNNUIEXAMPLE
    AWS Secret Access Key [None]: qJnlsXUtnSWMI/FD5DENG/bCxRfiHGEXAMPLEKEY
    Default region name [None]: us-west-2
    Default output format [None]: ENTER

To get Access Key go to AWS Console in section profile  and create Access Key  to get AWSAccessKeyId and AWSSecretKey.

c

As a best practice, I recommend creating an IAM user that has access keys rather than relying on root access keys.

Run a command to verify that your credentials are configured correctly and that you can connect to AWS.

$ aws ec2 describe-regions --output table

Capture-d--cran-2018-12-25---06.36.40

Example 1 : Copy file from you Mac to S3 backet

Start by creating on AWS Console S3 service an S3 bucket named my-test-rcherara-backet

Now with command line we list show this backet and to copy from local station file in this s3 backet with the following commad :

$ aws s3 ls
$ aws s3 cp rcherara-file-to-copy-in-s3.txt  s3://my-test-rcherara-backet/
$ aws s3 ls my-test-rcherara-backet

Capture-d--cran-2018-12-25---06.45.19
Capture-d--cran-2018-12-25---06.45.28

Result :

For more information about s3 command see this link

Example 2 : Create Security Group :

$ $ aws ec2 create-security-group --group-name my-sg --description "My security group"
# Let's see this group in AWS Console :

Capture-d--cran-2018-12-25---06.49.00-1