Use AWS CLI
How to Use the AWS CLI to Interact with OORT Storage S3 Compatible API.
What is AWS CLI?
The AWS CLI or Amazon Web Services Command Line Interface is a command-line tool developed by Amazon in Python to transfer data to an object storage service. This is one of the most used CLI tools for IT system administrators, developers, and programmers. Although this tool was developed by Amazon, you can use it with any S3-compatible API object storage service, including OORT Storage, to manage your storage objects and buckets.
For more information on AWS CLI, see AWS CLI Help.
Prerequisites
Access Key and Access Secret Keys will be stored in the AWS CLI configuration file, but each command needs to reference the API endpoint.
Configure AWS CLI
First, configure the AWS CLI to use OORT Storage. To do this, open a new terminal window. From there, run the command:
The command will generate a series of prompts, fill in the following:
Access Key ID: Vault Access Key
Secret Access Key: Vault Secret Key
Region: us-east-1
Output Format:Optional
After completing the prompts, start using the AWS CLI tools to interact with the OORT Storage S3 Compatible API. As long as your access ID and secret access key remain the same, you do not need to configure the AWS CLI again.
All AWS CLI commands will start with the section following this initial command, which will determine what to do and what bucket to use.
OORT Storage Endpoint API:
Standard:https://s3-standard.oortech.com
Archive:https://s3-archive.oortech.com
Crete a bucket
To create a new bucket on OORT Storage using the AWS CLI, use the following command:
For example, to create a new bucket named "mybucket":
Bucket names must be unique across all Oort users, be between 3 and 63 characters long, and can only contain lowercase characters, numbers, and dashes.
The terminal should return the following line:
Display buckets
The following command will list all buckets in your Oort account:
Upload a file
To upload a single file, use the following command:
For example, to upload a file named "myphoto.png" to the bucket "mybucket":
To verify that this file was uploaded by listing the contents of the bucket with the command used earlier: s3 ls
To verify that this file is available from the web console, go to https://console.oortech.com
To upload multiple objects, use the following command:
For example, to upload the contents of a folder named "Photos", use the following command:
List files in a bucket
To list the files of a bucket, use the following command:
For example, to list the files of 'mybucket':
Move a file
To move from bucket 1 to bucket 2, use the following command:
Copy a file
To copy from bucket 1 to bucket 2, use the following command:
Download a file
To download a single file, use the following command:
For example, to download a file named "myphoto.png" from the bucket "mybucket":
Download a folder
To download a folder, use the following command:
For example, to upload the contents of a folder named "photos", use the following command:
Delete a file
To delete files, use the following command:
Delete all files in a bucket
To delete all files in the bucket, use the following command:
For example, to delete all files from the bucket "mybucket":
Generate a presigned S3 URL using the AWS CLI
To create a presigned URL using the AWS CLI, use the following command syntax:
This command should return a presigned URL. By default, the expiration time is one hour.
You can specify different expiration times by adding flags and minutes. --expires-in
Last updated