[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-27。"],[[["\u003cp\u003eApigee hybrid utilizes Google Cloud service accounts to execute various tasks, such as sending logs, pulling trace requests, and downloading proxy bundles, which enhances security through compartmentalized access.\u003c/p\u003e\n"],["\u003cp\u003eFor production environments, Apigee recommends creating multiple service accounts, each dedicated to a specific task and equipped with its own set of permissions for better access control.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ecreate-service-account\u003c/code\u003e tool is the recommended method for creating hybrid component-specific service accounts and automatically assigns the required roles and downloads the key files, simplifying the process.\u003c/p\u003e\n"],["\u003cp\u003eService accounts can also be created via the Google Cloud console or gcloud SDK, and each service account requires specific roles to perform its function, which are detailed in the provided documentation.\u003c/p\u003e\n"],["\u003cp\u003eReusing the name of a deleted service account is discouraged and may result in unexpected behavior, so it is recommended to use a unique name when recreating service accounts.\u003c/p\u003e\n"]]],[],null,["# About service accounts\n\n| You are currently viewing version 1.8 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n\nA *service account* is a special type of account in Google Cloud that enables components\nand applications of a system to interact with each other and with other APIs. For more information\nabout Google Cloud, see [About Google Cloud services](/apigee/docs/hybrid/v1.8/what-is-hybrid#about-gcp).\n| **SERVICE ACCOUNT FACTOID** \n| Google Cloud projects have a limit of 100 service accounts---including the default service accounts (if any).\n\nApigee hybrid uses Google Cloud service accounts to perform a variety of tasks, including:\n\n- Send log and metrics data\n- Pull trace requests\n- Connect to API gateway for administrative API requests\n- Execute back ups\n- Download proxy bundles\n\nWhile one service account *could* perform all of these operations, for production\nenvironments Apigee recommends that you create multiple service accounts, each assigned to a\nspecific task and each with its own set of permissions. This enhances security by\ncompartmentalizing access and limiting each service account's scope and access privileges. As with\nuser accounts, these permissions are applied by assigning one or more roles to the service\naccount.\n\nService accounts and roles used by hybrid components\n----------------------------------------------------\n\nTo operate properly, Apigee hybrid requires you to create several service accounts. Each\nservice account requires a specific role or roles that enable it to perform its function.\n\nThe following table describes the service accounts for the hybrid components. The names given for\neach service account are the default names. You can use any names you want, but the names should be\neasy to identify with each account's purpose.\n\n\nAs an alternative, for nonproduction, test, and demo environments, you can use a single service\naccount with all the roles assigned to it. This is not recommended for production environments.\n\nIn addition to creating the service accounts listed in this table, you will use each accounts\nprivate keys to generate access tokens so that you can access the Apigee APIs. The\n`create-service-account` tool automaticallyl downloads the key files into a directory\non your local machine when it creates or updates the service accounts.\n\nCreate the service accounts\n---------------------------\n\n| **Deleting and recreating service accounts:** Note that reusing the name of a deleted service account may result in unexpected behavior. If you create a service account and delete it, always recreate it with a unique name. For details, see [Deleting and recreating service accounts](/iam/docs/service-account-overview#deleting-recreating).\n\nThere are several ways to create service accounts, including:\n\n- (*Recommended* ) [`create-service-account` tool](#tool)\n- [Google Cloud console](#gcp)\n- [gcloud SDK](#gcloud)\n\nEach of these is described in the following sections.\n\n### Use the `create-service-account` tool\n\nThe `create-service-account` tool is available after you\n[download and expand `apigeectl`](/apigee/docs/hybrid/v1.8/install-apigeectl) in the\n`tools/` directory. It hybrid component-specific service accounts and assigns\nthe required roles for you. The tool also automatically downloads the service account keys and\nstores them on your local machine.\n\nFor example, the following command will create all the separate individual service accounts for a\nproduction environment, assign the appropriate IAM roles to each service account, and download\neach accounts private key file to the `./service-accounts` directory: \n\n```\n./tools/create-service-account --env prod\n```\n\n\nThe following command creates a single service account named `apigee-non-prod` with all IAM\nroles for all hybrid components,\nsuitable for demo and test environments, but not for production environments: \n\n```\n./tools/create-service-account --env non-prod\n```\n\nFor more information on using `create-service-account`, see\n[create-service-account reference](/apigee/docs/hybrid/v1.8/create-service-account).\n\n### Use the Google Cloud console\n\nYou can create service accounts with the Google Cloud console.\n| **Note:** To create service accounts in the Google Cloud console, you must have the Google Cloud Service Account Admin role or greater.\n\n**To create a service account with the Google Cloud console and generate a key for the\nservice account, do the following:**\n\n1. Create a service account:\n\n 1. In the Cloud console, go to the **Service Accounts** page.\n\n [Go to\n Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)\n 2. Select your project.\n 3. Click add**Create Service Account**.\n 4.\n In the **Service account name** field, enter a name. The\n Cloud console fills in the **Service account ID** field based on\n this name.\n\n\n Apigee recommends that you use a name that reflects the service account's role; you\n can set the name of the service account to be the same name as the component that uses it.\n For example, set the name of the Logs Writer service account `apigee-logger`.\n\n\n For more information about the service accounts names and roles, see\n [Service accounts and roles used by hybrid components](#recommended-sas).\n 5. Optional: In the **Service account description** field, enter a description for the service account. Descriptions are helpful at reminding you what a particular service account is used for.\n 6. Click **Create and continue**.\n 7.\n Click the **Select a role** field and select a role, as described in\n [Service accounts and roles used by hybrid components](#recommended-sas). If\n the Apigee roles do not appear in the drop down list, refresh the page.\n\n For example, for the logging component, select the Logs Writer role.\n\n\n If necessary, enter text to filter the list of roles by name. For example, to list only\n the Apigee roles, enter `Apigee` in the filter field.\n\n\n You can add more than one role to a service account, but Apigee recommends that\n you only use one role for each of the recommended service accounts. To change the roles of\n a service account after you have created it, use the **IAM**\n page in the Cloud console.\n | **Note:** If you do not see the roles listed in [Recommended service accounts](#recommended-sas), check with your Apigee account representative to be sure that your account was properly configured and that your organization was provisioned.\n 8. Click **Continue** .\n\n Google Cloud displays the **Grant users access to this service account** view:\n\n 9. Under **Create key (optional)** , click **Create Key** .\n\n Google Cloud gives you the option to download a JSON or P12 key:\n\n 10. Select JSON (the default) and click **Create** .\n\n Google Cloud saves the key file in JSON format to your local machine and displays a confirmation when\n it is successful, as the following example shows:\n\n You will later use some of the service account keys to configure hybrid runtime services.\n For example, when you configure the hybrid runtime, you will specify the location of the service\n account keys using the \u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e`.serviceAccountPath` properties.\n\n These keys are used by the service accounts to get access tokens, which the service account\n then uses to make requests against the Apigee APIs on your behalf. (But that's not for a while\n yet; for now, just remember where you saved it.)\n 11. Repeat steps 4 through 11 for each service account listed in [Service accounts and roles used by hybrid components](#recommended-sas) (except the `apigee-mart` account---which has no role associated with it---so do not assign it a role).\n\n When you're finished, you should have the following service accounts (in addition to the\n defaults, if any):\n\n\n In the Google Cloud console, service accounts are indicated with the\n icon.\n\n After you create a service account, if you want to add or remove a role to it, you must use\n the **IAM \\& Admin** view. You cannot manage roles for service accounts in the\n **Service accounts** view.\n | **Tip:** Apigee hybrid includes a validator that checks your service accounts' key files and permissions when [apigeectl](/apigee/docs/hybrid/v1.8/cli-reference) applies the Apigee hybrid runtime components to your cluster. This validation is enabled by default. For more information, see [Service account\n | validation](/apigee/docs/hybrid/v1.8/sa-validation).\n\n ### Use the gcloud service account creation APIs\n\n You can create and manage service accounts with the Cloud Identity and Access Management API.\n\n For more information, see\n [Creating\n and managing service accounts](/iam/docs/creating-managing-service-accounts).\n\n Troubleshooting\n ---------------\n\n | **Deleting and recreating service accounts:** Note that reusing the name of a deleted service account, may result in unexpected behavior. If you create a service account and delete it, always recreate it with a unique name. For details, see [Deleting and recreating service accounts](/iam/docs/service-account-overview#deleting-recreating)."]]