Examples of using the Amazon Web Services command-line interface for 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 --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
ozones3api
:
Operations | Examples |
---|---|
Creating a bucket |
This command creates a bucket b1. |
Adding objects to a bucket |
This command adds the key Doc1 containing data from Doc1.md to the bucket b1. |
Listing objects in a bucket |
This command lists the objects in the bucket b1. An example output of the command is as follows:
|
Downloading an object from a bucket | This
command downloads the key Doc1 from the bucket b1 as a file Dpc1. An
example output of the command is as
follows:
|
Verifying access to a bucket | This
command verifies whether the bucket b1 exists and whether the
current user has access to b1. 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 b1. 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 b1 to b2. The following
example shows the result of a copy
operation: To
verify whether the specified object is copied, you can run the
list-object command on the destination
bucket. |
Deleting an object from a bucket |
This command deletes the key Doc1 from bucket b1. |
Deleting multiple objects from a bucket |
This command deletes the keys Doc1, Doc2, and Doc3 from bucket b1. |