1) Install AWS CLI
- On Mac and Linux
After that, we set it up with a command.
pip install awscli
After installation, in the console, with the command aws --version check the installed version of
2) Profile setting
You can access the administration panel of the service at https://cmc.objstor.cloud4y.ru:8443 using your credentials received from Cloud4Y technical support after purchasing the service or from your S3 administrator.
In the Administration panel, in the properties of the profile we find out and remember (write down) ACCESS KEY ID, SECRET KEY
To work, we need to configure our profile, we can use it as a global profile, then use the aws configure command or a dedicated command.
In the example below, we will create an additional one named demo-s3. Let's enter the command
aws configure --profile demo-s3
and enter the data requested by the system:
-AWS Access Key ID: (7683ed31dcXXXXXXXXX)
-AWS Secret Access Key: (oUiK3XXXXXXXXXXXXXXXXXXX)
-Default region name: DC1
-Default output format: json
The output parameters can be of the following types:
I chose json.
We can set the created profile by default, and we will do so:
setx AWS_DEFAULT_PROFILE demo-s3
For the changes to come into effect, the console must be restarted.
The profile configuration files themselves are located on the Windows system in the folder: C:\Users\ИМЯ_ПОЛЬЗОВАТЕЛЯ\.aws.
3) Start working with S3
To connect, we need to specify a connection point, endpoint-url, it can take the following values:
-S3 ENDPOINT (HTTP): http://s3.objstor.cloud4y.ru:80/.
-S3 ENDPOINT (HTTPS): https://s3.objstor.cloud4y.ru:443/.
3.1 Get the list of buckets with the list-buckets.
a) With a specific profile:
aws s3api list-buckets -endpoint-url https://s3.objstor.cloud4y.ru:443/ --profile demo-s3
b) With default profile:
aws s3api list-buckets -endpoint-url https://s3.objstor.cloud4y.ru:443/.
We have created a profile with JSON, but we can change this by specifying additionally --output, for example:
aws s3api list-buckets --endpoint-url https://s3.objstor.cloud4y.ru:443/ --output text
If you get an error when running the command: Unable to locate credentials. You can configure credentials by running "aws configure" then you should check your profile settings and the correctness of the data entered.
3.2 Let's create a bucket using the create-bucket.
aws s3api create-bucket -endpoint-url https://s3.objstor.cloud4y.ru:443/ --bucket demo-s3-bucket --acl public-read
As an access rights list (acl), there can be values:
Please note that to access the bucket, you must use the URI http://s3.objstor.cloud4y.ru/demo-s3-bucket, NOT the FQDN http://demo-s3-bucket.s3.objstor.cloud4y.ru.
3.3 Let's upload the file to the created bucket using the put-object command.
aws s3api put-object -endpoint-url https://s3.objstor.cloud4y.ru:443/ --bucket demo-s3-bucket --key my-video-file.mp4 --body C:\Upload\my-video-file.mp4
After downloading, we will get this result:
All these actions, we can also perform/verify in the control panel
We work in the same way with other commands, see the detailed information.
Have you tried Virtual cloud servers by Cloud4Y? Not yet?
Leave a request and get a 10-day free trial.