Skip to content
v2.278.0

VirtualRouterProps Struct ​

The properties used when creating a new VirtualRouter.

Example ​

ts
declare const infraStack: cdk.Stack;
declare const appStack: cdk.Stack;

const mesh = new appmesh.Mesh(infraStack, 'AppMesh', {
  meshName: 'myAwsMesh',
  egressFilter: appmesh.MeshFilterType.ALLOW_ALL,
});

// the VirtualRouter will belong to 'appStack',
// even though the Mesh belongs to 'infraStack'
const router = new appmesh.VirtualRouter(appStack, 'router', {
  mesh, // notice that mesh is a required property when creating a router with the 'new' statement
  listeners: [appmesh.VirtualRouterListener.http(8081)],
});
python
# infra_stack: cdk.Stack
# app_stack: cdk.Stack


mesh = appmesh.Mesh(infra_stack, "AppMesh",
    mesh_name="myAwsMesh",
    egress_filter=appmesh.MeshFilterType.ALLOW_ALL
)

# the VirtualRouter will belong to 'appStack',
# even though the Mesh belongs to 'infraStack'
router = appmesh.VirtualRouter(app_stack, "router",
    mesh=mesh,  # notice that mesh is a required property when creating a router with the 'new' statement
    listeners=[appmesh.VirtualRouterListener.http(8081)]
)
java
Stack infraStack;
Stack appStack;


Mesh mesh = Mesh.Builder.create(infraStack, "AppMesh")
        .meshName("myAwsMesh")
        .egressFilter(MeshFilterType.ALLOW_ALL)
        .build();

// the VirtualRouter will belong to 'appStack',
// even though the Mesh belongs to 'infraStack'
VirtualRouter router = VirtualRouter.Builder.create(appStack, "router")
        .mesh(mesh) // notice that mesh is a required property when creating a router with the 'new' statement
        .listeners(List.of(VirtualRouterListener.http(8081)))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Stack infraStack;
Stack appStack;


var mesh = new Mesh(infraStack, "AppMesh", new MeshProps {
    MeshName = "myAwsMesh",
    EgressFilter = MeshFilterType.ALLOW_ALL
});

// the VirtualRouter will belong to 'appStack',
// even though the Mesh belongs to 'infraStack'
var router = new VirtualRouter(appStack, "router", new VirtualRouterProps {
    Mesh = mesh,  // notice that mesh is a required property when creating a router with the 'new' statement
    Listeners = new [] { VirtualRouterListener.Http(8081) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var infraStack Stack
var appStack Stack


mesh := appmesh.NewMesh(infraStack, jsii.String("AppMesh"), &MeshProps{
	MeshName: jsii.String("myAwsMesh"),
	EgressFilter: appmesh.MeshFilterType_ALLOW_ALL,
})

// the VirtualRouter will belong to 'appStack',
// even though the Mesh belongs to 'infraStack'
router := appmesh.NewVirtualRouter(appStack, jsii.String("router"), &VirtualRouterProps{
	Mesh: Mesh,
	 // notice that mesh is a required property when creating a router with the 'new' statement
	Listeners: []VirtualRouterListener{
		appmesh.VirtualRouterListener_Http(jsii.Number(8081)),
	},
})

Properties ​

listenersoptionalVirtualRouterListener[]listenersoptionaltyping.List[VirtualRouterListener]listenersoptionalList<VirtualRouterListener>ListenersoptionalVirtualRouterListener[]Listenersoptional*[]VirtualRouterListener #
Listener specification for the VirtualRouter.

Default: A listener on HTTP port 8080

meshIMeshmeshIMeshmeshIMeshMeshIMeshMeshIMesh required #
The Mesh which the VirtualRouter belongs to.
virtualRouterNameoptionalstringvirtual_router_nameoptionalstrvirtualRouterNameoptionalStringVirtualRouterNameoptionalstringVirtualRouterNameoptional*string #
The name of the VirtualRouter.

Default: A name is automatically determined