# BrowserNetworkConfiguration

Network configuration for the Browser tool.

Extends: [NetworkConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.NetworkConfiguration.html) › BrowserNetworkConfiguration
Obtainable from: BrowserNetworkConfiguration.usingPublicNetwork, BrowserNetworkConfiguration.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#L144)
- Type last changed: v2.255.0 · 19 May 2026

## Example

TypeScript:

```ts
const vpc = new ec2.Vpc(this, 'testVPC');

const codeInterpreter = new agentcore.CodeInterpreterCustom(this, "MyCodeInterpreter", {
  codeInterpreterCustomName: "my_sandbox_interpreter",
  description: "Code interpreter with isolated network access",
  networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {
    vpc: vpc,
  }),
});

codeInterpreter.connections.addSecurityGroup(new ec2.SecurityGroup(this, 'AdditionalGroup', { vpc }));
```

Python:

```python
vpc = ec2.Vpc(self, "testVPC")

code_interpreter = agentcore.CodeInterpreterCustom(self, "MyCodeInterpreter",
    code_interpreter_custom_name="my_sandbox_interpreter",
    description="Code interpreter with isolated network access",
    network_configuration=agentcore.BrowserNetworkConfiguration.using_vpc(self,
        vpc=vpc
    )
)

code_interpreter.connections.add_security_group(ec2.SecurityGroup(self, "AdditionalGroup", vpc=vpc))
```

Java:

```java
Vpc vpc = new Vpc(this, "testVPC");

CodeInterpreterCustom codeInterpreter = CodeInterpreterCustom.Builder.create(this, "MyCodeInterpreter")
        .codeInterpreterCustomName("my_sandbox_interpreter")
        .description("Code interpreter with isolated network access")
        .networkConfiguration(BrowserNetworkConfiguration.usingVpc(this, VpcConfigProps.builder()
                .vpc(vpc)
                .build()))
        .build();

codeInterpreter.connections.addSecurityGroup(SecurityGroup.Builder.create(this, "AdditionalGroup").vpc(vpc).build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var vpc = new Vpc(this, "testVPC");

var codeInterpreter = new CodeInterpreterCustom(this, "MyCodeInterpreter", new CodeInterpreterCustomProps {
    CodeInterpreterCustomName = "my_sandbox_interpreter",
    Description = "Code interpreter with isolated network access",
    NetworkConfiguration = BrowserNetworkConfiguration.UsingVpc(this, new VpcConfigProps {
        Vpc = vpc
    })
});

codeInterpreter.Connections.AddSecurityGroup(new SecurityGroup(this, "AdditionalGroup", new SecurityGroupProps { Vpc = vpc }));
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
vpc := ec2.NewVpc(this, jsii.String("testVPC"))

codeInterpreter := agentcore.NewCodeInterpreterCustom(this, jsii.String("MyCodeInterpreter"), &CodeInterpreterCustomProps{
	CodeInterpreterCustomName: jsii.String("my_sandbox_interpreter"),
	Description: jsii.String("Code interpreter with isolated network access"),
	NetworkConfiguration: agentcore.BrowserNetworkConfiguration_UsingVpc(this, &VpcConfigProps{
		Vpc: vpc,
	}),
})

codeInterpreter.connections.AddSecurityGroup(ec2.NewSecurityGroup(this, jsii.String("AdditionalGroup"), &SecurityGroupProps{
	Vpc: Vpc,
}))
```

## 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(): BrowserNetworkConfiguration // chainable` (static) — Creates a public network configuration.

  PUBLIC is the default network mode.

  **Returns:** A BrowserNetworkConfiguration. Run this tool to operate in a public environment with internet access, suitable for less sensitive or open-use scenarios.

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

  **Parameters**

  - `vpcConfig` — - The VPC configuration.

  **Returns:** A BrowserNetworkConfiguration.
