[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-18 (世界標準時間)。"],[[["\u003cp\u003eEnvironments act as isolated sandboxes for running API proxies, and multiple environments can be created within a single organization.\u003c/p\u003e\n"],["\u003cp\u003eDeploying proxies to specific environments allows for targeted routing, ensuring requests are handled by the appropriate message processor.\u003c/p\u003e\n"],["\u003cp\u003eIt is a best practice to create multiple environments and limit the number of proxies deployed to each one to avoid scaling and performance issues.\u003c/p\u003e\n"],["\u003cp\u003eEnvironment groups enable the grouping of environments that share the same hostnames, streamlining management and configuration.\u003c/p\u003e\n"],["\u003cp\u003eThe number of proxies deployed to an environment impacts message processor boot-up time, scaling, and stability, so consideration should be given to these factors when planning deployments.\u003c/p\u003e\n"]]],[],null,["# About environments\n\n| You are currently viewing version 1.12 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\nAn *environment* provides an isolated context or \"sandbox\" for running API proxies.\nIn a single organization, you can create multiple environments.\n\n\nThe following code shows an example override configuration where multiple environments are\ndefined. \n\n```actionscript-3\nnamespace: my-namespace\norg: my-organization\n...\nenvs:\n - name: test\n serviceAccountPaths:\n synchronizer: \"your_keypath/synchronizer-manager-service-account.json\n udca: \"your_keypath/analytic-agent-service-account.json\n\n - name: prod\n serviceAccountPaths:\n synchronizer: \"your_keypath/synchronizer-manager-service-account.json\n udca: \"your_keypath/analytic-agent-service-account.json\n...\n```\n\n\nSuppose a proxy with the base path `/foo1` is deployed to environment\n**test**. You could call the proxy like this: \n\n```\ncurl -k https://api.example.com/foo1\n```\n\n\nWhen this call hits the ingress, the ingress knows to send it to the message processor\nassociated with the `test` environment, which handles the request.\n\n\nSimilarly, if `foo1` is also deployed to the `prod` environment,\nyou could make a proxy\nrequest like this, to the host alias `apiprod.mydomain.net`: \n\n```\ncurl -k https://apiprod.example.com/foo1\n```\n\n\nAnd the call is routed by the ingress to the MP associated with that host.\n| **NOTE** On a request to an API proxy, the ingress compares the `Host` header of the incoming request to the list of host aliases to determine which virtual host handles the request. `curl` commands, browsers, and many other utilities automatically set the `Host` header with the domain of the request. If for any reason your app is not setting the `Host` header automatically, you must set it manually.\n\n\n**Antipattern**: Deploy all of your proxies to one hybrid environment.\n\n\n**Best practice**: Create multiple environments and deploy a limited number of proxies\nto each one.\n\nLimit the number of proxy deployments\n-------------------------------------\n\n\nFor hybrid, the fact that many environments can share the same virtual hosts\nas defined in environment groups means\nthat you must think carefully about how you manage your proxy deployments to any given\nenvironment. In hybrid, the best practice is to create multiple environments and deploy\na limited number of proxies to each one.\n\n\n**How many proxies should you deploy to an environment?** There is not a set answer\nto this question; however, the following table provides general guidance on why it's a\ngood idea to limit the number of proxies deployed to each environment and what you\nneed to think about when managing proxy deployments:\n| **NOTE:** When deciding how many proxies to deploy to an environment, be sure to consider the product configuration limits described in [Limits](/apigee/docs/api-platform/reference/limits#hybrid).\n\nEnvironment groups and virtualhosts\n-----------------------------------\n\n[Environment groups](/apigee/docs/api-platform/fundamentals/environments-overview)\nallow you to group environments together. Environments within each group share\nthe same hostnames. You can group environments by function, by hostname address, by region if you\nare implementing a multi-region hybrid installation, or by any other metric you\nchoose.\n\n\nBecause routing is managed by the combination of environment group hostnames, API proxy base paths,\nand environments, each virtual host only needs to list the name of the environment group and any\nappropriate certs.\n\n\nThe following code shows an example override configuration where multiple virtualhosts are\ndefined. Note that name of the virtualhosts must be the names of the environment groups. \n\n```actionscript-3\ngcp:\n region: us-central1\n projectID: hybrid-example\n\nk8sCluster:\n name: apigee-hybrid\n region: us-central1\n\norg: hybrid-example\n\ncontractProvider: https://us-apigee.googleapis.com # if using data residency\n\ninstanceID: \"my_hybrid_example\"\n\nvirtualhosts:\n - name: group-1 # the name of an environment group\n sslCertPath: ./certs/keystore.pem\n sslKeyPath: ./certs/keystore.key\n\nvirtualhosts:\n - name: group-2\n sslCertPath: ./certs/keystore.pem\n sslKeyPath: ./certs/keystore.key\n...\n```\n\nAdditional resources\n--------------------\n\n- [About environments and environment groups](/apigee/docs/api-platform/fundamentals/environments-overview)\n- [Managing environments](/apigee/docs/api-platform/fundamentals/environments-working-with)\n- [Managing environment groups](/apigee/docs/api-platform/fundamentals/environmentgroups-working-with)\n- [Configuration property reference](/apigee/docs/hybrid/v1.12/config-prop-ref#envs)\n- [Configure virtual hosts](/apigee/docs/hybrid/v1.12/base-path-routing)"]]