Using the Amazon S3 Compatibility API, customers can continue to use their existing Amazon S3 tools (for example, SDK clients) and partners can make minimal changes to their applications to work with Object Storage. The Amazon S3 Compatibility API and Object Storage datasets are congruent. If data is written to the Object Storage using the Amazon S3 Compatibility API, the data can be read back using the native Object Storage API and conversely.
Differences between the Object Storage API and the Amazon S3 Compatibility API
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.
The following highlights the differences between the two storage technologies:
Amazon S3 doesn't use compartments. By default, buckets created using the Amazon S3 Compatibility API or the Swift API are created in the root compartment of the Oracle Cloud Infrastructure tenancy. Instead, you can designate a different compartment for the Amazon S3 Compatibility API or Swift API to create buckets in.
Global bucket namespace
Object Storage doesn't use a global bucket namespace. Each tenant is associated with one default namespace that spans all compartments within a region. The namespace serves as a container for all of your buckets and objects. You control bucket names within your namespace, however, bucket names must be unique within each region. You can have a bucket named MyBucket in US West (Phoenix) and a bucket named MyBucket in Germany Central (Frankfurt).
The Oracle Cloud Infrastructure Object Storage service encrypts all data at rest by default. Encryption can't be turned on or off using the API.
Object Level Access Control Lists (ACLs)
Oracle Cloud Infrastructure does not use ACLs for objects. Instead, IAM policies are used to manage access to compartments, buckets, and objects.
Configure a new endpoint for the application that includes the namespace and the region identifier. For example: mynamespace.compat.objectstorage.us-phoenix-1.oraclecloud.com.
Set the target region as one of the Oracle Cloud Infrastructure regions.
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.
Here are some examples of configuring various client applications to talk to Object Storage's Amazon S3-compatible endpoints. You need to use an existing or create a special signing key to authenticate with Amazon S3, which is an Access Key/Secret Key pair. See Managing User Credentials for details.
// Get S3 credentials from the console and put them here AWSCredentialsProvider credentials = new AWSStaticCredentialsProvider(new BasicAWSCredentials( "gQ4+YC530sBa8qZI6WcbUbtH8oar0exampleuniqueID", "7fa22331ebe62bf4605dc9a42aaeexampleuniqueID"));
// Your namespace String namespace = "namespace";
// The region to connect to String region = "us-ashburn-1";
// Create an S3 client pointing at the region String endpoint = String.format("%s.compat.objectstorage.%s.oraclecloud.com",namespace,region); AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(endpoint, region); AmazonS3 client = AmazonS3Client.builder() .standard() .withCredentials(credentials) .withEndpointConfiguration(endpointConfiguration) .disableChunkedEncoding() .enablePathStyleAccess() .build();
s3 = boto3.resource(
region_identifier="us-phoenix-1", # Region name here that matches the endpoint
endpoint_url="https://mynamespace.compat.objectstorage.us-phoenix-1.oraclecloud.com" # Include your namespace in URL
# Print out bucket names
for bucket in s3.buckets.all():