Creating Containers

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).

Note:

Before you create your first container, check the replication policy set for your account. See About Replication Policy for Your Account.
You can create containers by using the following interfaces:
Interface Resources

Web Console

(Not available on Oracle Cloud at Customer)
See Creating a Container Using the Web Console.

RESTful API

See:

Java Library

See createContainer in Java API Reference for Oracle Cloud Infrastructure Object Storage Classic.

File Transfer Manager API

See createContainer in Java API Reference for Oracle Cloud Infrastructure Object Storage Classic File Transfer Manager.

File Transfer Manager CLI

See Creating a Container in Command-Line Reference for Oracle Cloud Infrastructure Object Storage Classic.

To create an archive container, you must set the X-Storage-Class header to Archive. For more information, see Creating Archive Containers. (Not available on Oracle Cloud at Customer)

Creating a Container Using the Web Console

(Not available on Oracle Cloud at Customer)
  1. Sign in to the Oracle Cloud Infrastructure Object Storage Classic console.
  2. Click Create Container.

    The Create Container dialog box is displayed.

  3. Enter a name for the container.

    Note:

    Ensure that the container name complies with the input restrictions mentioned in Character Restrictions.
  4. Select Standard in the Storage Class field.
  5. To set a replication policy for the container, see Setting a Container-Specific Policy Using the Web Console.

    Note:

    This option is available only for accounts created after March 2018.
  6. 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

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

cURL Command Examples

Sample Cloud account with the following details:
  • Account name: acme
  • REST Endpoint URL: https://acme.storage.oraclecloud.com/v1/Storage-acme
  • REST Endpoint (Permanent) URL: https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365

    Note:

    The REST Endpoint (Permanent) URL is displayed for the accounts created after November 2017.
  • Using the REST Endpoint URL obtained from the REST Endpoint field in the My Services dashboard:
    curl -v -X PUT \
         -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \
         https://acme.storage.oraclecloud.com/v1/Storage-acme/FirstContainer
    

    The following is an example of the output of this command:

    > PUT /v1/Storage-acme/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: acme.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
    
  • Using the Service Permanent REST Endpoint URL obtained from the REST Endpoint (Permanent) field in the My Services dashboard:

    Note:

    This cURL command example applies to the accounts created after November 2017.
    curl -v -X PUT \
         -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \
         https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365/FirstContainer
    

    The following is an example of the output of this command:

    > PUT /v1/Storage-7b16fede61e1417ab83eb52e06f0e365/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: storage-7b16fede61e1417ab83eb52e06f0e365.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 setting the replication policy in the container, see Setting a Container-Specific Policy Using the REST API.

For information about getting details of a container, see Getting Container Metadata.