Page updated Nov 20, 2023

Fullstack branch deployments

Amplify code-first DX (Gen 2) offers fullstack branch deployments that allow you to automatically deploy infrastructure and application code changes from feature branches. This enables testing changes in an isolated environment before merging to the main branch.

Set up feature branch deployments

After you've deployed your first branch, you can manually connect more, but the recommended workflow is to use the autobranch detection feature.

  1. Log in to the Amplify console and choose your app.

  2. Navigate to App settings > Repository settings and enable Branch auto-detection and Branch auto-disconnection. The video below uses the default settings which will connect any branch in your repo automatically. Auto-branch disconnection will ensure that if you delete a branch from your repository, the branch will also be deleted.

You can also define a pattern to connect only certain branches. For example, setting dev, staging, and feature/* will automatically connect all three branch types. Your dev and staging branches, as well as any branch that begins with feature/ will be connected.

  1. Push a commit to your featureA and staging branches that match the pattern. You should start seeing deployments on the console page. You will now have 3 fullstack branches deployed.

branches

Promote changes to production

In Gen 2, promoting changes to production follows the normal Git-based workflow.

git-flow

  1. Make a change in your featureA branch.
> git checkout featureA ## make some edits to your code > git commit --am "New data model to track comments for todos added" > git push origin feature A
1> git checkout featureA
2
3## make some edits to your code
4
5> git commit --am "New data model to track comments for todos added"
6
7> git push origin feature A
  1. Submit a pull request to your main branch. Once your team has validated, merge to main. This will trigger a build on your main branch and update any frontend or backend resources that you changed.