AWS CLI is an open source tool that uses simple file commands for efficient file transfers to and from an S3 Compatible Storage.
Download & Install - Windows
To download and install the tool for Windows, follow these instructions using the MSI Installer section.
Confirm that the installation was successful by checking your system's version of aws with the aws --version
command prompt.
WARNING - If Windows is unable to find the executable, you may need to re-open the command prompt or add the installation directory to your PATH environment variable manually.
Download & Install - Linux
To download and install the tool for Linux, follow these instructions.
Confirm that the installation was successful by checking your system's version of aws with the aws --version
command prompt.
AWS CLI Configuration - Windows/Linux
The following commands are the same both for Windows and for Linux.
Open a command prompt and type aws configure
.
The AWS CLI will prompt you for four pieces of information:
- AWS Access Key ID;
- AWS Secret Access Key;
- Default region name;
- Default output format;
AWS Access Key ID
This key can be retrieved as Access Key in S3 Compatible Credentials section here.
Then insert in the command prompt and press ENTER.
AWS Secret Access Key
This key can be retrieved as Secret Key in S3 Compatible Credentials section here.
Then insert in the command prompt and press ENTER.
Default region name & output format
Let Default region name blank and press ENTER.
Insert json in Default output format prompt and press ENTER.
Upload/Download configuration
To work correctly with cynnyspace server, you have to configure chunk upload size and max concurrent request:
aws configure set default.s3.multipart_chunksize 8388608
aws configure set default.s3.max_concurrent_requests 50
IMPORTANT - With the aws configure
command, AWS CLI creates credentials and configure files and saves them in a folder named .aws in your home directory.
AWS CLI Use with Cynny Space S3 Compatible Storage
This is the AWS S3 command structure:
aws s3 <S3_COMMAND> <S3_ARGUMENTS> --endpoint-url https://<S3_COMPATIBLE_CREDENTIALS_ENDPOINT>
<S3_COMMAND> - For example:
- ls to list a bucket or a folder in a bucket;
- mb to create a cloud bucket;
- rb to delete a cloud bucket;
- cp to copy a file from a local file system to a cloud bucket;
-
sync to sync a folder and a cloud bucket;
- <S3_ARGUMENTS> - The number of arguments required depends on which S3 Command is used.
- <S3_COMPATIBLE_CREDENTIALS_ENDPOINT> - The right endpoint to use can be retrieved as Endpoint/Service point in S3 Access section from your administrative panel by logging here .
IMPORTANT - Note that --endpoint-url argument needs https://
AWS CLI Use Examples
IMPORTANT - The following AWS CLI uses examples take https://cs2.cynnyspaces3.com as <S3_COMPATIBLE_CREDENTIALS_ENDPOINT>
List Bucket - ls
The following command lists all buckets of the account:
aws s3 ls --endpoint-url https://cs2.cynnyspaces3.com
The following command lists a bucket content:
aws s3 ls s3://<S3_BUCKET_NAME> --endpoint-url https://cs2.cynnyspaces3.com
For example this command lists the content of a bucket called testnewbucket:
aws s3 ls s3://testnewbucket --endpoint-url https://cs2.cynnyspace.com
Create Bucket - mb
The following command creates a bucket called testnewbucket:
aws s3 mb s3://testnewbucket --endpoint-url https://cs2.cynnyspaces3.com
Delete Bucket - rb
The following command deletes a bucket called testnewbucket:
aws s3 rb s3://testnewbucket --endpoint-url https://cs2.cynnyspaces3.com
WARNING - Only an empty bucket can be deleted.
Copy Object - cp
This command needs a source path and a destination path:
aws s3 cp <source> <destination> --endpoint-url https://cs2.cynnyspaces3.com
For example <source> could be a file path in the local file system and <destination> could be a cloud bucket path.
The following command copies a local file called testfile.txt in a bucket called testnewbucket:
aws s3 cp C:\Users\Administrator\Desktop\testfile.txt s3://testnewbucket --endpoint-url https://cs2.cynnyspaces3.com
Sync Local Folder and Bucket Folder - sync
This command needs a source path and a destination path:
aws s3 sync <source> <destination> --endpoint-url https://cs2.cynnyspaces3.com
Possible source-destination combinations are:
- Local file system to S3 Bucket;
- S3 Bucket to local file system;
The following example synchronizes the contents of a local folder named test-upload in a bucket named testnewbucket.
S3 sync updates any files that have a different size or modified time than files with the same name at the destination.
The output displays specific operations performed during the sync.
aws s3 sync C:\Users\Administrator\Desktop\test-upload s3://testnewbucket --endpoint-url https://cs2.cynnyspaces3.com