Following are a few examples of common use cases and their corresponding bucket policy configurations.
To grant full control over a contract-owned bucket or a user-owned bucket and its objects to other IONOS Object Storage users:
To grant read-only access to objects within a specific prefix of a contract-owned bucket to other IONOS Object Storage users:
To grant read-only access to objects within a specific prefix of a user-owned bucket to other IONOS S3 Object Storage users:
To allow read access to certain objects within a contract-owned bucket or a user-owned bucket while keeping other objects private:
To restrict all users from performing any S3 operations within the designated bucket type, unless the request is initiated from the specified range of IP addresses:
For more information on bucket policy configurations, see , supported bucket and object , and .
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Grant Full Control",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam:::user/CONTRACT_USER_ID1",
"arn:aws:iam:::user/CONTRACT_USER_ID2"
]
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
]
}
]
}{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Grant Full Control",
"Effect": "Allow",
"Principal": {
"CanonicalUser": ["CANONICAL_USER_ID_1", "CANONICAL_USER_ID_2"]
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
]
}
]
}{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "GrantReadOnlyAccessToPrefix",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam:::user/CONTRACT_USER_ID1",
"arn:aws:iam:::user/CONTRACT_USER_ID2"
]
},
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my-bucket/prefix/*",
"arn:aws:s3:::my-bucket"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"prefix/*"
]
}
}
}
]
}{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "GrantReadOnlyAccessToPrefix",
"Effect": "Allow",
"Principal": {
"CanonicalUser": ["CANONICAL_USER_ID_1", "CANONICAL_USER_ID_2"]
},
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my-bucket/prefix/*",
"arn:aws:s3:::my-bucket"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"prefix/*"
]
}
}
}
]
}{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicRead",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example-bucket/public/*"
}
]
}{
"Id": "SourceIp",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "SourceIp",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"NotIpAddress": {
"aws:SourceIp": [
"123.123.123.0/24"
]
}
}
}
]
}Bucket Policy is a JSON-based access policy language that allows you to create fine-grained permissions for your Object Storage buckets. With Bucket Policy, you can specify which users or services can access specific objects and what actions users can perform.
Use this feature to grant access to a specific user or group to only a subset of the objects in your bucket.
Restrict access to certain operations on your bucket, for example, list objects or remove object lock.
Using Bucket Policy, you can grant access based on conditions, such as the IP address of the user.
Create fine-grained access control rules to allow a user to put objects to a specific prefix in your bucket, but not to get objects from that prefix.
Use Bucket ACL and Object ACL instead of Bucket Policy if you need to define different sets of permissions such as READ, WRITE, or FULL CONTROL to many objects.
Use Share Objects with Pre-Signed URLs to grant temporary access to authorized users for a specified period, after which the URL and the access to the object expire.
A JSON-formatted bucket policy contains one or more policy statements. Within a policy's statement blocks, IONOS Object Storage support for policy statement elements and their values is as follows:
Id (optional): A unique identifier for the policy. Example: SamplePolicyID.
Version (required): Specifies the policy language version. The current version is 2012-10-17.
Statement (required): An array of individual statements, each specifying a permission.
Sid (optional): Custom string identifying the statement. For example, Delegate certain actions to another user.
Action (required): Specifies the action(s) that are allowed or denied by the statement. See the Action section in the for the supported values. Example: s3:GetObject for allowing read access to objects.
Effect (required): Specifies the effect of the statement. Possible values: Allow, Deny.
Resource (required): Must be one of the following:
arn:aws:s3:::<bucketName> – For bucket actions (such as s3:ListBucket) and bucket subresource actions (such as s3:GetBucketAcl).
arn:aws:s3:::<bucketName>/* or arn:aws:s3:::<bucketName>/<objectName> – For object actions (such as s3:PutObject
Condition (optional): Specifies conditions for when the statement is in effect. See the Condition section in the for the supported values. Example: {"aws:SourceIp": "123.123.123.0/24"} restricts access to the specified IP range. For the list of supported bucket and object actions and condition values, see .
Principal (required): Specifies the user, account, service, or other entity to which the statement applies. For information specific to the bucket types, see the following:
"AWS": “*” – Statement applies to all users (also known as 'anonymous access').
"AWS": "arn:aws:iam:::user/<contractNumber>" – Statement applies to the specified contract number.
"AWS": ["arn:aws:iam:::user/<contractNumber>:<UUID1>", "arn:aws:iam:::user/<contractNumber>:<UUID2>", …] – Statement applies to the specified IONOS Object Storage users.
{"CanonicalUser": "*"} – Statement applies to all users (also known as 'anonymous access').
"CanonicalUser": ["<canonicalUserId>", "<canonicalUserId>",...] – Statement applies to the specified IONOS Object Storage users.
For more information, see Bucket Policy Examples and supported bucket and object actions and condition values.
You can manage the Bucket Policy using the DCD, API, and CLI.
You can apply Bucket Policy using the DCD by following these steps:
2. From the drop-down list in the Buckets tab, choose either Show user-owned buckets or Show contract-owned buckets depending on the bucket type you want to view.
3. From the Buckets list, choose the required bucket and click the Bucket settings.
4. Go to the Bucket Policy setting under the Access management section and click Edit.
5. Copy and paste the provided JSON policy by replacing BUCKET_NAME and USER_ID with the actual values. Depending on the Bucket Types, replace the USER_ID as follows:
Use Contract user ID for contract-owned buckets.
Use Canonical user ID for user-owned buckets.
6. Click Save.
Result: This action grants the specified user full access to your bucket.
You can delete a Bucket Policy at any time using the Bucket Policy section in the Bucket settings and click Delete.
Use the API to manage the Bucket Policy configuration.
Use the CLI to manage Bucket Policy.
If you have defined a bucket policy to grant public access, activating the Block Public Access feature will revoke these permissions, ensuring your data remains private. This feature is invaluable in scenarios where ensuring data privacy is paramount, or when you want to enforce a blanket no-public-access rule, irrespective of Bucket Policy settings. Currently, Block Public Access is available only via the IONOS Object Storage API.
{
"Id": "Delegate certain actions to another user",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Delegate certain actions to another user",
"Action": [
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"123.123.123.123/32"
]
}
},
"Principal": {
"AWS": "arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec"
}
}
]
}{
"Id": "Delegate certain actions to another user",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Delegate certain actions to another user",
"Action": [
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"123.123.123.123/32"
]
}
},
"Principal": {
"CanonicalUser": "783fa49356820b211a4283526fe24343"
}
}
]
}{
"Id": "Share access to the bucket",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Share access to the bucket",
"Action": [
"s3:*"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::BUCKET_NAME",
"arn:aws:s3:::BUCKET_NAME/*"
],
"Principal": {
"AWS": "arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec"
}
}
]
}{
"Id": "Share access to the bucket",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Share access to the bucket",
"Action": [
"s3:*"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::BUCKET_NAME",
"arn:aws:s3:::BUCKET_NAME/*"
],
"Principal": {
"CanonicalUser": "CANONICAL_USER_ID"
}
}
]
}1. In the DCD, go to Menu > Storage & Backup > IONOS Object Storage.