How it works
BYOC is available on the Team and Enterprise plans. Your MergeWatch dashboard must be active before you begin.
- A pull request event fires a webhook to MergeWatch’s infrastructure
- The MergeWatch Lambda fetches the PR diff from GitHub and processes it in memory
- MergeWatch assumes a cross-account IAM role in your AWS account via
sts:AssumeRole - The diff and agent prompts are sent to Amazon Bedrock in your account for inference
- The model response is returned to MergeWatch, which posts a review comment on GitHub
Setup
You can configure BYOC in two ways: a one-click CloudFormation stack or a manual IAM role.Option A: One-click CloudFormation deploy
The fastest path. Click the button below (or find it on your MergeWatch dashboard under Settings > BYOC) to launch the CloudFormation stack in your AWS account.The stack creates:
- An IAM role with the correct trust policy and permissions
- An external ID unique to your MergeWatch organization
Option B: Create the IAM role manually
If you prefer to create the role yourself, follow the steps below.Replace the placeholders:
Copy the Role ARN from the output. It looks like
1. Create the trust policy
The trust policy allows MergeWatch’s AWS account to assume the role in your account. TheExternalId condition prevents confused deputy attacks.| Placeholder | Where to find it |
|---|---|
MERGEWATCH_ACCOUNT_ID | Shown on your MergeWatch dashboard under Settings > BYOC |
YOUR_EXTERNAL_ID | Generated for you on the same Settings page. Copy it exactly. |
2. Create the permission policy
Grant the role permission to invoke Bedrock foundation models. This is the only permission MergeWatch needs.3. Create the role
arn:aws:iam::123456789012:role/MergeWatchBedrockRole.Paste the Role ARN into MergeWatch
- Open your MergeWatch dashboard at mergewatch.ai
- Navigate to Settings > BYOC
- Paste the IAM Role ARN
- Click Save
What is the External ID?
The External ID is a shared secret between MergeWatch and your AWS account. It prevents a class of security issue known as the confused deputy problem. Without an External ID, any third party that knows your Role ARN could potentially trick MergeWatch into assuming the role on their behalf. The External ID ensures that only MergeWatch — with the correct ID value — can assume the role.- The External ID is generated by MergeWatch and is unique to your organization
- It is included in every
sts:AssumeRolecall MergeWatch makes to your account - Your trust policy rejects any assume-role request that does not present the correct External ID
- Never share your External ID publicly
For a deeper explanation, see the AWS documentation on the confused deputy problem.
What data does Bedrock see?
This is the most common question from compliance and security teams. The answer is straightforward:| Data sent to Bedrock | Data not sent to Bedrock |
|---|---|
| The PR diff (added/removed lines only) | Repository history or git log |
| MergeWatch agent prompts (system + user) | Source code beyond the diff |
| File paths included in the diff | Secrets, environment variables, or credentials |
| PR title and description | Other PRs or branches |
Because Bedrock runs in your AWS account, the data never leaves your AWS boundary during inference. MergeWatch acts only as the orchestrator — the model input and output travel directly between the MergeWatch Lambda and your Bedrock endpoint via the assumed role.
