「弊社のエンジニアリング チームは Google Cloud Platform(GCP)内で数百のプロジェクトを管理していますが、そうしたリソースを階層構造にまとめられれば、環境が複雑化していっても容易に対処できます。弊社では、部門、地域、製品、データ機密性などの基準に基づいてプロジェクトを分類し、適切な担当者が適切な情報にアクセスできるようにしています。フォルダの導入により、リソースを整理し、分類に基づいてアクセス制御ポリシーを管理するのに必要な柔軟性が得られました。」 — Alex Olivier 氏、Qubit のテクニカル プロダクト マネージャー
「GCP での事業が拡大するにつれて、私たちはプロジェクトを合理化する方法を模索し始めました。Cloud Resource Manager のおかげで、今ではどのようにリソースが作成され、自社ドメイン内でどのように請求すべきかを一元的に管理、監視することができます。IAM とフォルダを使うことで、リソースへのアクセスや使用量に対する可視性を損なうことなく、各部署は必要に応じて自主性と俊敏性を確保しています。これにより、管理負荷が大幅に低減され、ユーザーを大規模にサポートする能力に直接的な良い影響をもたらしました。」— Ocado Technology のシニア ソフトウェア エンジニア、Marcin Kolda 氏
# Find your Organization ID me@cloudshell:~$ gcloud organizations list DISPLAY_NAME ID DIRECTORY_CUSTOMER_ID myorganization.com 358981462196 C03ryezon # Create first level folder “Engineering” under the Organization node me@cloudshell:~$ gcloud alpha resource-manager folders create --display-name=Engineering --organization=358981462196 Waiting for [operations/fc.2201898884439886347] to finish...done. Created [<Folder createTime: u'2017-04-16T22:49:10.144Z' displayName: u'Engineering' lifecycleState: LifecycleStateValueValuesEnum(ACTIVE, 1) name: u'folders/1000107035726' parent: u'organizations/358981462196'>]. # Add a Folder Admin role to the “Engineering” folder me@cloudshell:~$ gcloud alpha resource-manager folders add-iam-policy-binding 1000107035726 --member=user:bob@myorganization.com --role=roles/resourcemanager.folderAdmin bindings: - members: - user:bob@myorganization.com - user:admin@myorganization.com role: roles/resourcemanager.folderAdmin - members: - user:alice@myorganization.com role: roles/resourcemanager.folderEditor etag: BwVNX61mPnc= # Check the IAM policy set on the “Engineering” folder me@cloudshell:~$ gcloud alpha resource-manager folders get-iam-policy 1000107035726 bindings: - members: - user:bob@myorganization.com - user:admin@myorganization.com role: roles/resourcemanager.folderAdmin - members: - user:alice@myorganization.com role: roles/resourcemanager.folderEditor etag: BwVNX61mPnc= # Create second level folder “Product_A” under folder “Engineering” me@cloudshell:~$ gcloud alpha resource-manager folders create --display-name=Product_A --folder=1000107035726 Waiting for [operations/fc.2194220672620579778] to finish...done. Created []. # Crate third level folder “Development” under folder “Product_A” me@cloudshell:~$ gcloud alpha resource-manager folders create --display-name=Development --folder=1000107035726 Waiting for [operations/fc.3497651884412259206] to finish...done. Created []. # List all the folders under the Organization me@cloudshell:~$ gcloud alpha resource-manager folders list --organization=358981462196 DISPLAY_NAME PARENT_NAME ID IT organizations/358981462196 575615098945 Engineering organizations/358981462196 661646869517 Operations organizations/358981462196 895951706304 # List all the folders under the “Engineering” folder me@cloudshell:~$ gcloud alpha resource-manager folders list --folder=1000107035726 DISPLAY_NAME PARENT_NAME ID Product_A folders/1000107035726 732853632103 Product_B folders/1000107035726 941564020040 # Create a new project in folder “Product_A” me@cloudshell:~$ gcloud alpha projects create my-awesome-service-2 --folder 732853632103 Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/my-awesome-service-3].Waiting for [operations/pc.2821699584791562398] to finish...done. # List projects under folder “Production” me@cloudshell:~$ gcloud alpha projects list --filter 'parent.id=725271112613' PROJECT_ID NAME PROJECT_NUMBER my-awesome-service-1 my-awesome-service-1 869942226409 my-awesome-service-2 my-awesome-service-2 177629658252
「Qubit では、組織リソースやプロジェクト リソースといった GCP のリソース コンテナの柔軟性にとても満足しています。組織リソースが、プロジェクトと IAM ポリシーを一元的に把握できるようにしてくれたことで、会社全体での一貫したアクセス制御を実現できました。これはクラウドへの移行期間の中で、セキュリティを第一に考えなければならない開発者が必要としていた機能でした。」 — Laurie Clark-Michalek, Infrastructure Engineer at Qubit.
# Query your Organization ID > gcloud organizations list DISPLAY_NAME ID DIRECTORY_CUSTOMER_ID MyOrganization 123456789 C03ryezon # Access Organization details > gcloud organizations describe [ORGANIZATION_ID] creationTime: '2016-11-15T04:42:33.042Z' displayName: MyOrganization lifecycleState: ACTIVEname: organizations/123456789 owner: directoryCustomerId: C03ryezon # How to assign the Organization Admin role # Must have Organization Admin or Super Admin permissions > gcloud organizations add-iam-policy-binding [ORGANIZATION_ID] --member=[MEMBER_ID] --roleroles/resourcemanager.organizationAdmin # How to migrate an existing project into the Organization > gcloud alpha projects move [PROJECT_ID] --organization [ORGANIZATION_ID] # How to list all projects in the Organization > gcloud projects list --filter ‘parent.id=[ORGANIZATION_ID] AND parent.type=organization’