Prerequisites
To manage buckets, you need to install and configure AWS CLI. It provides simple commands for object management, likeaws s3 cp to move objects between a bucket and a local computer and aws s3 rm to delete them.
For more details on installing and configuring, see How to get started with Object Storage: Create your first bucket and the guide on the AWS CLI.
Object naming requirements
Each Object Storage object has a key — object ID in astring format. This key can contain prefixes — they act similar to directories, organizing objects into groups.
To avoid issues with your objects, follow these requirements:
- Object keys can be up to 1024 bytes long, case sensitive.
- Use UTF-8 alphanumeric characters, slashes (
/) and certain special characters.
How to upload
Upload a single file
- AWS CLI
- s5cmd
This command will upload a specified local file to your Object Storage bucket with a specified prefix:The object is uploaded to the storage class that is set as default for the bucket.You can find more information on the
cp command in the AWS CLI reference.Upload a folder
There are two ways to upload the contents of a specified local folder to your Object Storage bucket with a specified prefix:-
cpcommand copies all the files from the source: -
synccommand only copies new and updated files compared to the target:
Documents/'My ML configurations'/.
How to download
Download a single object
This command will download a specified object with a prefix from your Object Storage bucket to a destination on your local machine:cp command in the AWS CLI reference.
Download all objects with a prefix
There are two ways to download all the objects with a specified prefix from your Object Storage bucket to a destination on your local machine:-
cpcommand: -
synccommand:You can find more information on these commands in the AWS CLI reference:
Documents/'My ML configurations'/.
Example
Let’s assume that you already have an Object Storage bucket namedquickstart-bucket. The example below will show you how to upload objects to your bucket and download them.
-
Create a local folder from which you’ll upload files to your bucket:
-
Create the files to upload. Run the commands from the code block below:
This creates three text files in your new
lorem-ipsum/folder:lorem.txteuismod.txtlitora.txt
-
Upload all the files from your
lorem-ipsum/folder to your Object Storage bucket with thelorem-ipsumprefix:Output
-
List the objects with the
lorem-ipsumprefix in your bucket:Output
-
Download the
lorem.txtfile from your bucket to the locallorem-ipsum/folder aslorem-download.txt:Output
-
Check if the downloaded file is there:
Output
-
Delete all the files with the
lorem-ipsumprefix from your Object Storage bucket:Output
-
Remove the
lorem-ipsum/folder from your computer: