IpInstanceBaseProps Struct
| Source | aws-servicediscovery/lib/ip-instance.ts |
|---|
Example
ts
import * as cdk from '../../core';
import * as servicediscovery from '../lib';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-servicediscovery-integ');
const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', {
name: 'MyHTTPNamespace',
});
const service1 = namespace.createService('NonIpService', {
description: 'service registering non-ip instances',
});
service1.registerNonIpInstance('NonIpInstance', {
customAttributes: { arn: 'arn:aws:s3:::amzn-s3-demo-bucket' },
});
const service2 = namespace.createService('IpService', {
description: 'service registering ip instances',
healthCheck: {
type: servicediscovery.HealthCheckType.HTTP,
resourcePath: '/check',
},
});
service2.registerIpInstance('IpInstance', {
ipv4: '54.239.25.192',
});
app.synth();
python
import aws_cdk as cdk
import aws_cdk as servicediscovery
app = cdk.App()
stack = cdk.Stack(app, "aws-servicediscovery-integ")
namespace = servicediscovery.HttpNamespace(stack, "MyNamespace",
name="MyHTTPNamespace"
)
service1 = namespace.create_service("NonIpService",
description="service registering non-ip instances"
)
service1.register_non_ip_instance("NonIpInstance",
custom_attributes={"arn": "arn:aws:s3:::amzn-s3-demo-bucket"}
)
service2 = namespace.create_service("IpService",
description="service registering ip instances",
health_check=cdk.aws_servicediscovery.HealthCheckConfig(
type=servicediscovery.HealthCheckType.HTTP,
resource_path="/check"
)
)
service2.register_ip_instance("IpInstance",
ipv4="54.239.25.192"
)
app.synth()
java
import software.amazon.awscdk.*;
import software.amazon.awscdk.*;
App app = new App();
Stack stack = new Stack(app, "aws-servicediscovery-integ");
HttpNamespace namespace = HttpNamespace.Builder.create(stack, "MyNamespace")
.name("MyHTTPNamespace")
.build();
Service service1 = namespace.createService("NonIpService", BaseServiceProps.builder()
.description("service registering non-ip instances")
.build());
service1.registerNonIpInstance("NonIpInstance", NonIpInstanceBaseProps.builder()
.customAttributes(Map.of("arn", "arn:aws:s3:::amzn-s3-demo-bucket"))
.build());
Service service2 = namespace.createService("IpService", BaseServiceProps.builder()
.description("service registering ip instances")
.healthCheck(HealthCheckConfig.builder()
.type(HealthCheckType.HTTP)
.resourcePath("/check")
.build())
.build());
service2.registerIpInstance("IpInstance", IpInstanceBaseProps.builder()
.ipv4("54.239.25.192")
.build());
app.synth();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK;
using Amazon.CDK;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var namespace = new HttpNamespace(stack, "MyNamespace", new HttpNamespaceProps {
Name = "MyHTTPNamespace"
});
var service1 = namespace.CreateService("NonIpService", new BaseServiceProps {
Description = "service registering non-ip instances"
});
service1.RegisterNonIpInstance("NonIpInstance", new NonIpInstanceBaseProps {
CustomAttributes = new Dictionary<string, string> { { "arn", "arn:aws:s3:::amzn-s3-demo-bucket" } }
});
var service2 = namespace.CreateService("IpService", new BaseServiceProps {
Description = "service registering ip instances",
HealthCheck = new HealthCheckConfig {
Type = HealthCheckType.HTTP,
ResourcePath = "/check"
}
});
service2.RegisterIpInstance("IpInstance", new IpInstanceBaseProps {
Ipv4 = "54.239.25.192"
});
app.Synth();
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
app := cdk.NewApp()
stack := cdk.NewStack(app, jsii.String("aws-servicediscovery-integ"))
namespace := servicediscovery.NewHttpNamespace(stack, jsii.String("MyNamespace"), &HttpNamespaceProps{
Name: jsii.String("MyHTTPNamespace"),
})
service1 := namespace.CreateService(jsii.String("NonIpService"), &BaseServiceProps{
Description: jsii.String("service registering non-ip instances"),
})
service1.RegisterNonIpInstance(jsii.String("NonIpInstance"), &NonIpInstanceBaseProps{
CustomAttributes: map[string]*string{
"arn": jsii.String("arn:aws:s3:::amzn-s3-demo-bucket"),
},
})
service2 := namespace.CreateService(jsii.String("IpService"), &BaseServiceProps{
Description: jsii.String("service registering ip instances"),
HealthCheck: &HealthCheckConfig{
Type: servicediscovery.HealthCheckType_HTTP,
ResourcePath: jsii.String("/check"),
},
})
service2.RegisterIpInstance(jsii.String("IpInstance"), &IpInstanceBaseProps{
Ipv4: jsii.String("54.239.25.192"),
})
app.Synth()
Properties
customAttributesoptional{ [key: string]: string }custom_attributesoptionaltyping.Mapping[str, str]customAttributesoptionalMap<String, String>CustomAttributesoptionalIDictionary<string, string>CustomAttributesoptional*map[string]*string = none #Custom attributes of the instance.
instanceIdoptionalstringinstance_idoptionalstrinstanceIdoptionalStringInstanceIdoptionalstringInstanceIdoptional*string #The id of the instance resource.
Default: Automatically generated name
If the service that you specify contains a template for an A record, the IPv4 address that you want AWS Cloud Map to use for the value of the A record.
If the service that you specify contains a template for an AAAA record, the IPv6 address that you want AWS Cloud Map to use for the value of the AAAA record.
portoptionalnumberportoptionalint | floatportoptionalNumberPortoptionaldoublePortoptional*float64 = 80 #The port on the endpoint that you want AWS Cloud Map to perform health checks on.
This value is also used for the port value in an SRV record if the service that you specify includes an SRV record. You can also specify a default port that is applied to all instances in the Service configuration.