View a markdown version of this page

使用 CLI 创建 AgentCore 网关 - Amazon Bedrock AgentCore

使用 CLI 创建 AgentCore 网关

您可以使用 AgentCore CLI 通过简化的命令创建网关。CLI 会自动处理常见配置,包括 IAM 角色创建和授权设置。

AgentCore CLI
  1. 未经授权创建网关:

    agentcore add gateway \ --name MyGateway \ --authorizer-type NONE \ --runtimes MyAgent agentcore deploy

    使用 JWT 授权创建网关:

    agentcore add gateway \ --name MyGateway \ --authorizer-type CUSTOM_JWT \ --discovery-url https://your-idp.example.com/.well-known/openid-configuration \ --allowed-audience your-audience agentcore deploy

    默认情况下,语义搜索处于启用状态。要将其禁用,请传递标--no-semantic-search志:

    agentcore add gateway \ --name MyGateway \ --authorizer-type NONE \ --runtimes MyAgent \ --no-semantic-search agentcore deploy
Interactive
  1. 您也可以使用 AgentCore CLI 交互式终端 UI。运行打开 agentcore TUI,然后选择添加并选择网关

  2. 在 “添加资源” 菜单中,选择 “网关”,然后按 Enter

    TUI 添加资源菜单,突出显示网关
  3. 输入网关的名称,然后按 Enter

    TUI 网关向导使用文本输入命名步骤
  4. 为您的网关选择授权者类型。选择 “”、“自定义 JWT” 或 “IAM”,然后按 Enter

    TUI 网关向导 Authorizer 步骤显示未选中
  5. (可选)配置高级设置,例如语义搜索和调试异常级别。使用空格键切换选项,然后按 Enter 继续操作。

    启用语义搜索的 TUI 网关向导高级配置步骤
  6. 查看网关配置摘要,然后按 Enter 进行确认。

    TUI 网关向导查看配置摘要

创建网关后,您可以使用agentcore add gateway-target命令添加目标。有关 CLI 命令的更多信息,请参阅 Gat eway 入 AgentCore 门