import aws_cdk as cdk
import aws_cdk as servicediscovery
app = cdk.App()
stack = cdk.Stack(app, "aws-servicediscovery-integ")
namespace = servicediscovery.PublicDnsNamespace(stack, "Namespace",
name="foobar.com"
)
service = namespace.create_service("Service",
name="foo",
dns_record_type=servicediscovery.DnsRecordType.A,
dns_ttl=cdk.Duration.seconds(30),
health_check=cdk.aws_servicediscovery.HealthCheckConfig(
type=servicediscovery.HealthCheckType.HTTPS,
resource_path="/healthcheck",
failure_threshold=2
)
)
service.register_ip_instance("IpInstance",
ipv4="54.239.25.192",
port=443
)
app.synth()