Prerequisites
- An AWS account that holds the CodeCommit repositories you want to connect.
- Permission to create an IAM role or IAM user in that account, and to open AWS CloudShell. The
AWSCloudShellFullAccessmanaged policy grants CloudShell access. - The AWS Region where the repositories live, for example
us-east-1.
A workspace holds one AWS CodeCommit connection, and that connection covers one Region. To reach repositories in a second Region, connect that Region from a separate workspace.
Setup
In the sidebar, click More → Workspace settings → Connections, stay on the Builtin Connections tab, and select AWS CodeCommit. Choose the AWS Region, then pick a tab.- IAM role (recommended)
- Access keys
1
Open AWS CloudShell
On the IAM Role tab, open AWS CloudShell from the Open AWS CloudShell step. It runs in your browser, so there’s nothing to install.
2
Run the setup script
In Run Setup Script, copy the script, paste it into CloudShell, and run it. It creates the role
CloudThinkerCodeCommitAccessRole with a trust policy that includes your workspace’s External ID, then prints the role ARN. Required permissions shows both policies.If a role with that name already exists, the script keeps it, refreshes its trust policy with your External ID, and prints its ARN. It doesn’t change that role’s permissions, so check them against the policy below. The wizard also lists the same steps as manual commands.3
Paste the Role ARN
Paste the ARN into Role ARN and click Connect.Success state: the dialog shows Connected with the number of repositories CloudThinker can reach.
Send pull request events to Review
Review doesn’t start on new pull requests until AWS sends it events.1
Run the webhook script
In the Review setup wizard, copy the script from the Events step. It already holds your webhook URL and secret. Run it in AWS CloudShell in the account that owns the repositories.For each repository in the Region, it creates Amazon EventBridge rules named
CloudThinker-CodeCommit-* for pull request, comment, and push events. It also creates an EventBridge connection, an API destination, and the IAM role CloudThinker-CodeCommit-EventBridgeInvokeRole that sends events to CloudThinker.2
Mark it as configured
When the script prints “Webhook setup complete”, click Mark as Configured in the wizard.Success state: a new pull request gets a CloudThinker progress comment. Re-run the script after you add repositories. See provider authentication for details.
Connection details
Required permissions
The setup script attaches one inline policy with these actions:
The CodeCommit actions apply to all repositories (
Resource: "*"). The policy holds no iam:PassRole.
Trust policy and inline policy JSON
Trust policy and inline policy JSON
The IAM role’s trust policy lets only CloudThinker’s AWS principal assume the role, and only with your workspace’s External ID. The wizard fills in both values.The inline policy, named
CodeCommitReviewAccess on the role and CodeCommitReviewAccessKeyPolicy on the access key user:Agent capabilities
Reads run without asking. Posting a pull request comment is a write, so it needs Allow writes on — it starts on — and passes through your Rules and Approval mode first. To block CodeCommit writes outright, open AWS CodeCommit in More → Workspace settings → Connections and turn off the Allow writes switch on its detail panel.
On CodeCommit, you can mention
@cloudthinker-ai with a question or help in a top-level pull request comment. Thread replies, review, and autofix aren’t supported. See mention commands.
Verify the connection
Example prompts
Troubleshooting
Failed to connect to AWS CodeCommit. Please verify your credentials.
Failed to connect to AWS CodeCommit. Please verify your credentials.
CloudThinker couldn’t use the credentials. Work through these:
Failed to connect to AWS CodeCommit. Please try again.
Failed to connect to AWS CodeCommit. Please try again.
An unexpected error stopped the check. Try again. If it repeats, contact support.
Connected, but no repositories found yet
Connected, but no repositories found yet
The credentials work, but the chosen Region has no repositories the role or user can list. Confirm the AWS Region and that the permissions above are attached.
An expected repository is missing
An expected repository is missing
It lives in another Region. A connection only sees the Region it was set up for.
Review doesn't start on new pull requests
Review doesn't start on new pull requests
AWS sends no pull request events until the webhook step is done. Run the webhook script from the wizard, then click Mark as Configured. See provider authentication.
Security
- Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
- Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
- Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
- Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
- External ID: the role’s trust policy requires it, which stops another AWS account from tricking CloudThinker into using your role (the confused deputy problem). AWS doesn’t treat an External ID as a secret.
- Dedicated identity: use the role or user the script creates only for CloudThinker, so you can revoke it without touching anything else.
Related
Review setup
Turn on automated code review for your CodeCommit repositories.
Provider authentication
Auth methods and webhook steps for every Review provider.