# RuntimeNetworkConfiguration

Network configuration for the Runtime.

Extends: [NetworkConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.NetworkConfiguration.html) › RuntimeNetworkConfiguration
Obtainable from: RuntimeNetworkConfiguration.usingPublicNetwork, RuntimeNetworkConfiguration.usingVpc

- Source: [`aws-bedrockagentcore/lib/network/network-configuration.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/network/network-configuration.ts#L229)
- Type last changed: v2.255.0 · 19 May 2026

## Example

TypeScript:

```ts
const repository = new ecr.Repository(this, "TestRepository", {
  repositoryName: "test-agent-runtime",
});
const agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, "v1.0.0");

// Create or use an existing VPC
const vpc = new ec2.Vpc(this, 'MyVpc', {
  maxAzs: 2,
});

// Configure runtime with VPC
const runtime = new agentcore.Runtime(this, "MyAgentRuntime", {
  runtimeName: "myAgent",
  agentRuntimeArtifact: agentRuntimeArtifact,
  networkConfiguration: agentcore.RuntimeNetworkConfiguration.usingVpc(this, {
    vpc: vpc,
    vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
    // Optionally specify security groups, or one will be created automatically
    // securityGroups: [mySecurityGroup],
  }),
});
```

Python:

```python
repository = ecr.Repository(self, "TestRepository",
    repository_name="test-agent-runtime"
)
agent_runtime_artifact = agentcore.AgentRuntimeArtifact.from_ecr_repository(repository, "v1.0.0")

# Create or use an existing VPC
vpc = ec2.Vpc(self, "MyVpc",
    max_azs=2
)

# Configure runtime with VPC
runtime = agentcore.Runtime(self, "MyAgentRuntime",
    runtime_name="myAgent",
    agent_runtime_artifact=agent_runtime_artifact,
    network_configuration=agentcore.RuntimeNetworkConfiguration.using_vpc(self,
        vpc=vpc,
        vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS)
    )
)
```

Java:

```java
Repository repository = Repository.Builder.create(this, "TestRepository")
        .repositoryName("test-agent-runtime")
        .build();
AgentRuntimeArtifact agentRuntimeArtifact = AgentRuntimeArtifact.fromEcrRepository(repository, "v1.0.0");

// Create or use an existing VPC
Vpc vpc = Vpc.Builder.create(this, "MyVpc")
        .maxAzs(2)
        .build();

// Configure runtime with VPC
Runtime runtime = Runtime.Builder.create(this, "MyAgentRuntime")
        .runtimeName("myAgent")
        .agentRuntimeArtifact(agentRuntimeArtifact)
        .networkConfiguration(RuntimeNetworkConfiguration.usingVpc(this, VpcConfigProps.builder()
                .vpc(vpc)
                .vpcSubnets(SubnetSelection.builder().subnetType(SubnetType.PRIVATE_WITH_EGRESS).build())
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var repository = new Repository(this, "TestRepository", new RepositoryProps {
    RepositoryName = "test-agent-runtime"
});
var agentRuntimeArtifact = AgentRuntimeArtifact.FromEcrRepository(repository, "v1.0.0");

// Create or use an existing VPC
var vpc = new Vpc(this, "MyVpc", new VpcProps {
    MaxAzs = 2
});

// Configure runtime with VPC
var runtime = new Runtime(this, "MyAgentRuntime", new RuntimeProps {
    RuntimeName = "myAgent",
    AgentRuntimeArtifact = agentRuntimeArtifact,
    NetworkConfiguration = RuntimeNetworkConfiguration.UsingVpc(this, new VpcConfigProps {
        Vpc = vpc,
        VpcSubnets = new SubnetSelection { SubnetType = SubnetType.PRIVATE_WITH_EGRESS }
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
repository := ecr.NewRepository(this, jsii.String("TestRepository"), &RepositoryProps{
	RepositoryName: jsii.String("test-agent-runtime"),
})
agentRuntimeArtifact := agentcore.AgentRuntimeArtifact_FromEcrRepository(repository, jsii.String("v1.0.0"))

// Create or use an existing VPC
vpc := ec2.NewVpc(this, jsii.String("MyVpc"), &VpcProps{
	MaxAzs: jsii.Number(2),
})

// Configure runtime with VPC
runtime := agentcore.NewRuntime(this, jsii.String("MyAgentRuntime"), &RuntimeProps{
	RuntimeName: jsii.String("myAgent"),
	AgentRuntimeArtifact: agentRuntimeArtifact,
	NetworkConfiguration: agentcore.RuntimeNetworkConfiguration_UsingVpc(this, &VpcConfigProps{
		Vpc: vpc,
		VpcSubnets: &SubnetSelection{
			SubnetType: ec2.SubnetType_PRIVATE_WITH_EGRESS,
		},
	}),
})
```

## Properties

- `connections`: [Connections](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Connections.html) — The connections object to the network.

- `networkMode`: string — The network mode to use.

  Configure the security level for agent
  execution to control access, isolate resources, and protect sensitive data.

- `scope`: [Construct](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html) — The scope to create the resource in.

- `vpcSubnets`: [SubnetSelection](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — The VPC subnets to use.

## Methods

- `usingPublicNetwork(): RuntimeNetworkConfiguration // chainable` (static) — Creates a public network configuration.

  PUBLIC is the default network mode.

  **Returns:** A RuntimeNetworkConfiguration. Run the runtime in a public environment with internet access, suitable for less sensitive or open-use scenarios.

- `usingVpc(scope: Construct, vpcConfig: VpcConfigProps): RuntimeNetworkConfiguration // chainable` (static) — Creates a network configuration from a VPC configuration.

  **Parameters**

  - `scope` — - The construct scope for creating resources.
  - `vpcConfig` — - The VPC configuration.

  **Returns:** A RuntimeNetworkConfiguration.
