Accessing S3 storage via AWS command-line interface

You can access Virtuozzo Infrastructure S3 storage using the AWS command-line interface (AWS CLI). The AWS CLI provides command-line tools to manage S3 buckets and objects, which is particularly useful for automation, scripting, and integration with third-party tools.

Before using the AWS CLI, do the following:

  1. Install and set up the AWS CLI as described in the official AWS documentation: Install/Update and Setup.
  2. Configure the AWS CLI by running:

    # aws configure
  3. Provide your credentials when prompted. For example:

    AWS Access Key ID [****************TI1S]: bd5187d8b8bec395TI1S
    AWS Secret Access Key [****************TO69]: abpZelzRf8MTPiR0690sNALtji2jHxlUv0ImTO69
    Default region name [None]: ostor
    Default output format [None]: json

    The region parameter specified in S3 client configuration is not taken into account when sending requests to Virtuozzo Infrastructure S3 storage. Because region-based routing is not used, the region value can be set to an arbitrary value.

  4. Configure the S3 endpoint. Because Virtuozzo Infrastructure uses a custom S3 endpoint, you must specify it in each command. To simplify usage, create a command alias:

    # alias aws-vi="aws --endpoint-url https://<endpoint>"

    Replace <endpoint> with the DNS name of your S3 endpoint.

    Now, you can use aws-vi instead of aws when working with Virtuozzo Infrastructure S3.

To verify connectivity, list existing buckets:

# aws-vi s3 ls
2026-03-06 17:10:00 bucket

Managing S3 buckets and objects

The aws s3 command provides basic functionality to access and manipulate S3 buckets and objects.

  • To create a bucket:

    # aws-vi s3 mb s3://my-bucket
    make_bucket: my-bucket

    Use bucket names that comply with DNS naming conventions. For more information on bucket naming, refer to S3 bucket and key naming policies.

  • To list all buckets:

    # aws-vi s3 ls
    2026-03-06 17:14:53 bucket
    2026-03-06 17:20:08 my-bucket
  • To upload a local file to a bucket:

    # ls
    file1
    # aws-vi s3 cp file s3://my-bucket
    upload: ./file1 to s3://my-bucket/file1
  • To list objects in a bucket, run:

    # aws-vi s3 ls s3://my-bucket
    2026-03-06 17:21:37       5120 file1
  • To download an object from a bucket:

    # aws-vi s3 cp s3://my-bucket/file1 file2
    download: s3://my-bucket/file1 to ./file2
    # ls
    file1  file2
  • To delete a file:

    # aws-vi s3 rm s3://my-bucket/file1
    delete: s3://my-bucket/file1
  • To delete a bucket:

    The bucket must be empty before it can be deleted.

    # aws-vi s3 rb s3://my-bucket
    remove_bucket: my-bucket