Piloterr

Test the permissions

Check a bucket and its keys before deliveries upload to it, and get the policy and egress IP to allow.

Test a bucket before saving it: the test takes the same body as POST /v1/cloud-connections (name is optional) and stores nothing.

curl https://dataflow.piloterr.com/v1/cloud-connections/test \
  -H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
  -d '{
    "endpoint": "https://ACCOUNT_ID.r2.cloudflarestorage.com",
    "region": "auto",
    "bucket": "piloterr-exports",
    "prefix": "dataflow/",
    "access_key_id": "ACCESS_KEY_ID",
    "secret_access_key": "SECRET_ACCESS_KEY"
  }'
{
  "ok": true,
  "steps": [
    { "id": "reachable", "status": "ok", "required": true, "code": null, "message": null },
    { "id": "bucket", "status": "ok", "required": true, "code": null, "message": null },
    { "id": "credentials", "status": "ok", "required": true, "code": null, "message": null },
    { "id": "write", "status": "ok", "required": true, "code": null, "message": null },
    {
      "id": "multipart",
      "status": "skipped",
      "required": false,
      "code": "not_used",
      "message": "Not needed: deliveries upload each file in a single request"
    },
    {
      "id": "delete",
      "status": "warning",
      "required": false,
      "code": "access_denied",
      "message": "The key may not delete, which deliveries do not need: remove dataflow/.piloterr-dataflow-test-1764576000000.txt yourself"
    }
  ],
  "test_key": "dataflow/.piloterr-dataflow-test-1764576000000.txt",
  "leftover_key": "dataflow/.piloterr-dataflow-test-1764576000000.txt",
  "egress": { "enabled": true, "exit_ips": ["116.203.84.164"] },
  "policy": "{ \"Version\": \"2012-10-17\", \"Statement\": [ ... ] }"
}

A saved connection is tested with POST /v1/cloud-connections/{id}/test, which answers the same report. Send it a body with the fields of PATCH /v1/cloud-connections/{id} to test the connection as it would be after that change, still without saving anything: the stored keys are used unless you send both new ones.

The test writes one small file under the prefix, then deletes it. Each step is ok, failed, warning (it works, with something to know) or skipped (not checked, because an earlier step failed or deliveries do not need it). ok is true when every required step passed: deliveries can then upload. The answer is 200 either way.

StepChecksRequired
reachableThe endpoint is a public https origin, answers, and has a valid certificate. Private and reserved addresses (10.0.0.0/8, 192.168.0.0/16, 169.254.169.254…) are refused before any request, also when a public name resolves to one.Yes
bucketThe bucket exists at this endpoint, in this region.Yes
credentialsThe store accepts the keys.Yes
writePutObject of the test file under the prefix.Yes
multipartStarting and aborting a multipart upload. Deliveries upload each file in a single request, so it is skipped with not_used.No
deleteDeleteObject of the test file. Deliveries never delete: a refusal only warns, and leftover_key names the file to remove yourself.No

What each code means:

CodeStepFix
invalid_endpointreachableUse the store's https origin, without a path.
private_addressreachableUse the store's public endpoint: the endpoint is, or resolves to, a private or reserved address.
unreachablereachableCheck the host and port. Also when Piloterr's egress proxy is down: nothing is then sent to the bucket; try again in a few minutes.
tls_errorreachableThe certificate is expired, self-signed or for another name: use an endpoint with a valid certificate.
timeoutreachableThe endpoint did not answer within 15 seconds: check the host, and that its firewall lets the egress IP in.
no_such_bucketbucketCheck the bucket name and the endpoint.
wrong_regionbucketSet the bucket's region; the step's region gives it when the store says it.
invalid_credentialscredentialsCheck the access key ID, then enter the secret key again.
clock_skewcredentialsThe store refused the request's time: check the store's clock.
unreadable_keyscredentialsA saved connection's keys cannot be read anymore: enter both again.
access_deniedwrite, multipart, deleteAllow the action in the key's policy (below).
provider_errorwriteAnything else; message holds the store's answer.

A workspace runs up to 10 tests a minute and 60 an hour, both routes together; past that, 429 rate_limited with Retry-After. The keys are only used to sign the test's requests: they are never stored by the test, logged, or returned.

Policy and egress IP

Requests to your bucket leave from Piloterr's egress proxy, never from the Dataflow servers, for deliveries and tests alike. Its public IP is 116.203.84.164: allow it in your bucket's or key's policy. egress.exit_ips gives the same address, so a script can read it; egress.enabled is false only on a server without the proxy.

policy is a minimal IAM policy for the key, as a JSON document to copy. With the example above:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PiloterrDataflowDeliveries",
      "Effect": "Allow",
      "Action": ["s3:PutObject", "s3:DeleteObject"],
      "Resource": "arn:aws:s3:::piloterr-exports/dataflow/*",
      "Condition": { "IpAddress": { "aws:SourceIp": ["116.203.84.164/32"] } }
    }
  ]
}

s3:PutObject is all deliveries need. s3:DeleteObject is only for the test's file: leave it out and the test passes with a warning. Once deliveries use multipart uploads, s3:AbortMultipartUpload joins the list and the multipart step becomes required. Cloudflare R2 and most S3-compatible stores have no IAM policies: give the token write access to the bucket, and restrict it to the egress IP where the store allows it.

On this page