amplify-backend
amplify-backend copied to clipboard
Implement Real-Time Environment Variable Updates for Amplify Sandbox
Environment information
System:
OS: macOS 15.3
CPU: (8) arm64 Apple M2
Memory: 142.13 MB / 16.00 GB
Shell: /bin/zsh
Binaries:
Node: 20.9.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.1.0 - /usr/local/bin/npm
pnpm: undefined - undefined
NPM Packages:
@aws-amplify/auth-construct: 1.6.0
@aws-amplify/backend: 1.14.1
@aws-amplify/backend-ai: Not Found
@aws-amplify/backend-auth: 1.5.0
@aws-amplify/backend-cli: 1.4.11
@aws-amplify/backend-data: 1.4.0
@aws-amplify/backend-deployer: 1.1.18
@aws-amplify/backend-function: 1.12.2
@aws-amplify/backend-output-schemas: 1.4.0
@aws-amplify/backend-output-storage: 1.1.4
@aws-amplify/backend-secret: 1.1.6
@aws-amplify/backend-storage: 1.2.4
@aws-amplify/cli-core: 1.3.0
@aws-amplify/client-config: 1.5.7
@aws-amplify/data-construct: 1.15.0
@aws-amplify/data-schema: 1.18.0
@aws-amplify/deployed-backend-client: 1.5.1
@aws-amplify/form-generator: 1.0.4
@aws-amplify/model-generator: 1.0.12
@aws-amplify/platform-core: 1.6.3
@aws-amplify/plugin-types: 1.8.0
@aws-amplify/sandbox: 1.2.11
@aws-amplify/schema-generator: 1.2.7
aws-amplify: 6.13.2
aws-cdk: 2.1001.0
aws-cdk-lib: 2.181.0
typescript: 5.7.3
No AWS environment variables
No CDK environment variables
Describe the feature
This feature request proposes implementing real-time updates for environment variables in the Amplify Sandbox environment. Currently, when using the command npx dotenvx run --env-file=.env.local -- ampx sandbox, environment variables are only loaded at initial execution. Subsequent changes to the .env file require manually stopping and restarting the sandbox to take effect.
The proposed enhancement would:
- Continuously monitor the .env file for changes.
- Automatically update the sandbox environment with new or modified variables without requiring a restart.
- Provide immediate reflection of environment variable changes in the running sandbox.
Implementation could involve integrating a file watcher for the .env file and a mechanism to safely update the sandbox's runtime environment without disrupting ongoing processes.
Use case
This feature would significantly improve the development workflow in several ways:
- Eliminating the need for manual sandbox restarts after .env file changes: Developers often need to adjust environment variables during development. Currently, each change requires stopping and restarting the sandbox, which interrupts the development flow.
- Enabling rapid iteration and testing of different environment configurations: With real-time updates, developers can quickly test various configurations without the delay of restarting the sandbox, speeding up the development and debugging process.
- Enhancing overall developer productivity: This feature is especially beneficial in scenarios requiring frequent environment variable adjustments. It allows developers to make changes on the fly and see immediate results, reducing downtime and improving efficiency.
- Streamlining local development processes: By aligning the local development experience more closely with the dynamic nature of cloud environments, this feature helps create a more seamless workflow between local and deployed environments.