DiscoveryType
- class aws_cdk.aws_servicediscovery.DiscoveryType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
Specifies information about the discovery type of a service.
- ExampleMetadata:
lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
Example:
import aws_cdk.aws_ec2 as ec2 import aws_cdk.aws_elasticloadbalancingv2 as elbv2 import aws_cdk as cdk import aws_cdk as servicediscovery app = cdk.App() stack = cdk.Stack(app, "aws-servicediscovery-integ") vpc = ec2.Vpc(stack, "Vpc", max_azs=2) namespace = servicediscovery.PrivateDnsNamespace(stack, "Namespace", name="boobar.com", vpc=vpc ) service = namespace.create_service("Service", dns_record_type=servicediscovery.DnsRecordType.A_AAAA, dns_ttl=cdk.Duration.seconds(30), load_balancer=True ) loadbalancer = elbv2.ApplicationLoadBalancer(stack, "LB", vpc=vpc, internet_facing=True) service.register_load_balancer("Loadbalancer", loadbalancer) arn_service = namespace.create_service("ArnService", discovery_type=servicediscovery.DiscoveryType.API ) arn_service.register_non_ip_instance("NonIpInstance", custom_attributes={"arn": "arn://"} ) app.synth()
Attributes
- API
Instances are discoverable via API only.
- DNS_AND_API
Instances are discoverable via DNS or API.