Examples of using the AWS CLI for Ozone S3 Gateway
You can use the Amazon Web Services (AWS) command-line interface (CLI) to interact with S3 Gateway and work with various Ozone storage elements.
Defining an alias for the S3 Gateway endpoint
alias ozones3api='aws s3api --ca-bundle --endpoint https://localhost:9879'
alias ozones3api='aws s3api --ca-bundle --endpoint http://localhost:9878'
Examples of using the AWS CLI to work with the Ozone storage elements
The following examples show how you can use the AWS CLI to perform various
operations on the Ozone storage elements. All the examples specify the alias
|Creating a bucket||
This command creates a bucket buck1.
|Adding objects to a bucket||
This command adds the key Doc1 containing data from Doc1.md to the bucket buck1.
|Listing objects in a bucket||
This command lists the objects in the bucket buck1. An example output of the command is as follows:
|Downloading an object from a bucket||
This command downloads the key Doc1 from the bucket buck1 as a file Dpc1. An example output of the command is as follows:
|Verifying access to a bucket||
This command verifies whether the bucket buck1 exists and whether the current user has access to buck1. If both the requirements are satisfied, the command returns no output. Otherwise, it displays an error message.
|Returning object metadata||
This command returns the metadata of key Doc1 present in bucket buck1. An example output of the command is as follows:
|Copy a key from one bucket to another||
This command copies the key Doc1 from bucket buck1 to buck2. The following example shows the result of a copy operation:
To verify whether the specified object is copied, you can run the
|Deleting an object from a bucket||
This command deletes the key Doc1 from bucket buck1.
|Deleting multiple objects from a bucket||
This command deletes the keys Doc1, Doc2, and Doc3 from bucket buck1.