Skip to content

Deploy your own S3 using API

Let's check how we can create a public S3 storage using APIs (Application Programming Interface).

Using the DNS feature provided on the whitesky.cloud BV portal, you can simply create a publicly accessible S3 storage in less steps. However, this tutorial can help you understand how you can use reverse proxies with APIs.

To learn more about how you can use DNS on the whitesky.cloud BV portal, check the DNS Documentation.

Steps to create S3 storage using API

In the following steps, you will need to replace all the variables like <CUSTOMER_ID>, <CLOUDSPACE_ID>...etc. with their values.

  1. Create your cloudspace using the following API endpoint and pass a payload that configures your cloudspace with your request.

    POST/customers/<CUSTOMER_ID>/cloudspaces
    
    Payload:
        {
        "name": "publics3api",
        "location": "be-mac-dc01-001",
        "firewall": {
            "private": false,
            "external_network_id": 3,
            "custom": {}
            }
        }
    

  2. External Network ID changes from one location to another. To get your External Network IP use the following API endpoint.

    GET/customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>
    
  3. After your cloudspace is created, you can create an objectspace using the following API endpoint and pass the name and location of your objectspace in a payload with your request

    POST/customers/<CUSTOMER_ID>/objectspaces
    
    Payload:
        {
        "name": "publicS3",
        "location": "be-mac-dc01-001",
        }
    

  4. Use the following API endpoint to connect your new objectspace to your cloudspace.

    POST/customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/objectspaces 
    
  5. Get your Private IP (cloudspaces => ip_address), Access Key and Secret using the following API endpoint.

    GET/customers/<CUSTOMER_ID>/objectspaces/<OBJECTSPACE_ID>
    
  6. Create a serverpool on your cloudspace using the following API endpoint and pass the serverpool name in a payload with your request.

    POST/alpha/customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/ingress/server-pools
    
    Payload:
        {
        "name": "<SERVERPOOL_NAME>",
        }
    

  7. Add your objectspace to the serverpool that we have just created using the following API endpoint and pass the address of your objectspace in a payload with your request.

    POST/alpha/customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/ingress/server-pools/<SERVERPOOL_ID>/hosts
    
    Payload:
        {
        "address": "<PRIVATE_IP_OF_OBJECTSPACE>",
        }
    

  8. Now we will use the following API endpoint to create a reverse proxy and associate our request with a payload that specifies the reverse proxy configuration.

    POST/alpha/customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/ingress/reverse-proxies
    
    Payload:
        {
            "name": "myrevproxy",
            "description": "string",
            "front_end": {
                "domain": "<DOMAIN-NAME>",
                "http_port": 80,
                "https_port": 443,
                "scheme": "https",
                "letsencrypt": {
                "enabled": true,
                "email": "<EMAIL-ADDRESS>"
                }
            },
            "back_end": {
                "scheme": "http",
                "serverpool_id": "fce65ea3447947689a0a15c82266853c",
                "target_port": 80,
                "options": {
                "sticky_session_cookie": {
                    "name": "test",
                    "secure": true,
                    "http_only": true,
                    "same_site": "true"
                },
                "health_check": {
                    "path": "/",
                    "scheme": "http",
                    "port": 80,
                    "interval": 1000,
                    "timeout": 1000
                }
                }
            }
        }
    

You can check how to access your objectspace from MinIO client and how to share from external services to your objectspace in the user interface section.

See Also

  1. Deploy your S3 storage using whitesky.cloud BV user interface.
  2. Deploy your S3 storage using CLI.
  3. Create publicly accessible S3 storage using DNS.