Access keys and permissions
S3 tools sign their requests with an access key: an access key ID that starts with DH and a secret access key. Access keys are separate from your DockHive API keys (dh_pat_...), which work with the DockHive REST API but not with S3 tools.
Create an access key
Section titled “Create an access key”- In the console, open Hive Buckets → Access keys and click Create access key.
- Enter a Name, for example
production-app. - Under Buckets, choose All buckets or Selected buckets and tick the buckets the key may use.
- Choose a Permission (see below).
- Click Create key. Copy the Access key ID and the Secret access key.
You can also create keys with the REST API.
Permissions
Section titled “Permissions”| Permission | In the console | What the key can do |
|---|---|---|
read |
Read only | Download objects and their versions (GET, HEAD), list objects, versions, multipart uploads and parts, and read ACLs, tags, retention, legal holds and bucket settings. |
read-write |
Read & write | Everything read can, plus upload (PUT, POST, copy, multipart), delete objects and versions, and set object tags, retention and legal holds. |
admin |
Admin | Everything read-write can, plus bucket and object ACLs (including uploads with x-amz-acl: public-read), CORS, lifecycle, Block Public Access, versioning, object lock settings, bucket policies, bucket tags, deleting buckets and bypassing governance retention. |
Give each app the least it needs: a site that only serves files needs Read only; an app that stores user uploads needs Read & write. Keep Admin keys for setup scripts and infrastructure tools.
Bucket scope
Section titled “Bucket scope”- A key for All buckets works with every bucket you own, including ones you create later.
- A key for Selected buckets works only with those buckets, and
ListBucketsshows only them. - Creating a bucket over S3 (
CreateBucket) needs an Admin key for All buckets. Creating buckets in the console is usually simpler.
Revoke a key
Section titled “Revoke a key”In Hive Buckets → Access keys, revoke the key. Requests signed with it stop working within a minute. The list shows when each key was last used, which helps you find keys nobody needs any more.
REST API
Section titled “REST API”With a DockHive API key, manage buckets and access keys through the DockHive API under /api/v1/buckets/. Pass the bucket’s region with ?region=.
# List your buckets in eucurl "https://api.dockhive.io/api/v1/buckets/buckets?region=eu" \ -H "Authorization: Bearer $DOCKHIVE_API_KEY"
# Create a read-write access key for two buckets (the secret is returned only in this response)curl -X POST "https://api.dockhive.io/api/v1/buckets/keys?region=eu" \ -H "Authorization: Bearer $DOCKHIVE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "production-app", "permission": "read-write", "buckets": ["my-app-uploads", "my-app-assets"]}'Use "all_buckets": true instead of "buckets" for a key that works with every bucket.