S3cmd
S3cmd — is a command-line interface for working with services that support Amazon's S3 HTTP API (S3 API).
Customize S3cmd
1. Set up access to S3
Access can be configured by the Account Owner or a user with the role of iam_admin
.
- Create a service user with the role with access to S3.If you use a service user with the role object_storage_user or
s3.bucket.user
you must have a Bucket Policy configured in the bucket. - Issue an S3 key to the user.
2. Install the client
From GitHub S3cmd, download and install the client.
3. Create s3cmd configuration
-
Open the terminal.
-
Open the configuration mode:
s3cmd --configure
-
Enter
Access Key
— the value of the Access key field from the S3 key. -
Enter
Secret Key
— the value of the Secret key field from the S3 key. -
Enter
Default Region
— Pool. -
Enter
S3 Endpoint
— S3 API domain, depends on the pool in which S3 resides. -
Enter DNS-style
bucket+hostname:port template for accessing a bucket
— the domain of the S3 API, depends on the pool where S3 resides. The settings will be saved in the~/.s3cfg
file:[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 Usage instructions of the S3cmd documentation.
Create a bucket
-
Open the terminal.
-
Create a baquette:
s3cmd mb s3://<bucket_name>
Specify
<bucket_name>
is the name of the new bucket.
View list of objects
-
Open the terminal.
-
Check out the list of facilities:
s3cmd ls s3://<bucket_name>
Specify
<bucket_name>
is the name of the bucket.
Load object
-
Open the terminal.
-
Load the object:
s3cmd put <path> s3://<bucket_name>/<prefix>
Specify:
<path>
— path to a file in the local directory;<bucket_name>
— bucket name;<prefix>
— Optional: prefix by which the object will be loaded.
Delete object
-
Open the terminal.
-
Delete the object:
s3cmd rm s3://<bucket_name>/<object_name>
Specify:
<bucket_name>
— bucket name;<object_name>
— object name.