0
votes

I'm trying to upload files into my IBM Cloud object store using cli. The command is the following:

:~ ibmcloud cos object-put --bucket Backup --body Downloads/DRIVING_MIVUE/Normal/F/FILE201217-151749F.MP4
FAILED Mandatory Flag '--key' is missing NAME: ibmcloud cos object-put - Upload an object to a bucket.

USAGE: ibmcloud cos object-put --bucket BUCKET_NAME --key KEY [--body FILE_PATH] [--cache-control CACHING_DIRECTIVES] [--content-disposition DIRECTIVES] [--content-encoding CONTENT_ENCODING] [--content-language LANGUAGE] [--content-length SIZE] [--content-md5 MD5] [--content-type MIME] [--metadata STRUCTURE] [--region REGION] [--output FORMAT] [--json]

OPTIONS:

--bucket BUCKET_NAME The name (BUCKET_NAME) of the bucket.

--key KEY The KEY of the object.

...

What does KEY mean here? I tried to provide a string, like below, but I got an error.

ibmcloud cos object-put --bucket Backup --body Downloads/DRIVING_MIVUE/Normal/F/FILE201217-151749F.MP4 --key FILE201217-151749F

FAILED The specified key does not exist.

2
on this doc page you can find explanation about the key: cloud.ibm.com/docs/cloud-object-storage/… - habercde

2 Answers

0
votes

The object key (or key name) uniquely identifies the object in a bucket. The following are examples of valid object key names:

  • 4my-organization
  • my.great_photos-2014/jan/myvacation.jpg
  • videos/2014/birthday/video1.wmv

For example, when I run the below command

ibmcloud cos object-put --bucket vmac-code-engine-bucket --region us-geo --key test/package.json --body package.json

The file package.json on my machine will be uploaded to the test folder(directory) of COS bucket vmac-code-engine-bucket

Optionally, you can also pass the MAP of metadata to store

{
"file_name": "file_20xxxxxxxxxxxx45.zip",
"label": "texas",
"state": "Texas",
"Date_to": "2019-11-09T16:00:00.000Z",
"Sha256sum": "9e39dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx8ce6b68ede3a47",
"Timestamp": "Thu, 17 Oct 2019 09:22:13 GMT"
}

For other parameters, refer the command documentation here

For more information, refer the documentation here

0
votes

Based on what I have observed:-

Key should be Name of the object.

Body should be file path of the object that needs to be uploaded.