谷歌云存储 - 设置的ACL对谷歌Compute Engine的
问题描述:
您好我想改变我的ACL文件,以允许谷歌计算引擎,在我的水桶写谷歌云存储 - 设置的ACL对谷歌Compute Engine的
这里是我的ACL的样子:
<?xml version="1.0" ?>
<AccessControlList>
<Owner>
<ID>XX</ID>
</Owner>
<Entries>
<Entry>
<Scope type="GroupById">
<ID>XX</ID>
</Scope>
<Permission>FULL_CONTROL</Permission>
</Entry>
<Entry>
<Scope type="AllUsers"/>
<Permission>READ</Permission>
</Entry>
<Entry>
<Scope type="UserByEmail">
<EmailAddress>[email protected]</EmailAddress>
</Scope>
<Permission>WRITE</Permission>
</Entry>
</Entries>
</AccessControlList>
或者我不知道是否有其他方法可以做到这一点?
答
我添加到列表中的服务帐户,它的工作其实很简单
答
的Compute Engine服务帐户是一个非常干净的方式来获得访问云端存储分区这是在同一个项目。无需在每个存储桶或对象上设置ACL。
简而言之:
host$ gcutil addinstance reader --service_account_scopes=storage-rw
<output elided...>
host$ gcutil ssh reader
<output elided...>
reader$ gsutil ls gs://YOUR_BUCKET
<outputs the list of objects in your bucket>
...其中YOUR_BUCKET是在同一个项目中的Compute Engine云存储桶。 Cloud Storage的范围别名为:storage-r,storage-w,storage-rw和storage-full。
如果要跨项目启用访问,可以通过将GCE项目的服务帐户的电子邮件地址添加到来自另一个项目的Google存储资源(存储桶/对象)来执行此操作。找到您的服务帐户的电子邮件地址,最简单的方法是执行这个GCE实例推出如上的内部:这里
reader$ curl -s http://metadata/0.1/meta-data/service-accounts/default | python -mjson.tool
{
"scopes": [
"https://www.googleapis.com/auth/devstorage.read_only"
],
"serviceAccount": "[email protected]"
}
详情: https://developers.google.com/compute/docs/authentication