class VirtualNode (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppMesh.VirtualNode |
Java | software.amazon.awscdk.services.appmesh.VirtualNode |
Python | aws_cdk.aws_appmesh.VirtualNode |
TypeScript (source) | @aws-cdk/aws-appmesh » VirtualNode |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IVirtual
VirtualNode represents a newly defined AppMesh VirtualNode.
Any inbound traffic that your virtual node expects should be specified as a listener. Any outbound traffic that your virtual node expects to reach should be specified as a backend.
See also: https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_nodes.html
Example
// Cloud Map service discovery is currently required for host ejection by outlier detection
const vpc = new ec2.Vpc(this, 'vpc');
const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', {
vpc,
name: 'domain.local',
});
const service = namespace.createService('Svc');
declare const mesh: appmesh.Mesh;
const node = mesh.addVirtualNode('virtual-node', {
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
listeners: [appmesh.VirtualNodeListener.http({
outlierDetection: {
baseEjectionDuration: cdk.Duration.seconds(10),
interval: cdk.Duration.seconds(30),
maxEjectionPercent: 50,
maxServerErrors: 5,
},
})],
});
Initializer
new VirtualNode(scope: Construct, id: string, props: VirtualNodeProps)
Parameters
- scope
Construct
- id
string
- props
Virtual
Node Props
Construct Props
Name | Type | Description |
---|---|---|
mesh | IMesh | The Mesh which the VirtualNode belongs to. |
access | Access | Access Logging Configuration for the virtual node. |
backend | Backend | Default Configuration Virtual Node uses to communicate with Virtual Service. |
backends? | Backend [] | Virtual Services that this is node expected to send outbound traffic to. |
listeners? | Virtual [] | Initial listener for the virtual node. |
service | Service | Defines how upstream clients will discover this VirtualNode. |
virtual | string | The name of the VirtualNode. |
mesh
Type:
IMesh
The Mesh which the VirtualNode belongs to.
accessLog?
Type:
Access
(optional, default: No access logging)
Access Logging Configuration for the virtual node.
backendDefaults?
Type:
Backend
(optional, default: No Config)
Default Configuration Virtual Node uses to communicate with Virtual Service.
backends?
Type:
Backend
[]
(optional, default: No backends)
Virtual Services that this is node expected to send outbound traffic to.
listeners?
Type:
Virtual
[]
(optional, default: No listeners)
Initial listener for the virtual node.
serviceDiscovery?
Type:
Service
(optional, default: No Service Discovery)
Defines how upstream clients will discover this VirtualNode.
virtualNodeName?
Type:
string
(optional, default: A name is automatically determined)
The name of the VirtualNode.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
mesh | IMesh | The Mesh which the VirtualNode belongs to. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
virtual | string | The Amazon Resource Name belonging to the VirtualNode. |
virtual | string | The name of the VirtualNode. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
mesh
Type:
IMesh
The Mesh which the VirtualNode belongs to.
node
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
virtualNodeArn
Type:
string
The Amazon Resource Name belonging to the VirtualNode.
virtualNodeName
Type:
string
The name of the VirtualNode.
Methods
Name | Description |
---|---|
add | Add a Virtual Services that this node is expected to send outbound traffic to. |
add | Utility method to add an inbound listener for this VirtualNode. |
apply | Apply the given removal policy to this resource. |
grant | Grants the given entity appmesh:StreamAggregatedResources . |
to | Returns a string representation of this construct. |
static from | Import an existing VirtualNode given an ARN. |
static from | Import an existing VirtualNode given its name. |
Backend(backend)
addpublic addBackend(backend: Backend): void
Parameters
- backend
Backend
Add a Virtual Services that this node is expected to send outbound traffic to.
Listener(listener)
addpublic addListener(listener: VirtualNodeListener): void
Parameters
- listener
Virtual
Node Listener
Utility method to add an inbound listener for this VirtualNode.
Note: At this time, Virtual Nodes support at most one listener. Adding more than one will result in a failure to deploy the CloudFormation stack. However, the App Mesh team has plans to add support for multiple listeners on Virtual Nodes and Virtual Routers.
See also: https://github.com/aws/aws-app-mesh-roadmap/issues/120
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
StreamAggregatedResources(identity)
grantpublic grantStreamAggregatedResources(identity: IGrantable): Grant
Parameters
- identity
IGrantable
Returns
Grants the given entity appmesh:StreamAggregatedResources
.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
VirtualNodeArn(scope, id, virtualNodeArn)
static frompublic static fromVirtualNodeArn(scope: Construct, id: string, virtualNodeArn: string): IVirtualNode
Parameters
- scope
Construct
- id
string
- virtualNodeArn
string
Returns
Import an existing VirtualNode given an ARN.
VirtualNodeAttributes(scope, id, attrs)
static frompublic static fromVirtualNodeAttributes(scope: Construct, id: string, attrs: VirtualNodeAttributes): IVirtualNode
Parameters
- scope
Construct
- id
string
- attrs
Virtual
Node Attributes
Returns
Import an existing VirtualNode given its name.