5 Creating an Object Storage Classic Container
A container is a storage compartment that provides a way to organize the data stored in Oracle Cloud Infrastructure Object Storage Classic.
Any user with the Service Administrator role can create containers. You should create at least one container for your account. Containers are similar to a directory structure but with a key distinction: unlike directories, containers cannot be nested. By default, all containers are of the standard storage class (as opposed to the archive storage class). You can also create containers when provisioning an Oracle Database Cloud Service deployment or Data Integration Platform Cloud instance.
Note:
Before you create your first container, make sure that the replication policy has been set for your account. See About Replication Policy for Your Account in Using Oracle Cloud Infrastructure Object Storage Classic.
Interface | Resources |
---|---|
Web Console (Not available on Oracle Cloud Machine) |
|
RESTful API |
|
Java Library |
See |
File Transfer Manager API |
See |
To create an archive container, you must set the X-Storage-Class header to Archive. For more information, see Creating Archive Containers in Using Oracle Cloud Infrastructure Object Storage Classic. (Not available on Oracle Cloud Machine)
Creating a Container Using the Web Console
(Not available on Oracle Cloud Machine)
If this is your first time using Oracle Cloud, make sure that you customize your My Services dashboard to show Storage Classic. To show Storage Classic on your Dashboard:
-
On your My Services Dashboard, click Customize Dashboard.
-
In the Customize Dashboard dialog, locate Storage Classic under Infrastructure, and then click Show.
Storage Classic then appears in your Dashboard. You can close the Customize Dashboard dialog to return to your Dashboard.
-
From the Storage Classic Action menu, select Open Service Console.
-
If this is your first time accessing Storage Classic, you’ll be asked to set a Geolocation Policy. Select the appropriate policy from the menu, and then click Set Policy.
-
Click Create Container.
The Create Container dialog box is displayed.
-
Enter a name for the container.
Note:
Ensure that the container name complies with the input restrictions mentioned in Character Restrictions in Using Oracle Cloud Infrastructure Object Storage Classic. -
Select
Standard
in the Storage Class field. -
Click Create.
The container is created and displayed in the console.
Creating a Container Using the REST API
cURL Command Syntax
curl -v -X PUT \ -H "X-Auth-Token: token" \ accountURL/containerName
token
is the authentication token obtained earlier from Oracle Cloud Infrastructure Object Storage Classic. See Authenticating Access When Using the REST API in Using Oracle Cloud Infrastructure Object Storage Classic.- For the syntax of
accountURL
, see About REST URLs for Oracle Cloud Infrastructure Object Storage Classic Resources in Using Oracle Cloud Infrastructure Object Storage Classic. containerName
is the name of the container to be created.Note:
Ensure that the container name complies with the input restrictions mentioned in Character Restrictions in Using Oracle Cloud Infrastructure Object Storage Classic.
Note:
When you send a REST API request to Oracle Cloud Infrastructure Object Storage Classic, all non-ASCII characters in container names, object names and metadata values must be URL-encoded. For example, my container
should be encoded as my%20container
, where %20
is the HTML encoding for the space character. Similarly, my Über Container
should be encoded as my%20%C3%9Cber%20Container
, where %20
represents the space character and %C3%9C
is the Ü
character.
HTTP Response Codes
-
Success:
201 Created
-
Failure: See A Error Code Reference for Object Storage Classic in Using Oracle Cloud Infrastructure Object Storage Classic.
cURL Command Example
curl -v -X PUT \ -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \ https://foo.storage.oraclecloud.com/v1/myservice-bar/FirstContainer
The following is an example of the output of this command:
> PUT /v1/myservice-bar/FirstContainer HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: foo.storage.oraclecloud.com
> Accept: */*
> X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b
>
< HTTP/1.1 201 Created
< Date: Fri, 06 Mar 2015 10:34:20 GMT
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
< X-Trans-Id: tx23a1084b8c674fdeae8d4-0054f982ac
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Language: en
For information about getting details of a container, see Getting Container Metadata.