Home Storage Keep production and test apart, with least-privilege keys

Keep production and test apart, with least-privilege keys

Last updated on Nov 12, 2026

One S3 key that can do everything is the most common Object Storage risk. If it leaks from a test laptop or a log file, it can delete your production data. This guide shows the setup regulated teams use:

  • Production and test are fully separate. Each has its own projects, containers and keys.
  • The project that owns the data is not the project your services use. A service key can read and write files. It cannot delete containers, remove old versions, change who has access, or turn off encryption.
  • Each service gets only what it needs. For example, an upload service gets read and write, and a reporting service gets read only.

This setup is available for containers in Kigali (https://s3.kgl.gewapecloud.com).

How it works

On Gewape Cloud an S3 key acts as the project it was created in. So you give each kind of access its own small project, and the container owner decides, with a container policy, what each of those projects may do.

Project What it holds Who uses it
yourorg-prod-data Production containers One or two named owners. No application runs here.
yourorg-prod-upload Only the S3 key for that service The upload service
yourorg-prod-reports Only the S3 key for that service The reporting service
yourorg-test-data and yourorg-test-... The same layout for test Your team and test services

Create one service project per kind of access, not per server. Ten servers that do the same job share one service project, each with its own key.

Step 1: Create your projects

Signed in as an owner of your main project, click the account icon at the top right, choose Projects, then Create project. Create one for production data, one per service, and the same for test. Step by step: Create and switch projects.

All of them belong to your account and are billed to your one wallet. To work in one, open Projects again and click Switch.

Step 2: Create a key in each project

For each service project, first add a service login: in Projects, click Access next to it, enter a shared team mailbox (for example upload-prod@yourcompany.com), choose Engineer and click Add. Sign in as that login for the next steps, and create its Application Credential with no expiry date. The service's key then never depends on one person.

Follow Get S3 access keys for your Object Storage containers once per project. Before you create the Application Credential, switch to the right project (account icon, Projects, Switch): the keys always belong to the project you are in.

Then note each service project's ID. You need it in step 4:

openstack project show yourorg-prod-upload -f value -c id

Keep the data project's key for administration only. Never put it in an application.

Step 3: Create the container and protect it

With the data project's key:

S3="aws --endpoint-url https://s3.kgl.gewapecloud.com"
$S3 s3api create-bucket --bucket yourorg-prod-files
$S3 s3api put-bucket-versioning --bucket yourorg-prod-files --versioning-configuration Status=Enabled

Versioning keeps earlier copies of every file, so an overwrite or a delete can always be undone by the owners.

Container names are shared across the whole platform, so start them with your organization name.

Step 4: Give each service exactly what it needs

Save this as policy.json, with your container name and the two project IDs from step 2:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "upload-read-write",
      "Effect": "Allow",
      "Principal": {"AWS": ["arn:aws:iam::UPLOAD_PROJECT_ID:root"]},
      "Action": ["s3:PutObject", "s3:GetObject"],
      "Resource": ["arn:aws:s3:::yourorg-prod-files/*"]
    },
    {
      "Sid": "reports-read",
      "Effect": "Allow",
      "Principal": {"AWS": ["arn:aws:iam::REPORTS_PROJECT_ID:root"]},
      "Action": ["s3:GetObject"],
      "Resource": ["arn:aws:s3:::yourorg-prod-files/*"]
    },
    {
      "Sid": "both-list",
      "Effect": "Allow",
      "Principal": {"AWS": ["arn:aws:iam::UPLOAD_PROJECT_ID:root", "arn:aws:iam::REPORTS_PROJECT_ID:root"]},
      "Action": ["s3:ListBucket"],
      "Resource": ["arn:aws:s3:::yourorg-prod-files"]
    }
  ]
}

Apply it with the data project's key:

$S3 s3api put-bucket-policy --bucket yourorg-prod-files --policy file://policy.json

Write the principal exactly as arn:aws:iam::PROJECT_ID:root, which means "S3 keys from that project". Other formats you may know from AWS do not match, and the service is refused.

Anything you do not list is refused: deleting files, deleting versions, deleting the container, changing the policy, versioning or encryption. If a service really must delete files, add "s3:DeleteObject" to its statement only. Earlier versions are still kept, and only the owners can remove them.

Step 5: Prove it before you go live

With the upload service's key, every one of these must answer AccessDenied:

$S3 s3api delete-bucket --bucket yourorg-prod-files
$S3 s3api put-bucket-versioning --bucket yourorg-prod-files --versioning-configuration Status=Suspended
$S3 s3api put-bucket-policy --bucket yourorg-prod-files --policy file://policy.json
$S3 s3api delete-object --bucket yourorg-prod-files --key some-file.txt

With the reports service's key, an upload must be refused too:

$S3 s3 cp test.txt s3://yourorg-prod-files/

Keep the output for your security records. Then repeat steps 2 to 5 for test, with separate keys and containers. Never copy a production key into test.

Upload and download links, and websites

Pre-signed links let a browser or a mobile app upload or download one file without ever seeing a key. Sign them on your server with the service key that has the access. In Python (boto3):

url = s3.generate_presigned_url("put_object",
        Params={"Bucket": "yourorg-prod-files", "Key": "uploads/1.wav"}, ExpiresIn=900)

Uploads straight from your website (CORS): allow your site's address on the container, with the data project's key:

$S3 s3api put-bucket-cors --bucket yourorg-prod-files --cors-configuration '{"CORSRules":[{"AllowedOrigins":["https://app.yourdomain.com"],"AllowedMethods":["GET","PUT"],"AllowedHeaders":["*"],"MaxAgeSeconds":3000}]}'

List only your real website addresses. Never use * on a container that holds personal data.

Encryption with your own key

In Kigali you can also encrypt every file with a key that lives in your data project, so you can switch off access to the data yourself at any time. It works with this setup unchanged: Encrypt Object Storage with your own key.

Good practice

  • Two owners per data project, so access never depends on one person.
  • Change a service key by creating the new key, switching the service over, then deleting the old one with openstack ec2 credentials delete ACCESS_KEY.
  • Keys belong to the login that created them, and a key created with an Application Credential stops working when that credential expires or is deleted. That is why each service uses a service login (step 2) with an Application Credential that has no expiry date.
  • Review who can use each project in Projects > Access when people join or leave.
  • Never put keys in code, images, tickets or chat. Gewape Cloud will never ask for them.

If something does not work

  • AccessDenied for a service that should have access: check the principal is arn:aws:iam::PROJECT_ID:root with the service project's ID, and that the key was created in that project.
  • AccessDenied for everything with the data key: you are using a service key, or the endpoint is not https://s3.kgl.gewapecloud.com.
  • MalformedPolicy: check the JSON, especially commas and the container name in Resource.

Want us to check your setup? Use the chat on this page. We review policies and run the go-live check with you, and we never need your secret keys to do it.