Google Cloud コンソールを使用してワークフローを作成する
このクイックスタートでは、 Google Cloud コンソールを使用して最初のワークフローを作成、デプロイ、実行する方法について説明します。サンプル ワークフローは、リクエストを公開 API に送信してから、API のレスポンスを返します。
このタスクを Google Cloud コンソールで直接行う際の順を追ったガイダンスについては、「ガイドを表示」をクリックしてください。
始める前に
組織で定義されているセキュリティの制約により、次の手順を完了できない場合があります。トラブルシューティング情報については、制約のある Google Cloud 環境でアプリケーションを開発するをご覧ください。
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
このガイドで既存のプロジェクトを使用する場合は、このガイドを完了するために必要な権限があることを確認します。新しいプロジェクトを作成した場合は、必要な権限がすでに付与されています。
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Workflows API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles. -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
このガイドで既存のプロジェクトを使用する場合は、このガイドを完了するために必要な権限があることを確認します。新しいプロジェクトを作成した場合は、必要な権限がすでに付与されています。
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Workflows API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles. - 認証を設定します。
-
Ensure that you have the Create Service Accounts IAM role
(
roles/iam.serviceAccountCreator) and the Project IAM Admin role (roles/resourcemanager.projectIamAdmin). Learn how to grant roles. -
In the Google Cloud console, go to the Create service account page.
Go to Create service account - Select your project.
-
In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.
In the Service account description field, enter a description. For example,
Service account for quickstart. - Click Create and continue.
-
Grant the Logging > Logs Writer role to the service account.
To grant the role, find the Select a role list, then select Logging > Logs Writer.
- Click Continue.
-
Click Done to finish creating the service account.
-
Ensure that you have the Create Service Accounts IAM role
(
サービス アカウントのロールと権限の詳細については、ワークフローに Google Cloud リソースへのアクセス権限を付与するをご覧ください。
必要なロール
このクイックスタートを完了するために必要な権限を取得するには、プロジェクトに対する次の IAM ロールを付与するよう管理者に依頼してください。
-
サービス アカウント ユーザー(
roles/iam.serviceAccountUser) -
ワークフロー管理者 (
roles/workflows.admin)
ロールの付与については、プロジェクト、フォルダ、組織へのアクセス権の管理をご覧ください。
必要な権限は、カスタムロールや他の事前定義ロールから取得することもできます。
ワークフローを作成してデプロイする
Google Cloud コンソールで、[ワークフロー] ページに移動します。
[ワークフロー] ページで、 [作成] をクリックします。
新しいワークフローの名前を入力します(例:
myFirstWorkflow)。リージョンには us-central1 を選択します。
[サービス アカウント] で、先ほど作成したサービス アカウントを選択します。
[次へ] を選択します。
次のワークフローをコピーしてワークフロー エディタに貼り付けます。
YAML
JSON
独自の検索キーワードを入力する場合を除き、このワークフローによりGoogle Cloud ロケーションを使用して検索キーワードが作成され、これが Wikipedia API に渡されます。関連する Wikipedia 記事のリストが返されます。
[デプロイ] を選択します。
ワークフローを実行する
ワークフローが正常にデプロイされると、最初のワークフロー実行を行えるようになります。ワークフローをデプロイすると、[ワークフローの詳細] ページが表示されます。
[ワークフローの詳細] ページで [ 実行] を選択します。
[ワークフローの実行] ページで、[実行] をクリックします。
[出力] ペインに、ワークフローの結果が表示されます。
これで最初のワークフローのデプロイと実行が完了しました。
クリーンアップ
このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、次の手順を実施します。
Google Cloud コンソールで、[ワークフロー] ページに移動します。
ワークフローのリストからワークフローをクリックして、[ワークフローの詳細] ページに移動します。
[削除] をクリックします。
ワークフローの名前を入力し、[確認] をクリックします。