Skip to content

Commit 4d9bf42

Browse files
mgajdakangastapaketeserrano
authored
docs: add missing policy attachment step for object storage (#637)
* docs: add missing policy attachment step for object storage 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 #570 * docs: add missing policy attachment step for object storage 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 #570 * Apply suggestions from code review 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> * docs: parse dynamic values for object storage example testing Address review feedback from paketeserrano on PR #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. * docs: skip curl policy attachment in CI tests 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. * chore: remove user deletion --------- Co-authored-by: Toni Kangas <kangasta@users.noreply.github.com> Co-authored-by: Francisco Serrano <59340762+paketeserrano@users.noreply.github.com> Co-authored-by: Francisco Serrano <francisco.serrano@upcloud.com>
1 parent 37677a0 commit 4d9bf42

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

examples/use_object_storage.md

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,55 @@ Create a user and an access key for S3-compatible access:
3232

3333
```sh
3434
upctl object-storage user create ${prefix}service --username ${prefix}user
35-
upctl object-storage access-key create ${prefix}service --username ${prefix}user
35+
36+
# Create access key and save credentials
37+
access_key_output=$(upctl object-storage access-key create ${prefix}service --username ${prefix}user -o json)
38+
access_key_id=$(echo "$access_key_output" | jq -r '.access_key_id')
39+
secret_access_key=$(echo "$access_key_output" | jq -r '.secret_access_key')
3640
```
3741

38-
Once not needed anymore, delete the user:
42+
Save the access key ID and secret access key from the output - you'll need these for S3 access.
3943

40-
```sh
41-
upctl object-storage user delete ${prefix}service --username ${prefix}user
44+
Attach a policy to grant the user access to buckets:
45+
46+
1. **Using the UpCloud API:**
47+
48+
First, get your service UUID:
49+
```sh
50+
service_uuid=$(upctl object-storage list -o json | jq -r ".[] | select(.name == \"${prefix}service\") | .uuid")
51+
```
52+
53+
Then attach the policy (requires UPCLOUD_TOKEN environment variable):
54+
```sh when="false"
55+
# Note: This command requires a bearer token which can be created via the UpCloud Control Panel
56+
# The when=false flag skips this in automated tests since only username/password are available in CI
57+
curl -X POST "https://api.upcloud.com/1.3/object-storage-2/${service_uuid}/users/${prefix}user/policies" \
58+
-H "Authorization: Bearer ${UPCLOUD_TOKEN}" \
59+
-H "Content-Type: application/json" \
60+
-d '{"name": "ECSS3FullAccess"}'
61+
```
62+
63+
A successful response returns HTTP status 204.
64+
65+
2. **Using the UpCloud Control Panel:**
66+
Navigate to Object Storage → Users → Select user → Attach Policy → ECSS3FullAccess
67+
68+
**Note:** Without attaching a policy, the user won't have permission to access buckets via AWS CLI or S3-compatible tools.
69+
70+
Verify S3 access with AWS CLI:
71+
72+
```sh when="false"
73+
# Get the service endpoint
74+
service_endpoint=$(upctl object-storage show ${prefix}service -o json | jq -r '.endpoints[0].domain_name')
75+
76+
# Configure AWS CLI with your credentials and test access
77+
AWS_ACCESS_KEY_ID=${access_key_id} \
78+
AWS_SECRET_ACCESS_KEY=${secret_access_key} \
79+
aws s3 ls --endpoint-url https://${service_endpoint}
4280
```
4381

44-
Delete also the managed object storage service along with all its sub-resources such as buckets and users:
82+
Delete the managed object storage service along with all its sub-resources such as buckets and users:
4583

4684
```sh
4785
upctl object-storage delete ${prefix}service --force
48-
```
86+
```

0 commit comments

Comments
 (0)