Home › Docs › CDPStorage – Getting started

Docs

CDPStorage – Getting started

This guide takes you from an empty installation to the first object stored over the S3 API: create a project (bucket), create an access key, configure a program and upload, list and download a file.
<STORAGE_HOST> and <DRIVE_HOST> are the addresses of your own installation, for example storage.example.com and drive.example.com.
<BUCKET>, <ACCESS_KEY> and <SECRET_KEY> are your own values.

Before you start

  • You can sign in to the web interface at https://<DRIVE_HOST>/login as an administrator (projects and access keys are created by administrators).
  • The Storage module is switched on (Settings → Modules → module_storage) and licensed.
  • At least one storage node is online (page "Storage nodes").
  • The clock of the computer that runs your program is correct; requests more than 15 minutes off are rejected.

Step 1: Create a project (bucket)

  1. Open "Projects" in the web interface and create a new project.
  2. Enter a free name, for example "Product images". The bucket name is derived automatically (for example product-images) and can be edited before creation.
  3. Bucket names follow the S3 rules: 3–63 characters, lower-case letters, digits, dots and hyphens, starting and ending with a letter or digit, not in the form of an IP address. Bucket names are unique within the installation.
  4. Optionally choose the number of copies (1–9; default from the settings, normally 2).

The new project is available at once in CDPStorage (S3), in CDPDrive (file browser, share links) and in CDPCDN (zone with the same name).

Step 2: Create an access key

  1. Open the page "Access keys (S3)" (https://<DRIVE_HOST>/keys).
  2. Under "New key" enter a name (for example the program that will use it).
  3. Choose the project (bucket) or "all projects", optionally a prefix such as backups/.
  4. Tick the rights the program needs: Read, Write, Delete. At least one right is required.
  5. Optionally allow "Create buckets", set "Valid for (days, 0 = unlimited)" and enter allowed IP addresses (comma-separated, CIDR allowed).
  6. Click "Create key". The access key id (it starts with CDPK) and the secret are shown. Copy the secret now – it is shown only this once. If it is lost, create a new key.

Administrators with console access can also run php artisan cdpdrive:key create <name> --project=<BUCKET> --rights=read,write,delete;
the secret is printed once.

Step 3: Configure your program

Every S3-compatible program needs the same values:

SettingValue
Endpoint / serverhttps://<STORAGE_HOST> (port 443)
Regioneu-fra (any string is accepted)
AddressingPath style (often "force path style" or "path-style access")
SignatureVersion 4
Access key id<ACCESS_KEY>
Secret access key<SECRET_KEY>
Bucket<BUCKET>

Step 4: Upload, list and download

The following examples use curl (version 7.75 or newer), which can sign requests with Signature Version 4. The header x-amz-content-sha256 is required by CDPStorage.

Upload a file:

curl --aws-sigv4 "aws:amz:eu-fra:s3" \
  --user "<ACCESS_KEY>:<SECRET_KEY>" \
  -H "x-amz-content-sha256: UNSIGNED-PAYLOAD" \
  -T report.pdf \
  "https://<STORAGE_HOST>/<BUCKET>/docs/report.pdf"

List the objects under docs/:

curl --aws-sigv4 "aws:amz:eu-fra:s3" \
  --user "<ACCESS_KEY>:<SECRET_KEY>" \
  -H "x-amz-content-sha256: UNSIGNED-PAYLOAD" \
  "https://<STORAGE_HOST>/<BUCKET>?list-type=2&prefix=docs/"

Download the file again:

curl --aws-sigv4 "aws:amz:eu-fra:s3" \
  --user "<ACCESS_KEY>:<SECRET_KEY>" \
  -H "x-amz-content-sha256: UNSIGNED-PAYLOAD" \
  -o report.pdf \
  "https://<STORAGE_HOST>/<BUCKET>/docs/report.pdf"

A successful upload answers with HTTP 200 and an ETag header.
Errors come back as S3 XML documents with a code such as AccessDenied or NoSuchBucket.

Step 5: Check the result in CDPDrive

Open the project in the web interface.
The folder docs and the file report.pdf are shown in the file browser.
With the Button "Use" next to the file you see its S3 address (s3://<BUCKET>/docs/report.pdf), can create a share link and –
if CDN delivery is on –
copy the CDN address.
On the page "Access keys (S3)" the column "Last used" now shows that the key was used.