S3cmd
S3cmd — is a command-line interface for working with services that support Amazon S3's HTTP API (S3 API).
Customize S3cmd
Set up access
Access can be configured by a user with role Account Owner or User Administrator.
- Create a service user с a role with access to object storage. If you are using a user with the Object Storage User role, the container must be configured with the access policy.
- Issue an S3 key to the user.
Install the client
С GitHub S3cmd download and install the client.
Create s3cmd configuration
-
Open the terminal.
-
Open the configuration mode:
s3cmd --configure
-
Enter
Access Key
— field value Access key from S3 key. -
Enter
Secret Key
— field value Secret key from the S3 key. -
Enter
Default Region
— pool. -
Enter
S3 Endpoint
— S3 API domain depends on pool where the object storage is located. -
Enter DNS-style
bucket+hostname:port template for accessing a bucket
— S3 API domain depends on pool where the object storage is located. The settings will be saved in the file~/.s3cfg
:[default]
access_key = <access_key>
secret_key = <secret_key>
bucket_location = <pool>
host_base = <s3_domain>
host_bucket = <s3_domain>
Working with S3cmd
You can see all commands in the instructions Usage S3cmd documentation.
Create a container
Create a container:
s3cmd mb s3://<container_name>
Specify <container_name>
— the name of the new container.
View list of objects
Check out the list of facilities:
s3cmd ls s3://<container_name>
Specify <container_name>
— container name.
Load object
Load the object:
s3cmd put <path> s3://<container_name>/<prefix>
Specify:
<path>
— path to a file in the local directory;<container_name>
— container name;<prefix>
— optional: prefix which will be used to load the object.
Delete object
Delete the object:
s3cmd rm s3://<container_name>/<object_name>
Specify:
<container_name>
— container name;<object_name>
— object name.