Skip to content
v2.278.0

RuntimeNetworkConfiguration Class ​

Network configuration for the Runtime.

Example ​

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
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
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();
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 }
    })
});
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 ​

connectionsmay be undefinedConnectionsconnectionsmay be undefinedConnectionsconnectionsmay be undefinedConnectionsConnectionsmay be undefinedConnectionsConnectionsmay be undefinedConnections #
The connections object to the network.
networkModestringnetwork_modestrnetworkModeStringNetworkModestringNetworkMode*string #
The network mode to use.

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

scopemay be undefinedConstructscopemay be undefinedConstructscopemay be undefinedConstructScopemay be undefinedConstructScopemay be undefinedConstruct #
The scope to create the resource in.
vpcSubnetsmay be undefinedSubnetSelectionvpc_subnetsmay be undefinedSubnetSelectionvpcSubnetsmay be undefinedSubnetSelectionVpcSubnetsmay be undefinedSubnetSelectionVpcSubnetsmay be undefinedSubnetSelection #
The VPC subnets to use.

Methods ​

usingPublicNetwork(): RuntimeNetworkConfiguration // chainable@staticmethod def using_public_network() -> RuntimeNetworkConfigurationpublic static RuntimeNetworkConfiguration usingPublicNetwork()public static RuntimeNetworkConfiguration UsingPublicNetwork()func UsingPublicNetwork() RuntimeNetworkConfiguration static #
Creates a public network configuration.

PUBLIC is the default network mode.

returns

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@staticmethod def using_vpc(scope: Construct, vpc_config: VpcConfigProps) -> RuntimeNetworkConfigurationpublic static RuntimeNetworkConfiguration usingVpc(Construct scope, VpcConfigProps vpcConfig)public static RuntimeNetworkConfiguration UsingVpc(Construct scope, VpcConfigProps vpcConfig)func UsingVpc(Scope Construct, VpcConfig VpcConfigProps) RuntimeNetworkConfiguration static #
Creates a network configuration from a VPC configuration.
2 parameters · returns

Parameters

  • scopescopescopescopeScope — - The construct scope for creating resources.
  • vpcConfigvpc_configvpcConfigvpcConfigVpcConfig — - The VPC configuration.

Returns: A RuntimeNetworkConfiguration.