Back to notes

When you set up a CodeConnection to GitHub, AWS creates repository links for each repo you grant access to. If you are decommissioning a project or cleaning up unused links, you need to remove them explicitly. The connection itself does not delete them automatically.

First, see what repository links exist on your account.

aws codeconnections list-repository-links

This returns an array of RepositoryLinks. Each entry includes a RepositoryLinkId, the ConnectionArn it belongs to, and the RepositoryName (owner/repo format).

The RepositoryLinkId is what you need to delete a specific link.

Once you have the ID, remove it with a single command.

aws codeconnections delete-repository-link \
  --repository-link-id 2c4ccb71-53f8-4003-bf81-fc33cafbd301

No output means success. The repository link is gone immediately.

This does not delete the connection or affect other repository links on the same connection. It only removes the link between that one repository and AWS.

When to Do This

Repository links can pile up if you have connected and disconnected repos over time. A few common reasons to clean them up:

  • You moved a repo to a different GitHub org.
  • You decommissioned a project and want to revoke AWS access to that repo.
  • You are consolidating multiple connections and want a clean slate before reconnecting.

Deleting the repository link does not touch the repo itself. It only removes the AWS side of the reference.