Skip to content

Commit 0e20137

Browse files
AgentCore Runtime VPC設定機能とネットワーク構成オプションの追加 (#1360)
Co-authored-by: Taiki Maekawa <tmae@amazon.com>
1 parent 76b2d98 commit 0e20137

10 files changed

Lines changed: 1074 additions & 20 deletions

File tree

docs/en/DEPLOY_OPTION.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,65 @@ const envs: Record<string, Partial<StackInput>> = {
830830
}
831831
```
832832

833+
> [!NOTE]
834+
> After enabling AgentCore use case settings, if you want to disable them again, you can disable the AgentCore use case by setting `createGenericAgentCoreRuntime: false` and redeploying, but the `AgentCoreStack` itself will remain. You can completely remove it by opening the Management Console and deleting the `AgentCoreStack` stack from CloudFormation in the `agentCoreRegion`.
835+
836+
#### AgentCore Runtime Network Configuration
837+
838+
AgentCore Runtime can operate in the following network modes:
839+
840+
- `PUBLIC` (default): Operates on public network
841+
- `PRIVATE`: Operates on private network within VPC
842+
843+
Network settings apply to both Generic Runtime and AgentBuilder Runtime.
844+
845+
**Use cases for VPC mode**:
846+
847+
- When AgentCore Runtime needs to access internal systems or private databases
848+
- For example, when you want to communicate directly with other AWS services (RDS, ElastiCache, etc.) within the VPC
849+
850+
When using VPC mode, configure the following parameters:
851+
852+
- `agentCoreVpcId`: VPC ID to use
853+
- `agentCoreSubnetIds`: List of subnet IDs to use
854+
855+
> [!NOTE]
856+
> When both `agentCoreVpcId` and `agentCoreSubnetIds` are configured, AgentCore Runtime will be deployed in private network mode. If both are left unset (`null`), it will be deployed in public network mode.
857+
858+
> [!IMPORTANT]
859+
> **Availability Zone (AZ) Support**: AgentCore Runtime has limited supported AZs per region. Subnets must be placed within supported AZs. For details, please refer to the [AWS official documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-vpc.html#agentcore-supported-azs).
860+
>
861+
> **Internet Access**: AgentCore Runtime requires internet access for MCP server installation. If connecting to private subnets, configure routes to NAT Gateway.
862+
863+
**Edit [parameter.ts](/packages/cdk/parameter.ts)**
864+
865+
```typescript
866+
// parameter.ts
867+
const envs: Record<string, Partial<StackInput>> = {
868+
dev: {
869+
createGenericAgentCoreRuntime: true,
870+
agentCoreVpcId: 'vpc-xxxxxxxxx',
871+
agentCoreSubnetIds: ['subnet-xxxxxxxxx', 'subnet-yyyyyyyyy'],
872+
},
873+
};
874+
```
875+
876+
**Edit [packages/cdk/cdk.json](/packages/cdk/cdk.json)**
877+
878+
```json
879+
// cdk.json
880+
{
881+
"context": {
882+
"createGenericAgentCoreRuntime": true,
883+
"agentCoreVpcId": "vpc-xxxxxxxxx",
884+
"agentCoreSubnetIds": ["subnet-xxxxxxxxx", "subnet-yyyyyyyyy"]
885+
}
886+
}
887+
```
888+
889+
> [!WARNING]
890+
> When using VPC mode, security groups are not automatically deleted when AgentCore Runtime is deleted due to changes such as from PRIVATE to PUBLIC. This is because AWS-managed ENIs created by AgentCore Runtime reference the security groups, making them undeletable by CloudFormation. After deleting AgentCore Runtime, wait for the managed ENIs to be automatically deleted, then manually delete the security groups. The security group IDs that need to be deleted are displayed in the CloudFormation outputs. Note: if the initial deployment fails (e.g., unsupported AZ), the security group may also remain and need to be cleaned up manually.
891+
833892
### Enabling AgentBuilder Use Case
834893

835894
This is a use case where users can freely create Agents for each use case by configuring system prompts and arbitrary MCPs. (Experimental: Breaking changes may be made without notice)

docs/ja/DEPLOY_OPTION.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,65 @@ const envs: Record<string, Partial<StackInput>> = {
849849
}
850850
```
851851

852+
> [!NOTE]
853+
> AgentCore ユースケースの設定を有効後に、再度無効化する場合は、`createGenericAgentCoreRuntime: false` にして再デプロイすればAgentCore ユースケースは無効化されますが、`AgentCoreStack` 自体は残ります。マネージメントコンソールを開き、`agentCoreRegion` の CloudFormation から `AgentCoreStack` というスタックを削除することで完全に消去ができます。
854+
855+
#### AgentCore Runtime のネットワーク設定
856+
857+
AgentCore Runtime は以下のネットワークモードで動作できます:
858+
859+
- `PUBLIC` (デフォルト): パブリックネットワークで動作
860+
- `PRIVATE`: VPC内のプライベートネットワークで動作
861+
862+
ネットワーク設定は、Generic Runtime と AgentBuilder Runtime の両方に適用されます。
863+
864+
**VPCモードの使用場面**:
865+
866+
- AgentCore Runtime から社内システムやプライベートデータベースにアクセスする必要がある場合
867+
- 例えば、VPC内の他のAWSサービス(RDS、ElastiCache等)と直接通信したい場合
868+
869+
VPC モードを使用する場合は、以下のパラメータを設定してください:
870+
871+
- `agentCoreVpcId`: 使用するVPCのID
872+
- `agentCoreSubnetIds`: 使用するサブネットのIDリスト
873+
874+
> [!NOTE]
875+
> `agentCoreVpcId``agentCoreSubnetIds`を両方設定すると、AgentCore Runtimeはプライベートネットワークモードでデプロイされます。両方とも未設定(`null`)の場合は、パブリックネットワークモードでデプロイされます。
876+
877+
> [!IMPORTANT]
878+
> **Availability Zone (AZ) サポート**: AgentCore RuntimeはリージョンごとにサポートされているAZが限定されています。サブネットは必ずサポートされているAZ内に配置してください。詳細は[AWS公式ドキュメント](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-vpc.html#agentcore-supported-azs)をご確認ください。
879+
>
880+
> **インターネットアクセス**: AgentCore Runtime で MCP サーバーのインストールにはインターネットアクセスが必要です。プライベートサブネットが接続先の場合には NAT Gateway 等のインターネット到達経路を設定してください。
881+
882+
**[parameter.ts](/packages/cdk/parameter.ts) を編集**
883+
884+
```typescript
885+
// parameter.ts
886+
const envs: Record<string, Partial<StackInput>> = {
887+
dev: {
888+
createGenericAgentCoreRuntime: true,
889+
agentCoreVpcId: 'vpc-xxxxxxxxx',
890+
agentCoreSubnetIds: ['subnet-xxxxxxxxx', 'subnet-yyyyyyyyy'],
891+
},
892+
};
893+
```
894+
895+
**[packages/cdk/cdk.json](/packages/cdk/cdk.json) を編集**
896+
897+
```json
898+
// cdk.json
899+
{
900+
"context": {
901+
"createGenericAgentCoreRuntime": true,
902+
"agentCoreVpcId": "vpc-xxxxxxxxx",
903+
"agentCoreSubnetIds": ["subnet-xxxxxxxxx", "subnet-yyyyyyyyy"]
904+
}
905+
}
906+
```
907+
908+
> [!WARNING]
909+
> VPC モードを使用する場合、例えば PRIVATE から PUBLIC への変更により AgentCore Runtime 削除時にセキュリティグループが自動削除されません。AgentCore Runtime が作成する AWS マネージドな ENI がセキュリティグループを参照するため、CloudFormation では削除できません。AgentCore Runtime 削除後、マネージド ENI が自動削除されるまで待ってから、手動でセキュリティグループを削除してください。削除が必要なセキュリティグループ ID は CloudFormation の出力に表示されます。
910+
852911
### AgentBuilder ユースケースの有効化
853912

854913
ユーザーがシステムプロンプトと任意の MCP を設定することでユースケースごとの Agent を自由に作成できるユースケースです。(Experimental: 予告なく破壊的変更を行うことがあります)

docs/ko/DEPLOY_OPTION.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,67 @@ const envs: Record<string, Partial<StackInput>> = {
820820
}
821821
```
822822

823+
> [!NOTE]
824+
> AgentCore 사용 사례 설정을 활성화한 후 다시 비활성화하려면 `createGenericAgentCoreRuntime: false`로 설정하고 재배포하면 AgentCore 사용 사례가 비활성화되지만 `AgentCoreStack` 자체는 남아있습니다. 관리 콘솔을 열고 `agentCoreRegion`의 CloudFormation에서 `AgentCoreStack` 스택을 삭제하여 완전히 제거할 수 있습니다.
825+
826+
#### AgentCore Runtime 네트워크 설정
827+
828+
AgentCore Runtime은 다음 네트워크 모드에서 작동할 수 있습니다:
829+
830+
- `PUBLIC` (기본값): 퍼블릭 네트워크에서 작동
831+
- `PRIVATE`: VPC 내 프라이빗 네트워크에서 작동
832+
833+
네트워크 설정은 Generic Runtime과 AgentBuilder Runtime 모두에 적용됩니다.
834+
835+
**VPC 모드 사용 사례**:
836+
837+
- AgentCore Runtime에서 사내 시스템이나 프라이빗 데이터베이스에 액세스해야 하는 경우
838+
- 예를 들어, VPC 내의 다른 AWS 서비스(RDS, ElastiCache 등)와 직접 통신하고 싶은 경우
839+
840+
VPC 모드를 사용할 때는 다음 매개변수를 설정하세요:
841+
842+
- `agentCoreVpcId`: 사용할 VPC ID
843+
- `agentCoreSubnetIds`: 사용할 서브넷 ID 목록
844+
845+
> [!NOTE]
846+
> `agentCoreVpcId``agentCoreSubnetIds`를 모두 설정하면 AgentCore Runtime이 프라이빗 네트워크 모드로 배포됩니다. 둘 다 미설정(`null`)인 경우 퍼블릭 네트워크 모드로 배포됩니다.
847+
848+
> [!IMPORTANT]
849+
> **가용 영역(AZ) 지원**: AgentCore Runtime은 리전별로 지원되는 AZ가 제한되어 있습니다. 서브넷은 반드시 지원되는 AZ 내에 배치해야 합니다. 자세한 내용은 [AWS 공식 문서](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-vpc.html#agentcore-supported-azs)를 확인하세요.
850+
>
851+
> **인터넷 액세스**: AgentCore Runtime에서 MCP 서버 설치에는 인터넷 액세스가 필요합니다. 프라이빗 서브넷이 연결 대상인 경우 NAT Gateway 등 인터넷 도달 경로를 설정하세요.
852+
853+
**[parameter.ts](/packages/cdk/parameter.ts) 편집**
854+
855+
```typescript
856+
// parameter.ts
857+
const envs: Record<string, Partial<StackInput>> = {
858+
dev: {
859+
createGenericAgentCoreRuntime: true,
860+
agentBuilderEnabled: true,
861+
agentCoreVpcId: 'vpc-xxxxxxxxx',
862+
agentCoreSubnetIds: ['subnet-xxxxxxxxx', 'subnet-yyyyyyyyy'],
863+
},
864+
};
865+
```
866+
867+
**[packages/cdk/cdk.json](/packages/cdk/cdk.json) 편집**
868+
869+
```json
870+
// cdk.json
871+
{
872+
"context": {
873+
"createGenericAgentCoreRuntime": true,
874+
"agentBuilderEnabled": true,
875+
"agentCoreVpcId": "vpc-xxxxxxxxx",
876+
"agentCoreSubnetIds": ["subnet-xxxxxxxxx", "subnet-yyyyyyyyy"]
877+
}
878+
}
879+
```
880+
881+
> [!WARNING]
882+
> VPC 모드를 사용할 때, 예를 들어 PRIVATE에서 PUBLIC으로의 변경으로 인해 AgentCore Runtime 삭제 시 보안 그룹이 자동 삭제되지 않습니다. AgentCore Runtime이 생성하는 AWS 관리형 ENI가 보안 그룹을 참조하기 때문에 CloudFormation에서는 삭제할 수 없습니다. AgentCore Runtime 삭제 후 관리형 ENI가 자동 삭제될 때까지 기다린 다음 수동으로 보안 그룹을 삭제하세요. 삭제가 필요한 보안 그룹 ID는 CloudFormation 출력에 표시됩니다.
883+
823884
### Voice Chat 사용 사례 활성화
824885

825886
> [!NOTE]

packages/cdk/cdk.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
"createGenericAgentCoreRuntime": false,
7272
"agentCoreRegion": null,
7373
"agentCoreExternalRuntimes": [],
74+
"agentCoreVpcId": null,
75+
"agentCoreSubnetIds": null,
7476
"agentCoreGatewayArns": [],
7577
"researchAgentEnabled": false,
7678
"researchAgentBraveApiKey": "",

packages/cdk/lib/agent-core-stack.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export class AgentCoreStack extends Stack {
2323
env: params.env,
2424
createGenericRuntime: params.createGenericAgentCoreRuntime,
2525
createAgentBuilderRuntime: params.agentBuilderEnabled,
26+
isAgentCoreNetworkPrivate: params.isAgentCoreNetworkPrivate,
27+
agentCoreVpcId: params.agentCoreVpcId,
28+
agentCoreSubnetIds: params.agentCoreSubnetIds,
2629
gatewayArns: params.agentCoreGatewayArns ?? undefined,
2730
});
2831

@@ -44,6 +47,15 @@ export class AgentCoreStack extends Stack {
4447
);
4548
}
4649

50+
// Output retained security group ID for manual cleanup
51+
if (this.genericAgentCore.retainedSecurityGroupId) {
52+
new CfnOutput(this, 'RetainedSecurityGroupId', {
53+
value: this.genericAgentCore.retainedSecurityGroupId,
54+
description:
55+
'MANUAL CLEANUP REQUIRED: Security Group ID to delete after AgentCore ENI cleanup (check tags: ManualCleanupRequired=true)',
56+
});
57+
}
58+
4759
if (
4860
params.agentBuilderEnabled &&
4961
this.genericAgentCore.deployedAgentBuilderRuntimeArn

0 commit comments

Comments
 (0)