Before you start
- Create a service account.
- Assign a proper role to the service account. For more information about roles, see the Identity and Access Management documentation.
- Create a static access key.
To learn how to download and install S3cmd, see the Download section on the official website of the project.
To configure S3cmd, use the
s3cmd --configure command. The command requests values for the following parameters:
Access Key: Enter the ID of the key that you received when generating the static key.
Secret Key: Enter the secret key that you received when generating the static key.
Default Region: Enter
Always specify the
ru-central1region when accessing Object Storage. A different region value may lead to an authorization error.
S3 Endpoint: Enter
DNS-style bucket+hostname:port template for accessing a bucket: Enter
Leave the other parameter values unchanged.
The client tries to establish a connection with Object Storage and get a list of buckets. If successful, it will return
Success. Your access key and secret key worked fine :-).
s3cmd --configure command saves the settings to a
~/.s3cfg file in the format:
[default] access_key = id secret_key = secretKey bucket_location = ru-central1 host_base = storage.yandexcloud.net host_bucket = %(bucket)s.storage.yandexcloud.net
If necessary, you can change these settings directly in the file. You can also specify settings when launching the client by using the appropriate parameters.
For the static website hosting control commands to work correctly, manually add the following parameter to the configuration file:
website_endpoint = http://%(bucket)s.website.yandexcloud.net
- S3cmd treats Object Storage as a hierarchical file system and object keys look like file paths.
- By default, S3cmd uploads objects to cold storage. To specify the storage class when uploading an object, use the
Examples of operations
To enable debug output in the console, use the
Getting a list of buckets
Creating a bucket
s3cmd mb s3://bucket
When creating a bucket, follow the naming conventions.
Uploading an object to cold storage
s3cmd --storage-class COLD put local_file s3://bucket/object
Getting a list of objects
s3cmd ls s3://bucket
Retrieving an object
s3cmd get s3://bucket/object local_file
Deleting an object
s3cmd del s3://bucket/object