s3.bucket-access.set-policySet the bucket policy (AWS grammar: the public, organizations, IAM users)
Principal "*" (public), or {"EWS": [<org id> | rn:ews::<org>:iam:user/<id>]}; another organization needs its own IAM to allow the action too. Resources as arn:aws:s3:::<bucket>/… or EWS RNs; s3:ListBucket is accepted for s3:ListObjects. 403 when the policy would make the bucket public while blockPublicPolicy is on; 400 for a principal that does not exist.
Request syntax
PUT /s3/api/buckets/{name}/policy
{
"policy": "string"
}Path parameters
nameRequiredstring
Constraints: 3-63 chars, /^[a-z0-9][a-z0-9-]*[a-z0-9]$/
Request body
policyRequiredstring
The policy document as JSON text, as `aws s3api put-bucket-policy` takes it
Constraints: 1-20480 chars
Response
200; data is { policy, public }: the policy as saved and whether the bucket is now public.
A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.
Errors
- 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
- 401No credentials, or an access key that is unknown, revoked or expired.
- 403The caller's policies do not allow s3:PutBucketPolicy on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
- 404The resource does not exist in your organization.
Examples
The required parameters only, with example values. Replace id and the other placeholders with your own.
dcloud s3 bucket-access set-policy name --policy examplecurl -X PUT "https://console.platform-development.deutschecloud.app/s3/api/buckets/name/policy" \
-H "Authorization: EWS-ACCESS-KEY $ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{"policy":"example"}'Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_s3_bucket-access_set-policy.