# VpcConfigProps

VPC configuration properties.

Only used when network mode is VPC.

Used as props by: [BrowserNetworkConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.BrowserNetworkConfiguration.html), [CodeInterpreterNetworkConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.CodeInterpreterNetworkConfiguration.html), NetworkConfiguration, RuntimeNetworkConfiguration
Used as argument in: [BrowserNetworkConfiguration.usingVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.BrowserNetworkConfiguration.html#usingvpc), CodeInterpreterNetworkConfiguration.usingVpc, 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#L11)
- 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

- `allowAllOutbound`: boolean = true — Whether to allow the resource to send all network traffic (except ipv6).

  If set to false, you must individually add traffic rules to allow the
  resource to connect to network targets.

  Do not specify this property if the `securityGroups` property is set.
  Instead, configure `allowAllOutbound` directly on the security group.

- `securityGroups`: [ISecurityGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — The list of security groups to associate with the resource's network interfaces.

  **Default:** If the resource is placed within a VPC and a security group is not specified by this prop, a dedicated security group will be created for this resource.

  Only used if 'vpc' is supplied.

- `vpc`: [IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — The VPC to deploy the resource to.

- `vpcSubnets`: [SubnetSelection](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — Where to place the network interfaces within the VPC.

  **Default:** the Vpc default strategy if not specified

  This requires `vpc` to be specified in order for interfaces to actually be
  placed in the subnets. If `vpc` is not specify, this will raise an error.
