🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

feat: add Bedrock Role ARN field in UI - #26578

Merged
evgeniy-scherbina merged 2 commits into
mainfrom
yevhenii/bedrock-dynamic-assume-role-ui
Jun 25, 2026
Merged

feat: add Bedrock Role ARN field in UI#26578
evgeniy-scherbina merged 2 commits into
mainfrom
yevhenii/bedrock-dynamic-assume-role-ui

Conversation

@evgeniy-scherbina

@evgeniy-scherbina evgeniy-scherbina commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Adds a Role ARN field for the Bedrock provider in the UI. When set, the gateway assumes that IAM role (using the base identity) before calling Bedrock. The field is optional and non-secret, so it round-trips back into the form on edit and clears when left blank.


Related PR: #26527
Related issue: https://linear.app/codercom/issue/AIGOV-371/support-dynamic-bedrock-assumerole-across-aws-accounts-for-ai-gateway

@evgeniy-scherbina evgeniy-scherbina changed the title feat: add Bedrock role ARN field feat: add Bedrock RoleARN field in UI Jun 22, 2026
@evgeniy-scherbina
evgeniy-scherbina force-pushed the yevhenii/bedrock-dynamic-assume-role-ui branch from bb0b5d5 to 153d419 Compare June 24, 2026 15:30
evgeniy-scherbina added a commit that referenced this pull request Jun 24, 2026
# Support IAM role assumption for AWS Bedrock in AI Bridge

## Summary

Implements
https://linear.app/codercom/issue/AIGOV-371/support-dynamic-bedrock-assumerole-across-aws-accounts-for-ai-gateway

A Bedrock provider can now be configured with an IAM role to assume.
Before calling Bedrock, the gateway assumes that role via STS and signs
requests with the resulting temporary credentials. Whether the role
lives in the same account or another one is entirely a matter of the
role's trust policy.

## Problem

Many organizations prohibit long-lived AWS access keys and expect
workloads to authenticate through assumed IAM roles instead. A common
case is an organization that runs Bedrock across several AWS accounts,
one per business unit, and needs each unit's usage billed to its own
account by assuming a role there. AI Bridge previously authenticated a
Bedrock provider only with static keys or the gateway's own ambient AWS
identity, which is shared by every provider, with no way to assume a
role. These deployments had no clean path.

## How it works

When a provider is configured with a role ARN, the gateway uses its base
identity to assume that role via STS and signs Bedrock requests with the
temporary credentials it returns. The base identity is whatever the AWS
default credential chain resolves, IRSA, EKS Pod Identity, EC2 Instance
Profile, or static keys.

Credentials are resolved once when the provider is set up and are then
cached and rotated, so individual requests are served from the cache
rather than triggering a new STS call. A deployment that needs several
roles configures several providers, each pointing at its own role.

## Configuration

The role ARN is part of the Bedrock provider settings and is set through
the AI provider API. It is optional: a provider with no role ARN behaves
exactly as before.

## Scope and trade-offs

- This PR is backend only. The settings UI for the role ARN ships in a
follow-up.
- Configuration is not exposed through environment variables.
Environment-based provider configuration is being phased out in favor of
database-managed providers, so the role ARN is intentionally database
and API only.

Follow-up PR: #26578
Base automatically changed from yevhenii/bedrock-dynamic-assume-role to main June 24, 2026 16:03
jeremyruppel pushed a commit that referenced this pull request Jun 24, 2026
# Support IAM role assumption for AWS Bedrock in AI Bridge

## Summary

Implements
https://linear.app/codercom/issue/AIGOV-371/support-dynamic-bedrock-assumerole-across-aws-accounts-for-ai-gateway

A Bedrock provider can now be configured with an IAM role to assume.
Before calling Bedrock, the gateway assumes that role via STS and signs
requests with the resulting temporary credentials. Whether the role
lives in the same account or another one is entirely a matter of the
role's trust policy.

## Problem

Many organizations prohibit long-lived AWS access keys and expect
workloads to authenticate through assumed IAM roles instead. A common
case is an organization that runs Bedrock across several AWS accounts,
one per business unit, and needs each unit's usage billed to its own
account by assuming a role there. AI Bridge previously authenticated a
Bedrock provider only with static keys or the gateway's own ambient AWS
identity, which is shared by every provider, with no way to assume a
role. These deployments had no clean path.

## How it works

When a provider is configured with a role ARN, the gateway uses its base
identity to assume that role via STS and signs Bedrock requests with the
temporary credentials it returns. The base identity is whatever the AWS
default credential chain resolves, IRSA, EKS Pod Identity, EC2 Instance
Profile, or static keys.

Credentials are resolved once when the provider is set up and are then
cached and rotated, so individual requests are served from the cache
rather than triggering a new STS call. A deployment that needs several
roles configures several providers, each pointing at its own role.

## Configuration

The role ARN is part of the Bedrock provider settings and is set through
the AI provider API. It is optional: a provider with no role ARN behaves
exactly as before.

## Scope and trade-offs

- This PR is backend only. The settings UI for the role ARN ships in a
follow-up.
- Configuration is not exposed through environment variables.
Environment-based provider configuration is being phased out in favor of
database-managed providers, so the role ARN is intentionally database
and API only.

Follow-up PR: #26578
@evgeniy-scherbina
evgeniy-scherbina force-pushed the yevhenii/bedrock-dynamic-assume-role-ui branch from 153d419 to af1de6b Compare June 24, 2026 19:41
@evgeniy-scherbina
evgeniy-scherbina force-pushed the yevhenii/bedrock-dynamic-assume-role-ui branch from af1de6b to 537c24c Compare June 24, 2026 20:08
@evgeniy-scherbina
evgeniy-scherbina force-pushed the yevhenii/bedrock-dynamic-assume-role-ui branch from 510937e to afe0834 Compare June 25, 2026 00:19
@evgeniy-scherbina evgeniy-scherbina changed the title feat: add Bedrock RoleARN field in UI feat: add Bedrock Role ARN field in UI Jun 25, 2026
@evgeniy-scherbina
evgeniy-scherbina marked this pull request as ready for review June 25, 2026 00:28
@evgeniy-scherbina

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-06-25 00:29 UTC by @evgeniy-scherbina
Spend: $20.25 / $100.00

Review history
  • R1 (2026-06-25): 13 reviewers, 1 Nit, 1 P3, COMMENT. Review

deep-review v0.9.0 | Round 1 | c08b04a..afe0834

Last posted: Round 1, 2 findings (1 P3, 1 Nit), COMMENT. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Open ProviderForm.tsx:537 Provider docs don't mention Role ARN or cross-account access R1 Leorio Yes
CRF-2 P4 Open ProviderForm.stories.tsx No story asserts Role ARN field renders or accepts input R1 Bisky Yes (body)
CRF-3 P4 Open providerFormApiMap.test.ts Missing whitespace-trim test for roleArn on update path R1 Bisky Yes (body)
CRF-4 Nit Open ProviderForm.tsx:190 roleArn absent from makeBedrockSchema Yup validation R1 Zoro Yes

Round log

Round 1

Panel. 1 P3, 2 P4, 1 Nit. Reviewed against c08b04a..afe0834. 13 reviewers (Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Gon, Leorio, Ging-ts, Ging-react, Nami, Komugi, Melody, Zoro). 9 of 13 returned no findings. Netero clean.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-tasks

coder-tasks Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Updates Needed

  • docs/ai-coder/ai-gateway/providers.md - The Amazon Bedrock section should document the new optional Role ARN field. When set, the gateway assumes that IAM role (via STS AssumeRole) before calling Bedrock, enabling cross-account access. This should be added alongside the existing credential resolution options (SDK default chain and static credentials), since it is a distinct, user-configurable setting visible in the dashboard.

Automated review via Coder Agents

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-scoped addition. The mapping logic is correctly threaded through create, update, and read-back paths. The field follows the existing access-key pattern (conditional spread, .trim(), ?? "" fallback). Test coverage is strong: 7 new cases covering all three paths plus edge cases. Melody traced the full wire-format chain from Go struct through JSON to TypeScript and confirmed every pairing. Pariston verified each PR description claim against the code. 9 of 13 reviewers found nothing.

1 P3, 2 P4, 1 Nit.

P4 [CRF-2] ProviderForm.stories.tsx No Storybook play function asserts that the Role ARN field renders or accepts input. The existing AddBedrock and EditBedrockKeepCredentials stories implicitly render the field (it lives inside the Bedrock conditional block), but no play function queries it, checks its value, or types into it. The unit tests cover the mapping logic thoroughly; this is about the rendering-to-submit pipeline. The project convention says to use Storybook stories for component and page testing, including user interactions. A play function that fills in the Role ARN and verifies it reaches onSubmit would close the loop. (Bisky)

P4 [CRF-3] providerFormApiMap.test.ts No whitespace-trim test for roleArn on the update path. The create path has "trims whitespace around the role ARN" (line 429), but the update describe block has no symmetric test. Both paths call values.roleArn.trim() into the same buildBedrockSettings, so the risk is near zero. The gap breaks the symmetry the rest of the suite maintains between the create and update blocks. (Bisky)

Process note: the feature commit is feat: add Bedrock role ARN field while the test commit uses test(site): cover role_arn form mapping. Since all changed files are under site/, feat(site): add Bedrock role ARN field would match the project convention and the sibling commit.

"I tried to build a case against this and couldn't." (Pariston)


site/src/pages/AISettingsPage/ProvidersPage/components/ProviderForm.tsx:191

Nit [CRF-4] roleArn is the only ProviderFormValues field absent from makeBedrockSchema. Every other field has an entry, including apiKey: Yup.string() which Bedrock does not use. Adding roleArn: Yup.string() between accessKeySecret and enabled maintains the convention and provides a hook for future client-side ARN format validation (the backend already validates via validateAIProviderRoleARN).

(Zoro)

🤖

🤖 This review was automatically generated with Coder Agents.

className="w-full"
placeholder="arn:aws:iam::123456789012:role/BedrockRole"
/>
<p className="text-xs text-content-secondary m-0">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 [CRF-1] The Bedrock provider docs (docs/ai-coder/ai-gateway/providers.md, linked via "View docs" in the credentials section above) list SDK default credentials and static access keys but never mention role assumption, STS, or cross-account access. The backend already validates role ARNs (validateAIProviderRoleARN in codersdk/aiproviders.go:326), but none of the mechanism or required permissions reach the admin.

The inline help text here is functional but minimal. An admin configuring cross-account Bedrock access for the first time will click "View docs," find nothing about roles, and have to guess what permissions the assumed role needs (bedrock:InvokeModel, bedrock:InvokeModelWithResponseStream).

Consider adding a section under the Bedrock provider docs covering: what the Role ARN field does, when to use it (cross-account access), and what permissions the assumed role requires. This can be a separate docs PR.

(Leorio)

🤖

@jakehwll jakehwll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I agree with the coder-agent about how we describe this feature, but functionality-wise this is fine for frontend 🙂

@evgeniy-scherbina

evgeniy-scherbina commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@jakehwll I'll update docs in a separate PR.

@evgeniy-scherbina
evgeniy-scherbina merged commit f66df86 into main Jun 25, 2026
45 of 48 checks passed
@evgeniy-scherbina
evgeniy-scherbina deleted the yevhenii/bedrock-dynamic-assume-role-ui branch June 25, 2026 01:48
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants