<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.c3g-app.sd4h.ca/index.php?action=history&amp;feed=atom&amp;title=Share_Object_Store_Data</id>
	<title>Share Object Store Data - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.c3g-app.sd4h.ca/index.php?action=history&amp;feed=atom&amp;title=Share_Object_Store_Data"/>
	<link rel="alternate" type="text/html" href="https://wiki.c3g-app.sd4h.ca/index.php?title=Share_Object_Store_Data&amp;action=history"/>
	<updated>2026-04-22T16:08:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.c3g-app.sd4h.ca/index.php?title=Share_Object_Store_Data&amp;diff=195&amp;oldid=prev</id>
		<title>Poq: Created page with &quot;We recommend using Globus to share data Store in our Object Store. But you can also use bucket policies to share data with groups that are also tenants on our platform.   = Share data with Bucket Policies =  == Create the right policy ==  Note that we are only documenting the use of the S3 API, but note that setting will also be [https://docs.ceph.com/en/latest/radosgw/bucketpolicy/#swift transfer to the swift API].   We will show you you can create a [https://docs.c...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.c3g-app.sd4h.ca/index.php?title=Share_Object_Store_Data&amp;diff=195&amp;oldid=prev"/>
		<updated>2025-10-07T17:25:52Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;We recommend using &lt;a href=&quot;/wiki/Globus&quot; title=&quot;Globus&quot;&gt;Globus&lt;/a&gt; to share data Store in our Object Store. But you can also use bucket policies to share data with groups that are also tenants on our platform.   = Share data with Bucket Policies =  == Create the right policy ==  Note that we are only documenting the use of the S3 API, but note that setting will also be [https://docs.ceph.com/en/latest/radosgw/bucketpolicy/#swift transfer to the swift API].   We will show you you can create a [https://docs.c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;We recommend using [[Globus]] to share data Store in our Object Store. But you can also use bucket policies to share data with groups that are also tenants on our platform.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Share data with Bucket Policies =&lt;br /&gt;
&lt;br /&gt;
== Create the right policy ==&lt;br /&gt;
&lt;br /&gt;
Note that we are only documenting the use of the S3 API, but note that setting will also be [https://docs.ceph.com/en/latest/radosgw/bucketpolicy/#swift transfer to the swift API]. &lt;br /&gt;
&lt;br /&gt;
We will show you you can create a [https://docs.ceph.com/en/latest/radosgw/bucketpolicy/ bucket policy] to share selected objects from that bucket to other tenants of the platform. &lt;br /&gt;
&lt;br /&gt;
First ask the other group what their project number on the Juno is. It is a 33 digit hexadecimal number [https://juno.calculquebec.ca/identity located here]. We will denote that number as &amp;lt;code&amp;gt;&amp;amp;lt;Remote-Project&amp;amp;gt;&amp;lt;/code&amp;gt;. Here is a &amp;lt;code&amp;gt;policy.jon&amp;lt;/code&amp;gt; example file that can share the content of &amp;lt;code&amp;gt;bucket-to-share&amp;lt;/code&amp;gt; with all members of &amp;lt;code&amp;gt;&amp;amp;lt;Remote-Project&amp;amp;gt;&amp;lt;/code&amp;gt;. Note that you cannot share the bucket with a specific member of that project; you share it with the project as a whole.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;json&amp;quot;&amp;gt;{&lt;br /&gt;
    &amp;quot;Version&amp;quot;: &amp;quot;2012-10-17&amp;quot;,&lt;br /&gt;
    &amp;quot;Id&amp;quot;: &amp;quot;S3PolicyId1&amp;quot;,&lt;br /&gt;
    &amp;quot;Statement&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;Effect&amp;quot;: &amp;quot;Allow&amp;quot;,&lt;br /&gt;
            &amp;quot;Principal&amp;quot;: {&amp;quot;AWS&amp;quot;: [&amp;quot;arn:aws:iam::&amp;lt;Remote-Project&amp;gt;:user/&amp;lt;Remote-Project&amp;gt;&amp;quot;]},&lt;br /&gt;
            &amp;quot;Action&amp;quot;: [&lt;br /&gt;
              &amp;quot;s3:ListBucket&amp;quot;,&lt;br /&gt;
              &amp;quot;s3:GetObject&amp;quot;&lt;br /&gt;
            ],&lt;br /&gt;
            &amp;quot;Resource&amp;quot;: [&lt;br /&gt;
                       &amp;quot;arn:aws:s3:::bucket-to-share&amp;quot;,&lt;br /&gt;
                       &amp;quot;arn:aws:s3:::bucket-to-share/*&amp;quot;&lt;br /&gt;
            ]&lt;br /&gt;
        }&lt;br /&gt;
    ]&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
Note that you need to give access to &amp;lt;code&amp;gt;bucket-to-share&amp;lt;/code&amp;gt; itself, so you can read information about it. You also need to give access to the objects with the glob&amp;#039;s notation &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;. It also means that you can give access to a specific list of objects like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;json&amp;quot;&amp;gt;{&lt;br /&gt;
    &amp;quot;Version&amp;quot;: &amp;quot;2012-10-17&amp;quot;,&lt;br /&gt;
    &amp;quot;Id&amp;quot;: &amp;quot;S3PolicyId1&amp;quot;,&lt;br /&gt;
    &amp;quot;Statement&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;Effect&amp;quot;: &amp;quot;Allow&amp;quot;,&lt;br /&gt;
            &amp;quot;Principal&amp;quot;: {&amp;quot;AWS&amp;quot;: [&amp;quot;arn:aws:iam::&amp;lt;Remote-Project&amp;gt;:user/&amp;lt;Remote-Project&amp;gt;&amp;quot;]},&lt;br /&gt;
            &amp;quot;Action&amp;quot;: [&lt;br /&gt;
              &amp;quot;s3:ListBucket&amp;quot;,&lt;br /&gt;
              &amp;quot;s3:GetObject&amp;quot;&lt;br /&gt;
            ],&lt;br /&gt;
            &amp;quot;Resource&amp;quot;: [&lt;br /&gt;
                       &amp;quot;arn:aws:s3:::bucket-to-share&amp;quot;,&lt;br /&gt;
                       &amp;quot;arn:aws:s3:::bucket-to-share/prefix-*&amp;quot;,&lt;br /&gt;
                       &amp;quot;arn:aws:s3:::bucket-to-share/specific-file.txt&amp;quot;&lt;br /&gt;
            ]&lt;br /&gt;
        }&lt;br /&gt;
    ]&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
== Apply the Policy to the Bucket  ==&lt;br /&gt;
&lt;br /&gt;
You first need to [[create an s3 key and secret pair]]. Then use the client of you choosing to interact with the S3 API. We like the official &amp;lt;code&amp;gt;aws&amp;lt;/code&amp;gt; client, since it is flexible and well documented. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;aws  s3api put-bucket-policy --bucket bucket-to-share --policy file://policy.json&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How can the other group can read the data now? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That part is a bit more complicated... Every tenant in our Ceph cluster lives in its own namespace, which means that [https://stackoverflow.com/questions/24112647/why-are-s3-and-google-storage-bucket-names-a-global-namespace unlike the AWS] object store, out [https://docs.ceph.com/en/latest/radosgw/multitenancy/#accessing-buckets-with-explicit-tenants namespace configuration is not global]. It uses multi-tenancy... to an extent. When you are accessing the object store of your own tenant, it does not make a difference if the namespace is global or not. When accessing the data from another tenant, your tenant’s id is prepended to the bucket name like this : &amp;lt;code&amp;gt;&amp;amp;lt;Remote-Project&amp;amp;gt;:&amp;amp;lt;bucket-name&amp;amp;gt;&amp;lt;/code&amp;gt;. This means that you need to share your bucket &amp;lt;code&amp;gt;project id&amp;lt;/code&amp;gt; with the group you want to share the data with. Lest say that your &amp;lt;code&amp;gt;project id&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;&amp;amp;lt;my-project&amp;amp;gt;&amp;lt;/code&amp;gt;, your collaborator will be able to use the &amp;lt;code&amp;gt;rclone&amp;lt;/code&amp;gt; client out of the box like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;rclone ls  rclone-config-name:&amp;lt;my-project&amp;gt;:mybu/  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However some clients will not accept the &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; in the bucket name. If you are using &amp;lt;code&amp;gt;boto3&amp;lt;/code&amp;gt;, the official &amp;lt;code&amp;gt;aws&amp;lt;/code&amp;gt; python &amp;lt;code&amp;gt;s3&amp;lt;/code&amp;gt; client, you will need to add the &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; character to the VALID_BUCKET list of accepted `character before using it:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;import boto3&lt;br /&gt;
from botocore.config import Config&lt;br /&gt;
import botocore.handlers&lt;br /&gt;
import re&lt;br /&gt;
botocore.handlers.VALID_BUCKET = re.compile(r&amp;#039;^[:a-zA-Z0-9.\-_]{1,255}$&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
# Specify the bucket name including the tenant&lt;br /&gt;
bucket_name = &amp;quot;tenant:bucketname&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example: List objects in the bucket&lt;br /&gt;
response = s3_client.list_objects_v2(Bucket=bucket_name)&lt;br /&gt;
[...]&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;lt;code&amp;gt;aws&amp;lt;/code&amp;gt; client is also built on top of the &amp;lt;code&amp;gt;boto3&amp;lt;/code&amp;gt; library, and changing the VALID_BUCKET value in the &amp;lt;code&amp;gt;awscli/botocore/handlers.py&amp;lt;/code&amp;gt; installed with you &amp;lt;code&amp;gt;aws&amp;lt;/code&amp;gt; client would also let you use that client. While it is a working hack, we would not recommend that last solution as a sustainable way of using that tool.&lt;/div&gt;</summary>
		<author><name>Poq</name></author>
	</entry>
</feed>