-
Notifications
You must be signed in to change notification settings - Fork 276
Bucket Policies
VersityGW supports bucket policies that follow the same JSON structure as AWS S3 bucket policies. The key difference is how principals are specified: instead of AWS IAM ARNs, you use the user account names configured in VersityGW's IAM backend.
A bucket policy is a resource-based access control policy attached to a bucket. It defines which users can perform which S3 actions on the bucket and its objects. Bucket policies complement user-level permissions and are evaluated alongside them.
Bucket policies in VersityGW support the standard S3 policy elements:
| Element | Description |
|---|---|
Version |
Policy language version. Use "2012-10-17". |
Statement |
Array of permission statements. |
Sid |
Optional statement identifier. |
Effect |
"Allow" or "Deny". |
Principal |
User account name(s) the statement applies to. |
Action |
S3 action(s) to allow or deny. |
Resource |
The bucket or object ARN(s) the policy applies to. |
Condition |
Optional conditions for the policy to apply. |
In AWS S3, principals are specified as IAM ARNs such as "arn:aws:iam::123456789012:user/alice". In VersityGW, principals are simply the user account names as defined in your IAM configuration — for example, "user1" or "alice".
You can specify a single principal as a string or multiple principals as an array:
"Principal": "user1""Principal": ["user1", "user2"]To grant access to all users (including unauthenticated requests), use the wildcard:
"Principal": "*"Resources are specified as S3 ARNs. Use the bucket name without an account ID or region:
-
Bucket-level actions (e.g.,
s3:ListBucket):"arn:aws:s3:::mybucket" -
Object-level actions (e.g.,
s3:GetObject):"arn:aws:s3:::mybucket/*"
You can target a specific prefix within a bucket:
"Resource": "arn:aws:s3:::mybucket/logs/*"The following policy grants user1 and user2 read-only access to mybucket, including the ability to list the bucket and its multipart uploads and to read objects and their metadata:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadOnlyS3Access",
"Effect": "Allow",
"Principal": [
"user1",
"user2"
],
"Action": [
"s3:GetObject",
"s3:GetObjectAttributes",
"s3:GetObjectRetention",
"s3:GetObjectTagging",
"s3:ListBucket",
"s3:ListBucketMultipartUploads",
"s3:ListMultipartUploadParts"
],
"Resource": [
"arn:aws:s3:::mybucket",
"arn:aws:s3:::mybucket/*"
]
}
]
}Note: The
Resourcearray should include both the bucket ARN (for bucket-level actions such ass3:ListBucket) and the object wildcard ARN (for object-level actions such ass3:GetObject). A policy that only listsarn:aws:s3:::mybucket/*will not permits3:ListBucket.
Save your policy to a JSON file (e.g., policy.json), then use the put-bucket-policy command. Point the CLI at your VersityGW endpoint using --endpoint-url.
aws s3api put-bucket-policy \
--endpoint-url https://your-versitygw-host:7070 \
--bucket mybucket \
--policy file://policy.jsonaws s3api get-bucket-policy \
--endpoint-url https://your-versitygw-host:7070 \
--bucket mybucketaws s3api delete-bucket-policy \
--endpoint-url https://your-versitygw-host:7070 \
--bucket mybucketYou can explicitly deny access to a specific user regardless of other permissions. The following policy denies baduser all access to the bucket:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyBadUser",
"Effect": "Deny",
"Principal": "baduser",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::mybucket",
"arn:aws:s3:::mybucket/*"
]
}
]
}Note: An explicit
Denyalways overrides anAllow, even if another statement grants the user access.
VersityGW supports the standard S3 policy actions. Common examples include:
| Action | Description |
|---|---|
s3:GetObject |
Download objects |
s3:PutObject |
Upload objects |
s3:DeleteObject |
Delete objects |
s3:ListBucket |
List objects in a bucket |
s3:GetBucketPolicy |
Read the bucket policy |
s3:PutBucketPolicy |
Write the bucket policy |
s3:DeleteBucketPolicy |
Delete the bucket policy |
s3:GetObjectTagging |
Read object tags |
s3:PutObjectTagging |
Write object tags |
s3:GetObjectRetention |
Read object retention settings |
s3:PutObjectRetention |
Write object retention settings |
s3:ListBucketMultipartUploads |
List in-progress multipart uploads |
s3:ListMultipartUploadParts |
List parts of a multipart upload |
s3:AbortMultipartUpload |
Abort a multipart upload |
s3:* |
All S3 actions |
- Home
- User:
- Quickstart
- System Requirements
- Install
- Workflow
- Global Options
- Troubleshooting
- TLS
- Virtual Host Addressing
- HA/Load Balancing
- Event Notifications
- Docker / Helm
- PreSignedURL
- Multi Tenant/IAM
- Example Client Configs
- Incompatibilities with AWS S3
- Metrics
- Admin APIs
- Backends:
- Logging:
- WebGUI
- S3 RDMA
- Testing
- Third Party Packaging
- Developer:
- Articles:



