Skip to content

Deploy S3 via API

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

Tip

Using the DNS feature provided on the whitesky.cloud NV 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.

Tip

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

Steps to create S3 storage using API

Tip

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 as query parameters with your request (this endpoint does not take a JSON payload for these fields).

    POST /customers/<CUSTOMER_ID>/objectspaces?name=publicS3&location=be-mac-dc01-001
    
  4. Use the following API endpoint to connect your new objectspace to your cloudspace, passing the objectspace ID as a query parameter.

    POST /customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/objectspaces?objectspace_id=<OBJECTSPACE_ID>
    
  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 (and optionally a description) as query parameters with your request. Note that this endpoint no longer requires the /alpha/ prefix.

    POST /customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/ingress/server-pools?name=<SERVERPOOL_NAME>&description=<DESCRIPTION>
    
  7. Add your objectspace to the serverpool that we have just created using the following API endpoint and pass the address of your objectspace as a query parameter with your request.

    POST /customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/ingress/server-pools/<SERVERPOOL_ID>/hosts?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. This is the only ingress endpoint that takes a JSON body.

    POST /customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/ingress/reverse-proxies
    
    Payload:
        {
            "name": "myrevproxy",
            "description": "string",
            "locked": false,
            "front_end": {
                "domain": "<DOMAIN-NAME>",
                "http_port": 80,
                "https_port": 443,
                "ip_address": "<IP-ADDRESS-TO-BIND-TO>",
                "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
                }
                }
            }
        }
    

    Tip

    front_end.ip_address is optional — if omitted, the reverse proxy listens on all IP addresses of the cloudspace's external network.

You can check how to access your objectspace from MinIO client, including how to share from external services to your objectspace.

See Also

  1. Deploy your S3 storage using whitesky.cloud NV user interface.
  2. Accessing S3 via the MinIO Client
  3. Deploy your S3 storage using CLI.
  4. Create publicly accessible S3 storage using DNS.