DEV Community

Cover image for What are Environment Resources? | Apigee Interview Questions
realNameHidden
realNameHidden

Posted on

What are Environment Resources? | Apigee Interview Questions

Under an Environment, you'll see components like:

  • Deployments
  • KVMs
  • Flow Hooks
  • References
  • Target Servers
  • Keystores
  • Truststores
  • Resources

This Resources section is used to store reusable files that can be shared across all API proxies deployed in that environment.

What are Environment Resources?

Interview Answer:

"Environment Resources are reusable files that are uploaded once at the environment level and can be accessed by multiple API proxies deployed in that environment. Instead of bundling the same JavaScript or Java JAR into every proxy, we can store it as an environment resource and reference it from policies."

Types of Resources

Common resource types include:

  • JavaScript (.js)
  • Java JAR (.jar)
  • Python scripts (supported in specific contexts)
  • XSLT files
  • WSDL files
  • XSD schemas
  • OpenAPI specifications

Example

Suppose you have a common JavaScript file for JWT validation:

Environment
   ├── Resources
   │      └── jsc
   │            validateJWT.js
   │
   ├── KVM
   ├── Flow Hooks
   ├── Target Servers
   └── API Proxies
Enter fullscreen mode Exit fullscreen mode

Instead of copying validateJWT.js into every proxy, you upload it once as an environment resource.

In your JavaScript policy:

<Javascript name="JS-Validate">
    <ResourceURL>jsc://validateJWT.js</ResourceURL>
</Javascript>
Enter fullscreen mode Exit fullscreen mode

Any proxy deployed in that environment can use it.

Why use Environment Resources?

Imagine you have 50 API proxies, all using the same JavaScript file.

Without Environment Resources

Proxy1
   validate.js

Proxy2
   validate.js

Proxy3
   validate.js

...
Proxy50
   validate.js
Enter fullscreen mode Exit fullscreen mode

If you need to change the logic, you'd have to update and redeploy all 50 proxies.

With Environment Resources

Environment
    validate.js

        ▲
        │
Proxy1  Proxy2  Proxy3 ... Proxy50
Enter fullscreen mode Exit fullscreen mode

You maintain the shared file in one place, and every proxy references it. This promotes reuse and centralized management.

Environment Resource vs Proxy Resource

Proxy Resource Environment Resource
Stored inside one API proxy Stored at the environment level
Available only to that proxy Shared by all proxies in the environment
Duplicate copies across proxies Single shared copy
Good for proxy-specific logic Good for common reusable logic

Interview-Ready Answer

"The Resources section under an environment is used to store reusable artifacts such as JavaScript files, Java JARs, XSLT files, WSDLs, and other supporting files. These resources are shared across all API proxies deployed in that environment. For example, if multiple proxies use the same JavaScript for request validation or logging, we can upload it once as an environment resource and reference it from each proxy using the ResourceURL. This avoids duplication and makes maintenance easier because the shared logic is managed centrally."

One interview tip

If the interviewer asks "Why would you use an environment resource instead of packaging the JavaScript inside the proxy?", a strong answer is:

"I would use an environment resource when the same code is reused across multiple proxies. It provides centralized management, avoids duplication, and ensures consistency. If the logic is specific to a single proxy, I'd keep it as a proxy-level resource instead."

Top comments (0)