Skip to content

docs: add missing policy attachment step for object storage#637

Merged
paketeserrano merged 9 commits intoUpCloudLtd:mainfrom
mgajda:docs/add-policy-attachment-step
Feb 9, 2026
Merged

docs: add missing policy attachment step for object storage#637
paketeserrano merged 9 commits intoUpCloudLtd:mainfrom
mgajda:docs/add-policy-attachment-step

Conversation

@mgajda
Copy link
Copy Markdown
Contributor

@mgajda mgajda commented Dec 16, 2025

Fixes #570

Adds the missing step for attaching user access policies to object storage users. Without this step, users cannot access buckets via AWS CLI even with valid S3 credentials.

Changes

  • Add policy attachment via UpCloud API (curl with bearer token)
  • Add policy attachment via web console (alternative)
  • Add S3 access verification example
  • Clarify difference between UpCloud API credentials and S3 access keys

Testing

✅ End-to-end workflow tested
✅ API endpoint verified (HTTP 204 success)
✅ Credential types clarified

This directly addresses the issue reported by @erikologic where the policy attachment step was missing from the documentation.

Add documentation for attaching user access policies to object storage
users, which is required for bucket access via AWS CLI and S3-compatible
tools.

The documentation now includes:
1. API-based policy attachment using curl with token authentication
2. Web console-based policy attachment
3. Important note about permission requirements

Fixes UpCloudLtd#570
Add complete end-to-end documentation for object storage access
including the critical policy attachment step that was missing.

Changes:
- Add policy attachment via UpCloud API (tested, returns HTTP 204)
- Add policy attachment via web console alternative
- Add S3 access verification example with AWS CLI
- Clarify credential usage (UpCloud API token vs S3 access keys)
- Include note about saving S3 access key credentials

Without the policy attachment step, users cannot access buckets
via S3-compatible tools even with valid S3 access keys.

Tested end-to-end workflow:
- Service and bucket creation ✓
- User and S3 access key creation ✓
- Policy attachment via API ✓ (HTTP 204 success)
- Documentation includes S3 access verification

Fixes UpCloudLtd#570
@mgajda mgajda requested a review from a team as a code owner December 16, 2025 11:52
Comment thread examples/use_object_storage.md
Comment thread examples/use_object_storage.md Outdated
mgajda and others added 3 commits December 29, 2025 16:25
Mark example using `aws` command as not to be tested, since command is missing on CI.

Co-authored-by: Toni Kangas <kangasta@users.noreply.github.com>
@paketeserrano
Copy link
Copy Markdown
Contributor

paketeserrano commented Jan 8, 2026

@mgajda this is a good addition since it makes the obj storage example complete covering how to enable a user to access a bucket.

These type of files are also used as tests in the workflow .github/workflows/examples.yaml and it will fail as it is. Would it be possible to add the commands to parse the service-uuid, your-access-key-id, your-secret-access-key and service-endpoint ? That would make the test that executes the shell commands in this file succeeds.

mgajda added 2 commits January 9, 2026 20:27
Address review feedback from paketeserrano on PR UpCloudLtd#637 to enable
automated testing in .github/workflows/examples.yaml:

- Parse service UUID dynamically from `upctl object-storage list`
- Capture access key credentials from JSON output
- Extract service endpoint from `upctl object-storage show`
- Replace placeholder values with actual parsed variables

This allows the documentation to function as an automated test
in the CI/CD workflow without manual value substitution.

The documentation remains readable while being executable.
The curl command for policy attachment requires UPCLOUD_TOKEN (bearer token)
but CI only provides UPCLOUD_USERNAME/PASSWORD. Mark the curl block with
when=false to skip during mdtest execution.

This fixes the exit code 102 failure in the Examples workflow. The policy
attachment is still documented for manual use and the alternative web
console method is provided.

Added explanatory comment about why this is skipped in tests.
@mgajda
Copy link
Copy Markdown
Contributor Author

mgajda commented Jan 9, 2026

@paketeserrano Did my changes work?

@paketeserrano
Copy link
Copy Markdown
Contributor

Hello @mgajda ,

I executed the code and I am getting this error:

`[17:41:14] paco@nube:~/github$ mdtest .
✗ Running test.md 140 s
Failures:

Step 6: expected exit code 0, got 253

Output:

  • upctl object-storage show example-upctl-service -o json
  • jq -r .endpoints[0].domain_name
  • service_endpoint=l6s7i.upcloudobjects.com
  • AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= aws s3 ls --endpoint-url https://l6s7i.upcloudobjects.com

Unable to locate credentials. You can configure credentials by running "aws login".

1 of 8 test steps failed

Tests: 1 failed, 1 total
Elapsed: 140.193 s
`

Although this part is not executed in the tests, users will need to login into aws according to this error. Can you add that command please?

@mgajda
Copy link
Copy Markdown
Contributor Author

mgajda commented Jan 29, 2026

Although this part is not executed in the tests, users will need to login into aws according to this error. Can you add that command please?

You are incorrect. Here we need AWS-like credentials issued by UpCloud.

That would be similar to line that is already there:

upctl object-storage access-key create my-service --username myuser --output json

So it looks like jq is using incorrect key name that possibly changed in code since?

access_key_id=$(echo "$access_key_output" | jq -r '.access_key_id')
secret_access_key=$(echo "$access_key_output" | jq -r '.secret_access_key')

@paketeserrano Unfortunately I no longer have UpCloud account to test it and see JSON output.

@paketeserrano
Copy link
Copy Markdown
Contributor

Hello @mgajda ,

The error was a bit misleading, I was testing with an old version of mdtest. Your test is correct and more descriptive now. I just made a small modification to remove a line that was deleting the user because it was not needed since the delete service --force will do it anyway.

I will be merging in a moment

@paketeserrano paketeserrano merged commit 4d9bf42 into UpCloudLtd:main Feb 9, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Object storage documentation is missing attach policy step

3 participants