The `aws-cdk-asset-node-proxy-agent-v5` library provides an AWS CDK Construct that configures Node.js-based assets (e.g., Lambda functions) to use an HTTP/HTTPS proxy during their build and bundling phases. This is critical for CDK deployments in corporate environments where internet access requires going through a proxy, leveraging the `proxy-agent` Node.js library. It is an experimental construct from `cdklabs` and is currently at version 2.0.166, aligning with AWS CDK v2 releases, with updates tied to CDK's release cadence.
pip install aws-cdk-asset-node-proxy-agent-v5Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate `NodeProxyAgent` into your CDK application. It sets up an `NodeProxyAgent` instance to configure proxy settings for Node.js assets during synthesis, using environment variables for proxy URLs. A sample `NodejsFunction` is included, which will then use these proxy settings during its bundling process.
Understand the distinction between build-time and runtime proxying. For runtime proxying, use Lambda environment variables or a custom layer that configures `https-proxy-agent` or similar.
Ensure your Node.js asset's dependencies and build environment are compatible with `proxy-agent` v5. If using a different version, consider if this construct is necessary or if manual configuration is more appropriate.
Explicitly pass all required proxy settings (including `no_proxy`) to the `NodeProxyAgent` constructor. Do not rely solely on environment variables if the construct is instantiated with parameters, as parameters take precedence.