Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Configure S3cmd for Oracle Cloud Infrastructure Object Storage
Introduction
S3cmd is a tool for managing Amazon S3 storage space and Amazon CloudFront content delivery network but could also be used for S3 compatible storage options like what is offered by Oracle Cloud Infrastructure(OCI).
The Object Storage Service provided by Oracle Cloud Infrastructure and Amazon S3 use similar concepts and terminology. In both cases, data is stored as objects in buckets. The differences are in the implementation of features and tools for working with objects.
Objective
Configure S3cmd for OCI Object Storage.
Prerequisites
-
Access to an Oracle Cloud Tenancy.
-
Permissions to manage OCI Object Storage resources.
-
A Linux VM to install S3cmd.
Task 1: Generate the Customer Secret Key
-
Generate a Customer Secret Key by going to the user details page and save the secret key generated as it won’t be available later. You can refer this documentation.
-
Copy and save the access key generated as well after the secret key has been generated.
Task 2: Install and Configure S3cmd
-
Install S3cmd in a linux VM using the below commands:
sudo yum install python3-pip sudo pip3 install s3cmd
-
Configure S3cmd using the following command.
s3cmd –-configure
-
Add the access key and secret key copied in Task 1.
Note: If your application does not support setting the region identifier to the correct Oracle Cloud Infrastructure identifier, you must either set the region to us-east-1 or leave it blank. Using this configuration, you can only use the Amazon S3 Compatibility API in your Oracle Cloud Infrastructure home region. If you can manually set the region, you can use the application against any Oracle Cloud Infrastructure region.
-
Add the endpoint url with details as mentioned below.
{bucket_namespace}.compat.objectstorage.{region}.oraclecloud.com
Task 3: Configure Amazon S3 Compatibility API Designated Compartment
-
Under the tenancy details page, click Edit Object Storage Settings.
-
In the Edit Object Storage Settings dialog:
a. Select the compartment that you want for the Amazon S3 Compatibility API Designated Compartment.
b. If you do not have a compartment, you can create one separately and add the same as the Amazon S3 Compatibility API Designated Compartment.
-
Click Save.
The new Object Storage Settings are displayed.
Note: The user whose customer secret key was used to configure S3cmd should have bucket and object manage permissions in Oracle Cloud Infrastructure Identity and Access Management (OCI IAM).
Task 4: Test S3cmd
-
Create the bucket with S3cmd using the command:
s3cmd mb s://<bucket-name>
-
To upload an object to the created bucket, use the command:
s3cmd put <FILE…> s://<bucket-name>
-
You can check that the created bucket is listed in the object storage page within your S3 Compatibility API Designated Compartment.
-
Also, you can check the uploaded file inside the bucket.
-
You can find the list of commands in the man page of the S3cmd command.
Related Links
Acknowledgments
Author - Maninder Singh Flora (OCI Cloud Architect)
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Configure S3cmd for Oracle Cloud Infrastructure Object Storage
F86193-01
September 2023
Copyright © 2023, Oracle and/or its affiliates.