Amplify Gen2 Sandbox复用已部署分支后端栈问题咨询
To make Amplify Sandbox use your existing deployed branch's backend stack (including seed data), follow these steps:
Generate configuration for your deployed branch
Run thegenerate configcommand to create a configuration file pointing to your deployed stack. ReplaceYOUR_APP_IDandYOUR_DEPLOYED_BRANCHwith your actual values:npx amplify generate config --app-id YOUR_APP_ID --branch YOUR_DEPLOYED_BRANCH --format json --out-dir configThis creates
amplifyconfiguration.jsonin theconfigdirectory, which contains the correct connection details for your deployed backend.Launch Sandbox with the existing configuration
Instead of using--config-out-dir(which generates a new config for a fresh temporary stack), use the--configflag to tell Sandbox to reuse your pre-generated config:npx amplify sandbox --config ./config/amplifyconfiguration.json
This connects Sandbox directly to your deployed backend, allowing you to use its resources and seed data for local development. Note that any local backend changes you make may prompt you to push updates to the deployed stack—be cautious if working with a production or shared environment.
内容的提问来源于stack exchange,提问作者O. Durand

