该产品在 AWS Marketplace 上免费提供,但需搭配外部 Devin 许可证使用。Devin 用量通过您的 Devin 订阅计费,同时会产生标准的 AWS 基础设施费用 (AgentCore Runtime、Secrets Manager、CloudWatch) 。你可以通过 AWS Marketplace 上的 Devin by Cognition 获取 Devin 订阅。
工作原理
该集成由两部分组成:- 连接器是一个容器,运行在您的 AWS 账户中的 Amazon Bedrock AgentCore Runtime 上。AWS Transform 通过您创建的 IAM 角色调用它。它负责在 AWS Transform 与 Devin 之间传递作业聊天、工件、进度更新和审查任务。
- Devin 在 Cognition 的环境中运行,使用您的 Devin 订阅。它只会通过您现有的源代码管理连接提交代码,且均以拉取请求的形式提交,需经您批准。
- 选择 Devin: build, test, deploy,并提供现代化工件和已连接的代码仓库。
- 在作业聊天中与 Devin 讨论工作范围。进度会显示在作业的 Plan 和 Worklogs 中。
- Devin 提出计划,并以 AWS Transform 审查任务的形式将待决事项发送给您。尚未解决的问题则留在聊天中讨论。
- Devin 在单独的基线分支上应用转换后的工件,完成构建和测试后创建拉取请求。您通过审查任务逐一批准。
- 您的团队使用自己的 AWS IAM 角色,通过自己经过审查的流水线进行部署。
安全模型
- 不使用长期有效的 AWS 访问密钥。 可使用管理员的短期有效凭据进行安装,也可让 Devin 通过无密钥的 OIDC 联合身份验证完成安装。
- 角色相互分离。 安装、运行时和 AWS Transform 各自使用独立的角色。两个运行时角色受权限边界约束,该权限边界需由你预先部署。
- Devin API 密钥存储在 Secrets Manager 中。 运行时在启动时读取该密钥,密钥绝不会出现在堆栈参数、聊天、日志或 git 中。
- 代码仓库限制。 你可以限定 Devin 能在哪些代码仓库中创建拉取请求。
- 加固镜像。 容器不含 shell 或软件包管理器,以非 root 用户身份运行,发布前经过扫描,并附带 SBOM。
- 仅限出站流量。 运行时需要通过出站 HTTPS 访问 Devin API 和 AWS 端点;除 AgentCore 调用外,不接受任何入站流量。
前置条件
- 一个已在
us-east-1(目前唯一支持的区域) 启用 AWS Transform 的 AWS 账户。运行时、secrets 和您的作业都将使用该账户。 - 一位有权部署 CloudFormation 堆栈 (该堆栈会创建 IAM 角色) 的 AWS 管理员。
- 已使用该管理员凭据完成配置的 AWS CLI v2。
- 一个已连接目标源代码仓库的 Devin 组织。
- 一个供运行时使用的 Devin 服务用户,其 API 密钥需具备 ViewOrgSessions、UseDevinSessions 和 ManageOrgSessions 权限。请记下您的 Devin 组织 ID。
配置
以下步骤介绍如何使用 AWS CLI 自行安装连接器。如果希望由 Devin 代你运行步骤 3 至 6,请参阅可选:让 Devin 安装。1
在 AWS Marketplace 上订阅
在 AWS Marketplace 上订阅 Devin for AWS Transform: Modernization Agent。在 fulfillment 页面上,复制镜像 URI 和该镜像所在代码仓库的 ARN,并在 shell 中将它们分别保存为
IMAGE_URI 和 MARKETPLACE_REPO_ARN,下面的命令会用到这两个变量。镜像 URI 末尾的标签即为你稍后需要在 AWS Transform 中输入的版本。2
将您的账户加入允许列表
联系我们,申请将您的 AWS 账户加入允许列表。请提供以下信息:
此时会出现 devin-modernization,其状态为 Pending configuration。在你按步骤 3 至 6 部署并验证运行时期间,请保持该状态不变,等到步骤 7 再进行配置。
- 您的 12 位 AWS 账户 ID
- 你将使用的区域 (
us-east-1) - 您的 Devin 组织名称


3
将 Devin API 密钥存储在 Secrets Manager 中
将运行时服务用户的 API 密钥 (以 你也可以在 Secrets Manager 控制台中创建:依次选择 Other type of secret 和 Plaintext,然后粘贴密钥。
cog_ 开头) 保存为纯文本 secret,并命名为 devin-atx/devin-api-key:export AWS_REGION=us-east-1
read -rs DEVIN_KEY # 粘贴密钥,然后按回车键
aws secretsmanager create-secret --region "$AWS_REGION" --name devin-atx/devin-api-key --secret-string "$DEVIN_KEY"
unset DEVIN_KEY
4
部署权限边界
将下方的边界模板保存为
boundary.yaml 并进行部署。该模板会创建 devin-atx-boundary 策略,用于限定任一运行时角色所能拥有的最大权限。其 MarketplaceImageRepository 参数接收您的订阅履行页面上提供的代码仓库 ARN,该边界仅允许从此代码仓库拉取镜像。aws cloudformation deploy --region "$AWS_REGION" \
--stack-name devin-atx-boundary \
--template-file boundary.yaml \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides MarketplaceImageRepository="$MARKETPLACE_REPO_ARN"
5
部署运行时
将下方的运行时模板保存为
该堆栈会创建 AgentCore 运行时
runtime.yaml。创建变更集,审查无误后执行:aws cloudformation deploy --region "$AWS_REGION" \
--stack-name devin-atx-runtime \
--template-file runtime.yaml \
--capabilities CAPABILITY_NAMED_IAM \
--no-execute-changeset \
--parameter-overrides \
ImageUri="$IMAGE_URI" \
DevinOrgId="<devin-org-id>" \
DevinTargetRepos="<owner/repo,owner/other-repo>"
# 审查命令输出的变更集,然后执行:
aws cloudformation execute-change-set --region "$AWS_REGION" \
--change-set-name <change-set-arn-from-output>
aws cloudformation wait stack-create-complete --region "$AWS_REGION" \
--stack-name devin-atx-runtime
| 参数 | 必填 | 值 |
|---|---|---|
ImageUri | 是 | 您的 Marketplace 履约页面中提供的带版本号的镜像 URI |
DevinOrgId | 是 | 您的 Devin 组织 ID |
DevinTargetRepos | 推荐 | 以逗号分隔的 owner/repo 列表,指定 Devin 可以在哪些代码仓库中创建拉取请求。留空则允许任何已连接的代码仓库 |
DevinPlaybookId | 否 | 附加到每个会话的 Devin playbook |
DevinApiBaseUrl | 仅限企业版 | 您的 Devin API 基础 URL。留空则使用 https://api.devin.ai |
DevinWebUrl | 仅限企业版 | 您的 Devin Web 应用 URL,用于生成会话链接。留空则使用 https://app.devin.ai |
DevinApiKeySecretName | 否 | 默认值为 devin-atx/devin-api-key。必须以 devin-atx/ 开头,这是权限边界唯一允许的前缀 |
BoundaryPolicyName | 否 | 默认值为 devin-atx-boundary |
devin_atx_orchestrator、其执行角色 devin-atx-agentcore-execution,以及 AWS Transform 调用角色 devin-atx-transform-invoke。请从堆栈输出中获取后续步骤所需的两个 ARN:aws cloudformation describe-stacks --region "$AWS_REGION" \
--stack-name devin-atx-runtime \
--query "Stacks[0].Outputs[?OutputKey=='RuntimeArn' || OutputKey=='InvokeRoleArn']" \
--output table
6
验证运行时
调用运行时的自检功能。该自检会从 Secrets Manager 读取 Devin 密钥,并发起一次只读的 Devin API 调用:运行时状态正常时,会返回
aws bedrock-agentcore invoke-agent-runtime --region "$AWS_REGION" \
--agent-runtime-arn "<RuntimeArn>" \
--qualifier DEFAULT \
--runtime-session-id "$(uuidgen | tr -d -)selfcheck" \
--content-type application/json --accept application/json \
--cli-binary-format raw-in-base64-out \
--payload '{"jsonrpc":"2.0","id":"selfcheck","method":"devin_atx/selfcheck","params":{}}' \
selfcheck.json
cat selfcheck.json
"ok": true,以及 "devinKey": "pass" 和 "devinApi": "pass"。如果其中任一项检查失败,请参阅故障排查。7
在 AWS Transform 中配置合作伙伴智能体
返回 Partner agents,选择 devin-modernization (此时仍处于 Pending configuration 状态) ,然后选择 Configure。填写以下内容:
状态随即变为 Enabled。

- Agent Version: 第 1 步中获取的版本
- Runtime ARN: 堆栈的
RuntimeArn输出 - Role ARN: 堆栈的
InvokeRoleArn输出



8
启动作业
创建一个 AWS Transform 作业,并选择 Devin: build, test, deploy。提供现代化改造工件和已连接的代码仓库,然后在作业聊天中讨论工作范围。通过该作业的审查任务,审查计划以及每个 pull request。
更新与维护
- 新版本: 使用新的
ImageUri重新部署运行时堆栈并运行自检,然后在 Configure 下设置新的 Agent Version。 - 密钥轮换: 在 Secrets Manager 控制台中将新密钥粘贴到该 secrets 中;或者运行步骤 3 中的命令,并将
create-secret --name替换为put-secret-value --secret-id。完成后再次运行自检。 - 允许的代码仓库: 使用新的
DevinTargetRepos值重新部署运行时堆栈。 - 卸载: 在 AWS Transform 中,对合作伙伴智能体选择 Disable,然后删除
devin-atx-runtime堆栈、边界堆栈 (如果安装器策略堆栈是由 Devin 安装的,则改为删除该策略堆栈) 以及该 secrets。
故障排查
| 症状 | 可能原因 |
|---|---|
| devin-modernization 未出现在 Partner agents 中 | 该账户尚未加入允许列表,或你位于其他区域。请提供你的账户 ID 并联系我们。 |
堆栈在 SupportedRegion 规则处失败 | 不支持该区域。请使用 us-east-1。 |
| 堆栈创建角色时失败,并报权限边界错误 | 请先在同一账户和区域中部署边界堆栈。 |
| 运行时无法启动或无法拉取镜像 | Marketplace 订阅未激活,或者 ImageUri 和 MarketplaceImageRepository 与履约页面上的镜像不一致。 |
自检 devinKey 失败 | secrets 缺失、为空或不是纯文本,或者 DevinApiKeySecretName 不匹配。 |
自检 devinKey 失败并报 KMS AccessDenied 错误 | 该 secrets 使用客户托管的 KMS 密钥加密,而执行角色没有该密钥的解密权限。请改用 AWS 托管的 Secrets Manager 密钥。 |
自检 devinApi 返回 403 | 服务用户的密钥缺少 ViewOrgSessions 权限。 |
自检 devinApi 返回 404 或连接错误 | 企业主机的 DevinApiBaseUrl 配置有误,或无法建立出站 HTTPS 连接。 |
后续 AWS Transform 调用返回 TerminalResourceException | 该作业的 Devin 会话已结束。请启动新作业。 |
/aws/bedrock-agentcore/runtimes/<runtime-id>-DEFAULT 下。联系 Cognition 时,请提供 AWS RequestId 和故障发生时间,切勿附上 API 密钥或 OIDC 令牌。
模板
权限边界模板
boundary.yaml
boundary.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: Permissions boundary for the Devin for AWS Transform AgentCore execution and Transform invocation roles.
Parameters:
MarketplaceImageRepository:
Type: String
AllowedPattern: 'arn:aws[a-z-]*:ecr:[a-z0-9-]+:[0-9]{12}:repository/.+'
Description: ECR repository ARN of the image on your AWS Marketplace fulfillment page.
ResourcePrefix:
Type: String
Default: devin-atx
AllowedPattern: '[a-z][a-z0-9-]{2,20}'
Description: Prefix for every stack, role, repository and secret Devin manages.
RuntimeName:
Type: String
Default: devin_atx_orchestrator
AllowedPattern: '[a-zA-Z][a-zA-Z0-9_]{0,47}'
Description: AgentRuntimeName of the orchestrator in runtime.yaml.
Resources:
RoleBoundary:
Type: AWS::IAM::ManagedPolicy
Metadata:
cfn-lint:
config:
ignore_checks: [W3037] # transform-agents/transform-registry 尚未成为公开的 IAM 前缀
Properties:
ManagedPolicyName: !Sub ${ResourcePrefix}-boundary
Description: Maximum permissions for the AgentCore execution and Transform invocation roles Devin creates.
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: EcrPull
Effect: Allow
Action: [ecr:BatchGetImage, ecr:GetDownloadUrlForLayer]
Resource:
- !Sub arn:${AWS::Partition}:ecr:${AWS::Region}:${AWS::AccountId}:repository/${ResourcePrefix}/*
- !Ref MarketplaceImageRepository
- Sid: EcrToken
Effect: Allow
Action: ecr:GetAuthorizationToken
Resource: '*'
- Sid: RuntimeLogs
Effect: Allow
Action: [logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents, logs:DescribeLogStreams]
Resource:
- !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/bedrock-agentcore/runtimes/*
- !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/bedrock-agentcore/runtimes/*:log-stream:*
- Sid: DescribeLogGroups
Effect: Allow
Action: logs:DescribeLogGroups
Resource: !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:*
- Sid: Tracing
Effect: Allow
Action: [xray:PutTraceSegments, xray:PutTelemetryRecords, xray:GetSamplingRules, xray:GetSamplingTargets]
Resource: '*'
- Sid: Metrics
Effect: Allow
Action: cloudwatch:PutMetricData
Resource: '*'
Condition:
StringEquals:
cloudwatch:namespace: bedrock-agentcore
- Sid: GetAgentAccessToken
Effect: Allow
Action:
- bedrock-agentcore:GetWorkloadAccessToken
- bedrock-agentcore:GetWorkloadAccessTokenForJWT
- bedrock-agentcore:GetWorkloadAccessTokenForUserId
Resource:
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:workload-identity-directory/default
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:workload-identity-directory/default/workload-identity/*
- Sid: OrchestratorRuntime
Effect: Allow
Action:
- bedrock-agentcore:InvokeAgentRuntime
- bedrock-agentcore:GetAgentRuntime
- bedrock-agentcore:GetAgentRuntimeEndpoint
- bedrock-agentcore:StopRuntimeSession
Resource:
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:runtime/${RuntimeName}-*
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:runtime/${RuntimeName}-*/runtime-endpoint/*
- Sid: AgentCoreRuntimeDiscovery
Effect: Allow
Action:
- bedrock-agentcore:ListAgentRuntimeEndpoints
- bedrock-agentcore:ListAgentRuntimeVersions
- bedrock-agentcore:ListAgentRuntimes
Resource: '*'
- Sid: DevinKey
Effect: Allow
Action: secretsmanager:GetSecretValue
Resource: !Sub arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:${ResourcePrefix}/*
- Sid: TransformApis
Effect: Allow
Action:
- transform-agents:ListJobPlanSteps
- transform-agents:PutJobPlan
- transform-agents:UpdateJobPlanStep
- transform-agents:CreateWorklog
- transform-agents:SendMessage
- transform-agents:ListArtifacts
- transform-agents:CreateArtifactUploadUrl
- transform-agents:GetArtifactMetadata
- transform-agents:CompleteArtifactUpload
- transform-agents:CreateArtifactDownloadUrl
- transform-agents:GetJob
- transform-agents:UpdateJobStatus
- transform-agents:CreateHitlTask
- transform-agents:StartHitlTask
- transform-agents:GetHitlTask
- transform-agents:CloseHitlTask
- transform-agents:GetAgentInstance
- transform-agents:UpdateAgentInstance
- transform-agents:RefreshAuthToken
Resource: '*'
Outputs:
BoundaryPolicyArn:
Value: !Ref RoleBoundary
运行时模板
runtime.yaml
runtime.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: AgentCore runtime and AWS Transform invocation roles for the Devin orchestrator.
Parameters:
ResourcePrefix:
Type: String
Default: devin-atx
ImageUri:
Type: String
Description: Versioned image URI from your AWS Marketplace fulfillment page.
DevinOrgId:
Type: String
DevinTargetRepos:
Type: String
Default: ''
DevinPlaybookId:
Type: String
Default: ''
DevinApiBaseUrl:
Type: String
Default: ''
DevinWebUrl:
Type: String
Default: ''
DevinApiKeySecretName:
Type: String
Default: devin-atx/devin-api-key
BoundaryPolicyName:
Type: String
Default: devin-atx-boundary
Mappings:
TransformRegions:
us-east-1:
ServicePrincipal: prod.us-east-1.compute.elastic-gumby.aws.internal
Rules:
SupportedRegion:
Assertions:
- Assert:
Fn::Contains:
- [us-east-1]
- !Ref AWS::Region
AssertDescription: Choose a supported region listed in Mappings.TransformRegions.
Resources:
AgentCoreExecutionRole:
Type: AWS::IAM::Role
Metadata:
cfn-lint:
config:
ignore_checks: [W3037] # transform-agents 目前还不是公开的 IAM 前缀
Properties:
RoleName: !Sub ${ResourcePrefix}-agentcore-execution
PermissionsBoundary: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:policy/${BoundaryPolicyName}
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: bedrock-agentcore.amazonaws.com
Action: sts:AssumeRole
Condition:
StringEquals:
aws:SourceAccount: !Ref AWS::AccountId
Policies:
- PolicyName: AgentCoreExecutionPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: ECRImageAccess
Effect: Allow
Action: [ecr:BatchGetImage, ecr:GetDownloadUrlForLayer]
Resource: !Sub arn:${AWS::Partition}:ecr:${AWS::Region}:${AWS::AccountId}:repository/${ResourcePrefix}/*
- Sid: MarketplaceImageAccess
Effect: Allow
Action: [ecr:BatchGetImage, ecr:GetDownloadUrlForLayer]
Resource: !Sub
- arn:${AWS::Partition}:ecr:${ImageRegion}:${ImageAccount}:repository/${ImageRepository}
- ImageAccount: !Select [0, !Split ['.', !Select [0, !Split ['/', !Ref ImageUri]]]]
ImageRegion: !Select [3, !Split ['.', !Select [0, !Split ['/', !Ref ImageUri]]]]
ImageRepository: !Select [0, !Split [':', !Select [0, !Split ['@', !Select [1, !Split ['.amazonaws.com/', !Ref ImageUri]]]]]]
- Sid: RuntimeLogs
Effect: Allow
Action: [logs:DescribeLogStreams, logs:CreateLogGroup]
Resource: !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/bedrock-agentcore/runtimes/*
- Sid: DescribeLogGroups
Effect: Allow
Action: logs:DescribeLogGroups
Resource: !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:*
- Sid: WriteRuntimeLogs
Effect: Allow
Action: [logs:CreateLogStream, logs:PutLogEvents]
Resource: !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/bedrock-agentcore/runtimes/*:log-stream:*
- Sid: ECRTokenAccess
Effect: Allow
Action: ecr:GetAuthorizationToken
Resource: '*'
- Sid: Tracing
Effect: Allow
Action:
- xray:PutTraceSegments
- xray:PutTelemetryRecords
- xray:GetSamplingRules
- xray:GetSamplingTargets
Resource: '*'
- Sid: RuntimeMetrics
Effect: Allow
Action: cloudwatch:PutMetricData
Resource: '*'
Condition:
StringEquals:
cloudwatch:namespace: bedrock-agentcore
- Sid: GetAgentAccessToken
Effect: Allow
Action:
- bedrock-agentcore:GetWorkloadAccessToken
- bedrock-agentcore:GetWorkloadAccessTokenForJWT
- bedrock-agentcore:GetWorkloadAccessTokenForUserId
Resource:
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:workload-identity-directory/default
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:workload-identity-directory/default/workload-identity/*
- Sid: DevinKey
Effect: Allow
Action: secretsmanager:GetSecretValue
Resource: !Sub arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:${DevinApiKeySecretName}-*
- Sid: TransformAgentsApiPolicy
Effect: Allow
Action: transform-agents:*
Resource: '*'
AgentCoreRuntime:
Type: AWS::BedrockAgentCore::Runtime
Properties:
AgentRuntimeName: devin_atx_orchestrator
AgentRuntimeArtifact:
ContainerConfiguration:
ContainerUri: !Ref ImageUri
RoleArn: !GetAtt AgentCoreExecutionRole.Arn
NetworkConfiguration:
NetworkMode: PUBLIC
ProtocolConfiguration: HTTP
EnvironmentVariables:
STAGE: prod
REGION: !Ref AWS::Region
DEVIN_ORG_ID: !Ref DevinOrgId
DEVIN_API_KEY_SECRET_ID: !Ref DevinApiKeySecretName
DEVIN_TARGET_REPOS: !Ref DevinTargetRepos
DEVIN_PLAYBOOK_ID: !Ref DevinPlaybookId
DEVIN_API_BASE_URL: !Ref DevinApiBaseUrl
DEVIN_WEB_URL: !Ref DevinWebUrl
USE_EXTERNAL_AGENTIC_API: 'true'
TransformInvokeRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Sub ${ResourcePrefix}-transform-invoke
PermissionsBoundary: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:policy/${BoundaryPolicyName}
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: !FindInMap [TransformRegions, !Ref AWS::Region, ServicePrincipal]
Action: sts:AssumeRole
Policies:
- PolicyName: AWSTransform-BedrockAgentRuntimePolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AWSTransformAgentCoreRuntimePermissions
Effect: Allow
Action:
- bedrock-agentcore:GetAgentRuntime
- bedrock-agentcore:GetAgentRuntimeEndpoint
- bedrock-agentcore:InvokeAgentRuntime
- bedrock-agentcore:ListAgentRuntimeEndpoints
- bedrock-agentcore:ListAgentRuntimeVersions
- bedrock-agentcore:ListAgentRuntimes
- bedrock-agentcore:StopRuntimeSession
Resource:
- !GetAtt AgentCoreRuntime.AgentRuntimeArn
- !Sub ${AgentCoreRuntime.AgentRuntimeArn}/*
Outputs:
RuntimeArn:
Value: !GetAtt AgentCoreRuntime.AgentRuntimeArn
ExecutionRoleArn:
Value: !GetAtt AgentCoreExecutionRole.Arn
InvokeRoleArn:
Value: !GetAtt TransformInvokeRole.Arn
可选:让 Devin 代为安装
Devin 会话可以代你完成安装,过程中会展示每个变更集,并等待你批准。它使用无密钥的 OIDC 联合身份验证:AWS 信任来自您的 Devin 组织的令牌,但仅限于一个专用的安装服务用户。- 另外创建一个 Devin 服务用户专门用于安装 (与运行时服务用户分开) ,并记下其
service-user-…ID。 - 使用你的
DevinOrgId、安装服务用户的DevinDeployServiceUserId以及DevinIssuerHost(app.devin.ai或您的企业主机) 部署 OIDC 信任模板。该模板会创建devin-aws-transform-agent角色,且不附带任何权限。 - 部署 安装程序策略模板,而非边界模板。传入与步骤 4 中相同的
MarketplaceImageRepository。该模板会创建相同的devin-atx-boundary,并将两个限定范围的安装程序策略附加到该角色。 - 以安装服务用户身份启动会话,让 Devin 在你的 AWS 账户和区域中设置 Devin for AWS Transform,并向其提供履约页面上的镜像 URI 和代码仓库 ARN。白名单配置申请和合作伙伴智能体的配置仍需你自行完成。
OIDC 信任模板
devin-oidc.yaml
devin-oidc.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: Keyless Devin access for an AWS Transform account; no deployment permissions granted.
Parameters:
DevinOrgId:
Type: String
AllowedPattern: '[A-Za-z0-9-]+'
Description: Exact org_id claim from a Devin token, not the account or enterprise ID.
DevinDeployServiceUserId:
Type: String
AllowedPattern: 'service-user-[A-Za-z0-9]+'
Description: service_user_id claim of the dedicated Devin service user allowed to deploy; sessions must request the token with subject-keys "org_id service_user_id"; sessions started by humans or other service users do not match.
DevinIssuerHost:
Type: String
AllowedPattern: '[a-z0-9.-]+'
Description: "Devin webapp host that issues the OIDC token: app.devin.ai or your enterprise host."
RoleName:
Type: String
Default: devin-aws-transform-agent
AllowedPattern: '[A-Za-z0-9+=,.@_-]+'
MaxLength: 64
CreateOidcProvider:
Type: String
Default: 'true'
AllowedValues: ['true', 'false']
Description: Set false if this account already has a provider for the configured issuer with the STS audience.
Conditions:
CreateProvider: !Equals [!Ref CreateOidcProvider, 'true']
Resources:
DevinOidcProvider:
Type: AWS::IAM::OIDCProvider
Condition: CreateProvider
Properties:
Url: !Sub https://${DevinIssuerHost}
ClientIdList: [sts.amazonaws.com]
Tags:
- Key: Project
Value: devin-aws-transform-agent
DevinRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Ref RoleName
Description: Devin OIDC role trusted only to the configured org_id and service_user_id; an administrator must separately attach reviewed deployment permissions.
MaxSessionDuration: 3600
AssumeRolePolicyDocument: !Sub
- |
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "${ProviderArn}"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"${DevinIssuerHost}:aud": "sts.amazonaws.com",
"${DevinIssuerHost}:sub": "org_id:${DevinOrgId}:service_user_id:${DevinDeployServiceUserId}"
}
}
}
]
}
- ProviderArn: !If
- CreateProvider
- !Ref DevinOidcProvider
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:oidc-provider/${DevinIssuerHost}
Tags:
- Key: Project
Value: devin-aws-transform-agent
Outputs:
DevinRoleArn:
Value: !GetAtt DevinRole.Arn
OidcProviderArn:
Value: !If
- CreateProvider
- !Ref DevinOidcProvider
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:oidc-provider/${DevinIssuerHost}
安装程序策略模板
devin-deploy-policy.yaml
devin-deploy-policy.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: >-
Installer permissions for the Devin OIDC role.
Scoped to the named orchestrator runtime, two bounded roles, devin-atx-* resources, and
selected AWS Transform registry and API actions. An administrator deploys this once,
after reviewing it.
Parameters:
MarketplaceImageRepository:
Type: String
AllowedPattern: 'arn:aws[a-z-]*:ecr:[a-z0-9-]+:[0-9]{12}:repository/.+'
Description: ECR repository ARN of the image on your AWS Marketplace fulfillment page.
DevinRoleName:
Type: String
Default: devin-aws-transform-agent
AllowedPattern: '[A-Za-z0-9+=,.@_-]+'
Description: Name of the role created by devin-oidc.yaml.
ResourcePrefix:
Type: String
Default: devin-atx
AllowedPattern: '[a-z][a-z0-9-]{2,20}'
Description: Prefix for every stack, role, repository and secret Devin manages.
RuntimeName:
Type: String
Default: devin_atx_orchestrator
AllowedPattern: '[a-zA-Z][a-zA-Z0-9_]{0,47}'
Description: AgentRuntimeName of the orchestrator in runtime.yaml.
Resources:
RoleBoundary:
Type: AWS::IAM::ManagedPolicy
Metadata:
cfn-lint:
config:
ignore_checks: [W3037] # transform-agents/transform-registry 目前还不是公开的 IAM 前缀
Properties:
ManagedPolicyName: !Sub ${ResourcePrefix}-boundary
Description: Maximum permissions for the AgentCore execution and Transform invocation roles Devin creates.
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: EcrPull
Effect: Allow
Action: [ecr:BatchGetImage, ecr:GetDownloadUrlForLayer]
Resource:
- !Sub arn:${AWS::Partition}:ecr:${AWS::Region}:${AWS::AccountId}:repository/${ResourcePrefix}/*
- !Ref MarketplaceImageRepository
- Sid: EcrToken
Effect: Allow
Action: ecr:GetAuthorizationToken
Resource: '*'
- Sid: RuntimeLogs
Effect: Allow
Action: [logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents, logs:DescribeLogStreams]
Resource:
- !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/bedrock-agentcore/runtimes/*
- !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/bedrock-agentcore/runtimes/*:log-stream:*
- Sid: DescribeLogGroups
Effect: Allow
Action: logs:DescribeLogGroups
Resource: !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:*
- Sid: Tracing
Effect: Allow
Action: [xray:PutTraceSegments, xray:PutTelemetryRecords, xray:GetSamplingRules, xray:GetSamplingTargets]
Resource: '*'
- Sid: Metrics
Effect: Allow
Action: cloudwatch:PutMetricData
Resource: '*'
Condition:
StringEquals:
cloudwatch:namespace: bedrock-agentcore
- Sid: GetAgentAccessToken
Effect: Allow
Action:
- bedrock-agentcore:GetWorkloadAccessToken
- bedrock-agentcore:GetWorkloadAccessTokenForJWT
- bedrock-agentcore:GetWorkloadAccessTokenForUserId
Resource:
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:workload-identity-directory/default
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:workload-identity-directory/default/workload-identity/*
- Sid: OrchestratorRuntime
Effect: Allow
Action:
- bedrock-agentcore:InvokeAgentRuntime
- bedrock-agentcore:GetAgentRuntime
- bedrock-agentcore:GetAgentRuntimeEndpoint
- bedrock-agentcore:StopRuntimeSession
Resource:
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:runtime/${RuntimeName}-*
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:runtime/${RuntimeName}-*/runtime-endpoint/*
- Sid: AgentCoreRuntimeDiscovery
Effect: Allow
Action:
- bedrock-agentcore:ListAgentRuntimeEndpoints
- bedrock-agentcore:ListAgentRuntimeVersions
- bedrock-agentcore:ListAgentRuntimes
Resource: '*'
- Sid: DevinKey
Effect: Allow
Action: secretsmanager:GetSecretValue
Resource: !Sub arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:${ResourcePrefix}/*
- Sid: TransformApis
Effect: Allow
Action:
- transform-agents:ListJobPlanSteps
- transform-agents:PutJobPlan
- transform-agents:UpdateJobPlanStep
- transform-agents:CreateWorklog
- transform-agents:SendMessage
- transform-agents:ListArtifacts
- transform-agents:CreateArtifactUploadUrl
- transform-agents:GetArtifactMetadata
- transform-agents:CompleteArtifactUpload
- transform-agents:CreateArtifactDownloadUrl
- transform-agents:GetJob
- transform-agents:UpdateJobStatus
- transform-agents:CreateHitlTask
- transform-agents:StartHitlTask
- transform-agents:GetHitlTask
- transform-agents:CloseHitlTask
- transform-agents:GetAgentInstance
- transform-agents:UpdateAgentInstance
- transform-agents:RefreshAuthToken
Resource: '*'
DeployPolicy:
Type: AWS::IAM::ManagedPolicy
Metadata:
cfn-lint:
config:
ignore_checks: [W3037] # transform-agents/transform-registry 目前还不是公开的 IAM 前缀
Properties:
ManagedPolicyName: !Sub ${ResourcePrefix}-devin-deploy
Description: Lets Devin build, deploy, register and debug the AWS Transform orchestrator.
Roles: [!Ref DevinRoleName]
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: CloudFormationStacks
Effect: Allow
Action:
- cloudformation:CreateStack
- cloudformation:UpdateStack
- cloudformation:DeleteStack
- cloudformation:CreateChangeSet
- cloudformation:DescribeChangeSet
- cloudformation:ExecuteChangeSet
- cloudformation:DeleteChangeSet
- cloudformation:ListChangeSets
- cloudformation:DescribeStacks
- cloudformation:DescribeStackEvents
- cloudformation:DescribeStackResources
- cloudformation:GetTemplate
Resource: !Sub arn:${AWS::Partition}:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${ResourcePrefix}-*/*
- Sid: CloudFormationRead
Effect: Allow
Action: [cloudformation:ListStacks, cloudformation:ValidateTemplate, cloudformation:GetTemplateSummary]
Resource: '*'
- Sid: EcrToken
Effect: Allow
Action: ecr:GetAuthorizationToken
Resource: '*'
- Sid: EcrRepositories
Effect: Allow
Action:
- ecr:CreateRepository
- ecr:DeleteRepository
- ecr:DescribeRepositories
- ecr:DescribeImages
- ecr:ListImages
- ecr:BatchGetImage
- ecr:BatchCheckLayerAvailability
- ecr:GetDownloadUrlForLayer
- ecr:InitiateLayerUpload
- ecr:UploadLayerPart
- ecr:CompleteLayerUpload
- ecr:PutImage
- ecr:BatchDeleteImage
- ecr:PutLifecyclePolicy
- ecr:PutImageScanningConfiguration
- ecr:TagResource
- ecr:UntagResource
- ecr:ListTagsForResource
Resource: !Sub arn:${AWS::Partition}:ecr:${AWS::Region}:${AWS::AccountId}:repository/${ResourcePrefix}/*
- Sid: CreateBoundedRoles
Effect: Allow
Action: [iam:CreateRole, iam:PutRolePolicy, iam:AttachRolePolicy, iam:DetachRolePolicy]
Resource:
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/${ResourcePrefix}-agentcore-execution
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/${ResourcePrefix}-transform-invoke
Condition:
StringEquals:
iam:PermissionsBoundary: !Ref RoleBoundary
- Sid: ManageOwnRoles
Effect: Allow
Action:
- iam:GetRole
- iam:GetRolePolicy
- iam:ListRolePolicies
- iam:ListAttachedRolePolicies
- iam:DeleteRole
- iam:DeleteRolePolicy
- iam:UpdateRole
- iam:TagRole
- iam:UntagRole
Resource:
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/${ResourcePrefix}-agentcore-execution
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/${ResourcePrefix}-transform-invoke
- Sid: PassExecutionRoleToAgentCore
Effect: Allow
Action: iam:PassRole
Resource: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/${ResourcePrefix}-agentcore-execution
Condition:
StringEquals:
iam:PassedToService: bedrock-agentcore.amazonaws.com
- Sid: ReadPolicies
Effect: Allow
Action: [iam:GetPolicy, iam:GetPolicyVersion, iam:SimulatePrincipalPolicy]
Resource:
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:policy/${ResourcePrefix}-*
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/${ResourcePrefix}-*
- Sid: DevinKeySecret
Effect: Allow
Action:
- secretsmanager:CreateSecret
- secretsmanager:DeleteSecret
- secretsmanager:DescribeSecret
- secretsmanager:PutSecretValue
- secretsmanager:UpdateSecret
- secretsmanager:TagResource
- secretsmanager:UntagResource
Resource: !Sub arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:${ResourcePrefix}/*
- Sid: RuntimeLogsRead
Effect: Allow
Action: [logs:DescribeLogStreams, logs:GetLogEvents, logs:FilterLogEvents, logs:StartQuery]
Resource: !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/bedrock-agentcore/*
- Sid: LogsDiscovery
Effect: Allow
Action: [logs:DescribeLogGroups, logs:GetQueryResults]
Resource: '*'
- Sid: NoBoundaryOrTrustChanges
Effect: Deny
Action:
- iam:DeleteRolePermissionsBoundary
- iam:PutRolePermissionsBoundary
- iam:UpdateAssumeRolePolicy
Resource: '*'
- Sid: NoPolicyTampering
Effect: Deny
Action:
- iam:CreatePolicyVersion
- iam:DeletePolicy
- iam:DeletePolicyVersion
- iam:SetDefaultPolicyVersion
Resource:
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:policy/${ResourcePrefix}-boundary
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:policy/${ResourcePrefix}-devin-deploy
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:policy/${ResourcePrefix}-devin-deploy-agentcore
DeployPolicyAgentCore:
Type: AWS::IAM::ManagedPolicy
Metadata:
cfn-lint:
config:
ignore_checks: [W3037] # transform-agents/transform-registry 目前还不是公开的 IAM 前缀
Properties:
ManagedPolicyName: !Sub ${ResourcePrefix}-devin-deploy-agentcore
Description: Lets Devin deploy the AgentCore runtime and call the AWS Transform APIs. Split from DeployPolicy to stay under the IAM policy size limit.
Roles: [!Ref DevinRoleName]
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AgentCoreServiceLinkedRole
Effect: Allow
Action: iam:CreateServiceLinkedRole
Resource: '*'
Condition:
StringLike:
iam:AWSServiceName: bedrock-agentcore.amazonaws.com
- Sid: AgentCoreNoResourceScope
Effect: Allow
Action:
- bedrock-agentcore:CreateAgentRuntime
- bedrock-agentcore:ListAgentRuntimes
- bedrock-agentcore:ListAgentRuntimeVersions
- bedrock-agentcore:ListAgentRuntimeEndpoints
Resource: '*'
- Sid: AgentCoreOrchestratorRuntime
Effect: Allow
Action:
- bedrock-agentcore:UpdateAgentRuntime
- bedrock-agentcore:DeleteAgentRuntime
- bedrock-agentcore:GetAgentRuntime
- bedrock-agentcore:CreateAgentRuntimeEndpoint
- bedrock-agentcore:UpdateAgentRuntimeEndpoint
- bedrock-agentcore:DeleteAgentRuntimeEndpoint
- bedrock-agentcore:GetAgentRuntimeEndpoint
- bedrock-agentcore:InvokeAgentRuntime
- bedrock-agentcore:StopRuntimeSession
- bedrock-agentcore:TagResource
- bedrock-agentcore:UntagResource
- bedrock-agentcore:ListTagsForResource
Resource:
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:runtime/${RuntimeName}-*
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:runtime/${RuntimeName}-*/runtime-endpoint/*
- Sid: AgentCoreWorkloadIdentity
Effect: Allow
Action:
- bedrock-agentcore:CreateWorkloadIdentity
- bedrock-agentcore:GetWorkloadIdentity
- bedrock-agentcore:UpdateWorkloadIdentity
- bedrock-agentcore:DeleteWorkloadIdentity
- bedrock-agentcore:TagResource
Resource:
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:workload-identity-directory/default
- !Sub arn:${AWS::Partition}:bedrock-agentcore:${AWS::Region}:${AWS::AccountId}:workload-identity-directory/default/workload-identity/*
- Sid: TransformRegistry
Effect: Allow
Action:
- transform-registry:GetAgent
- transform-registry:GetAgentVersion
- transform-registry:RegisterAgent
- transform-registry:PublishAgentVersion
- transform-registry:UpdatePublisherAccessControl
Resource: '*'
- Sid: TransformApis
Effect: Allow
Action:
- transform-agents:ListJobPlanSteps
- transform-agents:PutJobPlan
- transform-agents:UpdateJobPlanStep
- transform-agents:CreateWorklog
- transform-agents:SendMessage
- transform-agents:ListArtifacts
- transform-agents:CreateArtifactUploadUrl
- transform-agents:GetArtifactMetadata
- transform-agents:CompleteArtifactUpload
- transform-agents:CreateArtifactDownloadUrl
- transform-agents:GetJob
- transform-agents:UpdateJobStatus
- transform-agents:CreateHitlTask
- transform-agents:StartHitlTask
- transform-agents:GetHitlTask
- transform-agents:CloseHitlTask
- transform-agents:GetAgentInstance
- transform-agents:UpdateAgentInstance
- transform-agents:RefreshAuthToken
Resource: '*'
Outputs:
BoundaryPolicyArn:
Value: !Ref RoleBoundary
DeployPolicyArn:
Value: !Ref DeployPolicy
DeployPolicyAgentCoreArn:
Value: !Ref DeployPolicyAgentCore

