To Install awsclient we need to install python-pip first:--
--> sudo apt-get install python-pip
After installing pip we can install awsclient using :-
--> sudo apt-get install awscli
After successfully installing awsclient, we need to configure it. To configure it :-
$ aws configure
and then fill in the following details
AWS Access Key ID [None]: XXXXXXXXXXXXXEXAMPLE
AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXXXXXXXSAMPLEKEY
Default region name [None]: us-west-2(or us-east-1)
Default output format [None]: json
After successfully configuring awsclient, we are ready to go and we can perform any operation which we perform on AWS gui.
For example:
To list all s3 buckets:-
$aws s3api list-buckets
To copy content of an entire folder to some particular folder in amazon bucket:-
(aws s3 cp sourcefolder destinationfolder --recursive)
$aws s3 cp /home/taran/folder1/ s3://user_list_staging/tmp/avatars/ --recursive
To copy a file to a particular folder in an amazon bucket :--
(aws s3 cp source_file_path destination_file_path)
$aws s3 cp /home/taran/blurredoceanbg/blurredoceanbg@2x.png s3://user_list_staging/tmp/avatars
To view content of a particular bucket :-
$aws s3api list-objects --bucket user_list_staging
To view content of particular folder in an amazon bucket:-
$aws s3 ls s3://user_list_staging/tmp
To remove a bucket :-
$aws s3 rb s3://user_list_staging
To remove a bucket forcefully :-
$aws s3 rb s3://user_list_staging --force
0 Comment(s)