AWS CLI#

Configure AWS CLI#

Before installation, get API access settings in the CROC Cloud management console. Click the user login in the top right corner, select Profile Get API access settings.

AWS CLI installation:

pip install awscli

AWS CLI configuration using downloaded API settings:

user@cloud:~$ aws configure
AWS Access Key ID [None]: <Project ID in K2 Cloud>:<Your login in K2 Cloud>
AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXXXX
Default region name [None]: US
Default output format [None]: json

Command examples for operating with object storage#

Show the list of buckets in your project#

aws s3 ls --endpoint-url=https://s3.k2.cloud

Output:

2017-10-18 00:28:50 mybucket

Show the bucket content#

aws s3 ls --endpoint-url=https://s3.k2.cloud s3://mybucket

Output:

2018-04-04 13:56:00 17666 file1.txt
2018-04-04 13:50:48 317565 file2.txt
2018-04-04 13:51:38 117018 file3.jpeg

Delete object#

aws s3 rm --endpoint-url=https://s3.k2.cloud s3://mybucket/file1.txt

Output:

delete: s3://mybucket/file1.txt

Upload file to the bucket#

aws s3 cp test.txt s3://mybucket/test.txt --endpoint-url=https://s3.k2.cloud

Output:

upload: ./test.txt to s3://mybucket/test.txt