gcloud storage コマンドに必要な IAM 権限

次の表に、gcloud storage コマンドの実行に必要な Identity and Access Management(IAM)権限を示します。複数の IAM 権限がバンドルされ、ロールが作成されます。プリンシパルにロールを付与します。

ワイルドカード、--recursive フラグ、--billing-project フラグを使用する際の注意事項については、表の下のセクションをご覧ください。

コマンド フラグ 必要な IAM 権限
buckets add-iam-policy-binding storage.buckets.get
storage.buckets.getIamPolicy
storage.buckets.setIamPolicy
storage.buckets.update
buckets create storage.buckets.create
buckets delete storage.buckets.delete
buckets describe storage.buckets.get
storage.buckets.getIamPolicy1
buckets get-iam-policy storage.buckets.get
storage.buckets.getIamPolicy
buckets list storage.buckets.list
storage.buckets.getIamPolicy1
buckets notifications create storage.buckets.get
storage.buckets.update
pubsub.topics.get(Pub/Sub トピックを含むプロジェクト)
pubsub.topics.create3(Pub/Sub トピックを含むプロジェクト)
pubsub.topics.getIamPolicy(通知を受信する Pub/Sub トピック)
pubsub.topics.setIamPolicy3(通知を受信する Pub/Sub トピック)
buckets notifications create --skip-topic-setup storage.buckets.get
storage.buckets.update
buckets notifications delete storage.buckets.get
storage.buckets.update
buckets notifications describe storage.buckets.get
buckets notifications list storage.buckets.get
buckets remove-iam-policy-binding storage.buckets.get
storage.buckets.getIamPolicy
storage.buckets.setIamPolicy
storage.buckets.update
buckets set-iam-policy storage.buckets.setIamPolicy
storage.buckets.update
buckets update storage.buckets.update
buckets update --no-requester-pays storage.buckets.update
resourcemanager.projects.createBillingAssignment2
buckets update --recovery-point-objective
--rpo
--[no-]uniform-bucket-level-access
--[no-]uniform-bucket-level-access storage.buckets.get
storage.buckets.update
buckets update --clear-pap
--clear-public-access-prevention
--[no-]pap
--[no-]public-access-prevention
storage.buckets.get
storage.buckets.update
storage.buckets.setIamPolicy
cat storage.objects.get
storage.objects.list13
cp storage.objects.get(ソース オブジェクト)
storage.buckets.get12(宛先バケット)
storage.objects.list4(宛先バケット)
storage.objects.create(宛先バケット)
storage.objects.delete5(宛先バケット)
du storage.objects.list
hash storage.objects.get
hmac create storage.hmacKeys.create
hmac delete storage.hmacKeys.delete
hmac describe storage.hmacKeys.get
hmac list storage.hmacKeys.list
hmac update storage.hmacKeys.update
ls(バケットの一覧表示) storage.buckets.list
storage.buckets.getIamPolicy6
ls(オブジェクトの一覧表示) storage.objects.get7
storage.objects.list
storage.objects.getIamPolicy8
ls --buckets storage.buckets.get
storage.buckets.getIamPolicy6
mv storage.objects.list4(宛先バケット)
storage.objects.get(ソース オブジェクト)
storage.objects.create(宛先バケット)
storage.objects.delete(ソースバケット)
storage.objects.delete5(宛先バケット)
objects compose storage.objects.get
storage.objects.create
storage.objects.delete9
objects describe storage.objects.get
storage.objects.getIamPolicy8
objects list storage.objects.list
storage.objects.getIamPolicy8
objects update storage.objects.get
storage.objects.list
storage.objects.update
objects update --storage-class
--encryption-key
--clear-encryption-key
storage.objects.get
storage.objects.list
storage.objects.create
storage.objects.delete
objects update --retention-mode
--retain-until
--clear-retention
storage.objects.get
storage.objects.list
storage.objects.update
storage.objects.setRetention
storage.objects.overrideUnlockedRetention11
restore storage.objects.create
storage.objects.delete9
storage.objects.restore
restore --async storage.objects.create
storage.objects.delete14
storage.objects.restore
storage.buckets.restore
rm storage.buckets.delete
storage.objects.delete
storage.objects.list
rsync storage.objects.get(ソース オブジェクトと宛先バケット)
storage.objects.create(宛先バケット)
storage.objects.delete10(宛先バケット)
storage.objects.list(ソースバケットと宛先バケット)
rsync --dry-run storage.objects.list(ソースバケットと宛先バケット)
service-agent resourceManager.projects.get
sign-url なし。ただし、このコマンドの一部として鍵が使用されているサービス アカウントには、署名付き URL にエンコードされたリクエストを実行する権限が必要です。

1 この権限は、詳細の中に IAM ポリシーを含める場合にのみ必要です。

2 この権限は、リクエストに請求先プロジェクトを含めない場合にのみ必要です。詳細については、リクエスト元による支払いの使用条件とアクセス要件をご覧ください。

3 この権限は、トピックがすでに存在し、当該サービス アカウントにそのトピックへのアクセス権がある場合は必要ありません。

4 この権限は、コマンドの宛先にオブジェクトのパスが含まれている場合にのみ必要です。

5 この権限は、並列複合アップロードを使用する場合や、--no-clobber フラグを使用せずにバケット内にすでに存在しているオブジェクトと同じ名前のオブジェクトを挿入する場合にのみ必要です。

6 この権限は、詳細の中に IAM ポリシーを含める場合にのみ必要です。

7 この権限は、--fetch-encrypted-object-hashes フラグを使用する場合にのみ必要です。

8 この権限は、詳細の中に IAM ポリシーを含める場合にのみ必要です。この権限は、均一なバケットレベルのアクセスが有効になっているバケットには適用されません。

9 この権限は、バケット内にすでに存在するオブジェクトと同じ名前でオブジェクトを作成する場合にのみ必要です。

10 この権限は、--delete-unmatched-destination-objects フラグを使用する場合や、バケット内にすでに存在しているオブジェクトと同じ名前のオブジェクトと同じ名前で、別のデータを持つオブジェクトを挿入する場合にのみ必要です。

11 この権限は、リクエストで --override-unlocked-retention フラグを使用する必要がある場合にのみ必要です。

12 この権限は、gcloud CLI プロパティ storage/parallel_composite_upload_compatibility_checkTrue に設定されている場合に、並列複合アップロードを実行するために必要です。

13 この権限は、正規表現を使用してオブジェクトを取得する場合にのみ必要です。

14 この権限は、リクエストに --allow-overwrite フラグが含まれており、バケット内にすでに存在するオブジェクトと同じ名前でオブジェクトを作成する場合にのみ必要です。

--billing-project トップレベル フラグ

--billing-project グローバル フラグを使用して、リクエストの料金の請求先プロジェクトを指定する場合は、指定するプロジェクトに対する serviceusage.services.use 権限が必要です。たとえば、リクエスト元による支払いが有効にされているバケットにアクセスするには、--billing-project フラグが必要です。

ワイルドカードと再帰フラグ

1 つのコマンドの中で URI ワイルドカードを使用して複数のオブジェクトを選択する場合は、それらのオブジェクトを含むバケットに対する storage.objects.list 権限が必要です。同じように、1 つのコマンドの中で URI ワイルドカードを使用して複数のバケットを選択する場合は、それらのバケットが含まれるプロジェクトに対する storage.buckets.list 権限が必要です。

--recursive フラグを使用する場合は、使用している特定のコマンドに必要な権限に加えて、関連するバケットに対する storage.objects.list 権限が必要です。

次のステップ