Skip to content

Instantly share code, notes, and snippets.

@hsnice16
Created April 6, 2025 13:46
Show Gist options
  • Save hsnice16/53ced4e9f056148f90ec470f0803a3ca to your computer and use it in GitHub Desktop.
Save hsnice16/53ced4e9f056148f90ec470f0803a3ca to your computer and use it in GitHub Desktop.
Deploy an already deployed app on a different AWS Amplify account

Thanks for clarifying! I understand now that when you’re setting up the Amplify app in the new AWS account, the repository you want to deploy isn’t appearing in the AWS Amplify UI under the list of available repositories, and in your Git provider (likely GitHub, based on the "installed" tag), the repo shows as "installed" under "Only select repositories." This points to a specific issue with how the repository’s integration is configured between your Git provider and the new AWS account. Let’s dive into why this is happening and how to fix it.

What’s Happening

The "installed" tag next to the repository in your Git provider’s settings (e.g., GitHub under "Settings > Integrations & services" or "Settings > Applications") indicates that the repository is already associated with an existing AWS Amplify integration—likely the one tied to the first AWS account where you deployed the app. When you try to connect the same repository in the new AWS account’s Amplify UI, it doesn’t show up because the Amplify GitHub App (or equivalent for your provider) hasn’t been fully authorized to expose that repository to the new account. Here’s why:

  • GitHub App Scope: The Amplify GitHub App is installed at the organization level with a setting like "Only select repositories," meaning it’s restricted to specific repos. The initial installation (for the first account) granted access to this repo, but that authorization is tied to the OAuth token or configuration specific to the first account’s Amplify instance.
  • New Account Isolation: The new AWS account is treated as a separate entity by Amplify and requires its own authorization to access the repo, even if it’s the same GitHub organization. If the GitHub App’s permissions haven’t been updated to include the new account’s Amplify instance, the repo won’t appear in the Amplify UI for that account.

In short, the repository isn’t visible in the new account’s Amplify UI because the GitHub App integration hasn’t been explicitly configured to allow the new account’s Amplify instance to see it.

Steps to Fix This

1. Check the GitHub App Configuration

  • Go to GitHub:
    • Log in to GitHub with an account that has admin access to your organization.
    • Navigate to your organization’s settings: Organization > Settings > GitHub Apps (or Third-party access if it’s an older OAuth app setup).
  • Locate the Amplify App:
    • Find the AWS Amplify GitHub App in the list of installed applications.
    • Click on it to view its configuration.
  • Verify Repository Access:
    • Under "Repository access," it likely says "Only select repositories," and your target repo is listed with the "installed" tag.
    • This confirms the repo is tied to an existing Amplify integration (from the first account).

2. Authorize the New Account in Amplify

  • Open AWS Amplify in the New Account:
    • In the AWS Management Console of the new account, go to Amplify > "New app > Host web app."
    • Select GitHub as your Git provider and click "Connect."
  • Re-authenticate GitHub:
    • You’ll be redirected to GitHub to authorize the Amplify GitHub App.
    • During this step, GitHub will ask which repositories the app can access for this new authorization.
    • If prompted, ensure your organization is selected, and choose "All repositories" temporarily (you can adjust this later) to test if the repo appears. Alternatively, if you see an option to select specific repos, ensure your target repo is checked.
  • Complete the Connection:
    • After authorizing, return to the Amplify UI. The repository should now appear in the list.

3. Adjust Repository Access (if Needed)

  • If the repo still doesn’t show up after re-authenticating:
    • Go back to GitHub’s organization settings > GitHub Apps > AWS Amplify.
    • Click "Edit" or "Configure" next to the Amplify app.
    • Under "Repository access," ensure the target repo is explicitly selected. If it’s already selected but tied to the old account, you might need to "reinstall" or "reauthorize" the app for the new account.
    • Save the changes, then retry connecting the repo in the Amplify UI.

4. Test with a New Amplify App

  • In the new account’s Amplify console, create a fresh app (don’t try to import or reuse the existing one from the first account).
  • After connecting GitHub and authorizing access, search for or select your repository from the list.
  • If it appears, proceed with selecting the branch and deploying.

5. Fallback: Reinstall the Amplify GitHub App

  • If the repo still isn’t visible, the existing Amplify GitHub App installation might be causing a conflict:
    • In GitHub, uninstall the Amplify GitHub App entirely from your organization (this won’t affect the first account’s deployed app—it only severs the integration link).
    • Go back to the new account’s Amplify UI, reconnect GitHub, and reinstall the Amplify GitHub App fresh. During installation, explicitly grant access to the target repo.
    • This should ensure the new account has its own clean integration.

Why This Happens

AWS Amplify relies on Git provider integrations to fetch repository data, and these integrations are tied to specific AWS accounts via OAuth tokens. When the repo is marked as "installed" for one account under a restricted scope ("Only select repositories"), the Amplify UI in a different account won’t see it unless the GitHub App’s permissions are extended to that account’s instance. This is a security feature of GitHub Apps to prevent unauthorized access, but it can trip up cross-account deployments.

Final Check

After following these steps, refresh the Amplify UI in the new account and confirm the repository appears. If it does, you can proceed with deployment as normal. If it still doesn’t show up, double-check:

  • The GitHub user you’re authenticating with has organization admin rights.
  • There’s no browser cache or session issue (try in an incognito window).
  • The exact error or behavior in the Amplify UI (e.g., does it show "No repositories found" or just skip your repo?).

Let me know how it goes or if you hit a specific snag—I can refine the guidance further!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment