HttpVirtualNodeListenerOptions Struct
Represent the HTTP Node Listener property.
Example
ts
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({
port: 8081,
healthCheck: appmesh.HealthCheck.http({
healthyThreshold: 3,
interval: Duration.seconds(5), // minimum
path: '/health-check-path',
timeout: Duration.seconds(2), // minimum
unhealthyThreshold: 2,
}),
})],
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
});
python
# mesh: appmesh.Mesh
vpc = ec2.Vpc(self, "vpc")
namespace = cloudmap.PrivateDnsNamespace(self, "test-namespace",
vpc=vpc,
name="domain.local"
)
service = namespace.create_service("Svc")
node = mesh.add_virtual_node("virtual-node",
service_discovery=appmesh.ServiceDiscovery.cloud_map(service),
listeners=[appmesh.VirtualNodeListener.http(
port=8081,
health_check=appmesh.HealthCheck.http(
healthy_threshold=3,
interval=Duration.seconds(5), # minimum
path="/health-check-path",
timeout=Duration.seconds(2), # minimum
unhealthy_threshold=2
)
)],
access_log=appmesh.AccessLog.from_file_path("/dev/stdout")
)
java
Mesh mesh;
Vpc vpc = new Vpc(this, "vpc");
PrivateDnsNamespace namespace = PrivateDnsNamespace.Builder.create(this, "test-namespace")
.vpc(vpc)
.name("domain.local")
.build();
Service service = namespace.createService("Svc");
VirtualNode node = mesh.addVirtualNode("virtual-node", VirtualNodeBaseProps.builder()
.serviceDiscovery(ServiceDiscovery.cloudMap(service))
.listeners(List.of(VirtualNodeListener.http(HttpVirtualNodeListenerOptions.builder()
.port(8081)
.healthCheck(HealthCheck.http(HttpHealthCheckOptions.builder()
.healthyThreshold(3)
.interval(Duration.seconds(5)) // minimum
.path("/health-check-path")
.timeout(Duration.seconds(2)) // minimum
.unhealthyThreshold(2)
.build()))
.build())))
.accessLog(AccessLog.fromFilePath("/dev/stdout"))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Mesh mesh;
var vpc = new Vpc(this, "vpc");
var namespace = new PrivateDnsNamespace(this, "test-namespace", new PrivateDnsNamespaceProps {
Vpc = vpc,
Name = "domain.local"
});
var service = namespace.CreateService("Svc");
var node = mesh.AddVirtualNode("virtual-node", new VirtualNodeBaseProps {
ServiceDiscovery = ServiceDiscovery.CloudMap(service),
Listeners = new [] { VirtualNodeListener.Http(new HttpVirtualNodeListenerOptions {
Port = 8081,
HealthCheck = HealthCheck.Http(new HttpHealthCheckOptions {
HealthyThreshold = 3,
Interval = Duration.Seconds(5), // minimum
Path = "/health-check-path",
Timeout = Duration.Seconds(2), // minimum
UnhealthyThreshold = 2
})
}) },
AccessLog = AccessLog.FromFilePath("/dev/stdout")
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var mesh Mesh
vpc := ec2.NewVpc(this, jsii.String("vpc"))
namespace := cloudmap.NewPrivateDnsNamespace(this, jsii.String("test-namespace"), &PrivateDnsNamespaceProps{
Vpc: Vpc,
Name: jsii.String("domain.local"),
})
service := namespace.CreateService(jsii.String("Svc"))
node := mesh.addVirtualNode(jsii.String("virtual-node"), &VirtualNodeBaseProps{
ServiceDiscovery: appmesh.ServiceDiscovery_CloudMap(service),
Listeners: []VirtualNodeListener{
appmesh.VirtualNodeListener_Http(&HttpVirtualNodeListenerOptions{
Port: jsii.Number(8081),
HealthCheck: appmesh.HealthCheck_Http(&HttpHealthCheckOptions{
HealthyThreshold: jsii.Number(3),
Interval: awscdk.Duration_Seconds(jsii.Number(5)),
// minimum
Path: jsii.String("/health-check-path"),
Timeout: awscdk.Duration_*Seconds(jsii.Number(2)),
// minimum
UnhealthyThreshold: jsii.Number(2),
}),
}),
},
AccessLog: appmesh.AccessLog_FromFilePath(jsii.String("/dev/stdout")),
})
Properties
connectionPooloptionalHttpConnectionPoolconnection_pooloptionalHttpConnectionPoolconnectionPooloptionalHttpConnectionPoolConnectionPooloptionalHttpConnectionPoolConnectionPooloptionalHttpConnectionPool= None#Connection pool for http listeners.
healthCheckoptionalHealthCheckhealth_checkoptionalHealthCheckhealthCheckoptionalHealthCheckHealthCheckoptionalHealthCheckHealthCheckoptionalHealthCheck#The health check information for the listener.
Default: no healthcheck
outlierDetectionoptionalOutlierDetectionoutlier_detectionoptionalOutlierDetectionoutlierDetectionoptionalOutlierDetectionOutlierDetectionoptionalOutlierDetectionOutlierDetectionoptionalOutlierDetection= none#Represents the configuration for enabling outlier detection.
portoptionalnumberportoptionalint | floatportoptionalNumberPortoptionaldoublePortoptional*float64= 8080#Port to listen for connections on.
timeoutoptionalHttpTimeouttimeoutoptionalHttpTimeouttimeoutoptionalHttpTimeoutTimeoutoptionalHttpTimeoutTimeoutoptionalHttpTimeout= None#Timeout for HTTP protocol.
tlsoptionalListenerTlsOptionstlsoptionalListenerTlsOptionstlsoptionalListenerTlsOptionsTlsoptionalListenerTlsOptionsTlsoptionalListenerTlsOptions= none#Represents the configuration for enabling TLS on a listener.