What you'll learn: How an Apigee organization, its environments, environment groups and instances route traffic to a proxy, how immutable revisions are deployed and rolled back, and how to keep one bundle running unchanged from dev to prod with per-environment configuration.
Building a proxy is half the job. The other half is getting it to production repeatably, with the right backend in each stage, and being able to undo a bad release in minutes. Apigee gives you a small set of building blocks for this. If you understand how they relate, deployment stops being a ritual and becomes a routine.
The core idea
Think of a franchise restaurant chain. Head office writes one printed menu (the revision). The menu is identical in every restaurant, and you never pencil changes onto a printed copy: if the menu changes, head office prints a new edition. Each restaurant (an environment) has its own suppliers and prices on the wall (its target servers and key value maps), so the same menu works in the test kitchen and the flagship. The street address and the phone number customers use belong to a group of restaurants, not to a single dish (the environment group with its hostnames). And the building the kitchen sits in is a region-specific location (the instance).
Four ideas to hold on to:
- A revision is immutable. Change means a new revision.
- A revision is deployed to an environment. Deployed means live; saved means not live.
- Anything that differs between environments lives outside the bundle.
- Promote the same revision up the chain. Never rebuild per stage.
The hierarchy: organization, environment, group, instance
Read the diagram from left to right: a request reaches a load balancer you run in your own project, crosses into Apigee, is matched by hostname and base path to a proxy in an environment, and is served by the instance (a regional runtime) the environment is attached to. The pieces, as the Apigee documentation defines them:
- Organization. The top-level container. When you create an organization for Apigee X, it maps to exactly one Google Cloud project, and a project holds at most one organization. It contains environments, API proxies, API products, apps and users. You can create more than one organization.
- Environment. A place where proxies are deployed. A proxy must be deployed to an environment before anyone can call it. Names are 2 to 32 characters (lowercase letters, numbers and hyphens, starting with a letter) and cannot be changed after creation. On Pay-as-you-go you choose an environment type (Base, Intermediate or Comprehensive), which determines available features and cost; subscriptions always use Comprehensive.
- Environment group (envgroup). The basic mechanism for routing requests to environments. Hostnames are defined on the group, not on the environment. Hostnames must be unique across all groups in the organization and cannot use wildcards; base paths must be unique within a group. An environment can belong to more than one group, and an environment that belongs to no group has no hostname and cannot be reached.
- Instance. A region-specific runtime. Every environment must be attached to at least one instance, and there is one runtime instance per region.
A request is made of a hostname, a base path (set on the proxy) and a resource. Environment and group names never appear in the URL. With a proxy whose base path is /catalog, a call to catalog.example.com/catalog/items goes to that proxy in whichever environment of the matching group has it deployed.
How traffic reaches the runtime
Apigee documents two networking models. In the non-peering model, Private Service Connect carries traffic both from clients to Apigee (northbound) and from Apigee to your backends (southbound): client requests pass through a global or regional external load balancer to a service attachment, a single point of attachment, and from there into Apigee. In the VPC peering model, Apigee connects to your network through private service access and peering, and each instance needs its own non-overlapping address ranges. Choose per the networking-options page; this affects how you reach private backends, not how environments or revisions work.
Because of how routing works, one deployment can affect more than one group. An environment in two groups gets one address per group, and a new or removed base path can capture or redirect traffic for every group that contains the environment. Treat a deployment into a shared environment as a routing change, not only a code change.
Revisions and deployment semantics
Every time you save a proxy, Apigee creates a new numbered revision. A deployed revision is read-only; to change anything you create revision N+1 and deploy it. Deployment is all or nothing: the runtime deploys the whole bundle even if one policy changed.
What the docs say about deploying:
- One revision per proxy per environment. If another revision of the same proxy is already deployed, the REST
overrideparameter (defaultfalse) decides what happens: withfalsethe deployment is rejected, withtruethe new revision replaces the current one. Thegcloudflag--overrideand theapigeecliflag--ovrdo the same. - Successful deployments are zero-downtime. The new revision is sent to the runtime processors before the old one is undeployed.
- Propagation is eventually consistent. Processors act independently, so deploying does not make the proxy available everywhere at the same instant.
- A failed deployment is not a rollback. If a new revision fails to deploy, redeploy the previous revision to restore service; undeploying never restores a previously deployed revision by itself.
- Routing changes can be sequenced. The
sequencedRolloutoption rolls routing changes out in a safe order and matters mainly when a deployment takes traffic from another environment in a shared group or removes a base path. ThegenerateDeployChangeReportAPI can show beforehand whether it is recommended. - Base path conflicts show a warning. In the UI a yellow indicator means some routing did not update because of a base path conflict.
- Deployments count toward entitlements. A proxy deployment unit is one proxy or shared flow revision, per environment, per instance. One proxy in one environment attached to two instances counts as two units.
- The deploy call can carry a service account. The
serviceAccountparameter sets the proxy's Google identity, and the caller needsiam.serviceAccounts.actAson it. This matters for logging and for calling Google services.
The diagram makes one point clear: rollback is just another deployment of an old, immutable revision, which is why it is fast and predictable.
Per-environment configuration
If the bundle must not change between environments, every difference has to live in the environment. Apigee offers two main places.
Target servers. A target server is a named backend definition (host, port, protocol, optional TLS settings, and an isEnabled flag) that exists per environment. The TargetEndpoint refers to the name, so the same proxy points to different hosts in test and prod:
<TargetEndpoint name="default">
<HTTPTargetConnection>
<LoadBalancer>
<Server name="orders-backend"/>
</LoadBalancer>
<Path>/v1</Path>
</HTTPTargetConnection>
</TargetEndpoint>
The <Path> element only applies when a LoadBalancer is used. Create the target server in each environment, with a different host each time: