java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.servicediscovery.Service
All Implemented Interfaces:
IResource, IService, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.95.0 (build f1ff514)", date="2024-03-26T18:09:30.229Z") @Stability(Stable) public class Service extends Resource implements IService
Define a CloudMap Service.

Example:

 import software.amazon.awscdk.*;
 import software.amazon.awscdk.*;
 App app = new App();
 Stack stack = new Stack(app, "aws-servicediscovery-integ");
 PublicDnsNamespace namespace = PublicDnsNamespace.Builder.create(stack, "Namespace")
         .name("foobar.com")
         .build();
 Service service = namespace.createService("Service", DnsServiceProps.builder()
         .name("foo")
         .dnsRecordType(DnsRecordType.A)
         .dnsTtl(Duration.seconds(30))
         .healthCheck(HealthCheckConfig.builder()
                 .type(HealthCheckType.HTTPS)
                 .resourcePath("/healthcheck")
                 .failureThreshold(2)
                 .build())
         .build());
 service.registerIpInstance("IpInstance", IpInstanceBaseProps.builder()
         .ipv4("54.239.25.192")
         .port(443)
         .build());
 app.synth();
 
  • Constructor Details

    • Service

      protected Service(software.amazon.jsii.JsiiObjectRef objRef)
    • Service

      protected Service(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Service

      @Stability(Stable) public Service(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ServiceProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromServiceAttributes

      @Stability(Stable) @NotNull public static IService fromServiceAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ServiceAttributes attrs)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • registerCnameInstance

      @Stability(Stable) @NotNull public IInstance registerCnameInstance(@NotNull String id, @NotNull CnameInstanceBaseProps props)
      Registers a resource that is accessible using a CNAME.

      Parameters:
      id - This parameter is required.
      props - This parameter is required.
    • registerIpInstance

      @Stability(Stable) @NotNull public IInstance registerIpInstance(@NotNull String id, @NotNull IpInstanceBaseProps props)
      Registers a resource that is accessible using an IP address.

      Parameters:
      id - This parameter is required.
      props - This parameter is required.
    • registerLoadBalancer

      @Stability(Stable) @NotNull public IInstance registerLoadBalancer(@NotNull String id, @NotNull ILoadBalancerV2 loadBalancer, @Nullable Map<String,String> customAttributes)
      Registers an ELB as a new instance with unique name instanceId in this service.

      Parameters:
      id - This parameter is required.
      loadBalancer - This parameter is required.
      customAttributes -
    • registerLoadBalancer

      @Stability(Stable) @NotNull public IInstance registerLoadBalancer(@NotNull String id, @NotNull ILoadBalancerV2 loadBalancer)
      Registers an ELB as a new instance with unique name instanceId in this service.

      Parameters:
      id - This parameter is required.
      loadBalancer - This parameter is required.
    • registerNonIpInstance

      @Stability(Stable) @NotNull public IInstance registerNonIpInstance(@NotNull String id, @NotNull NonIpInstanceBaseProps props)
      Registers a resource that is accessible using values other than an IP address or a domain name (CNAME).

      Parameters:
      id - This parameter is required.
      props - This parameter is required.
    • getDiscoveryType

      @Stability(Stable) @NotNull public DiscoveryType getDiscoveryType()
      The discovery type used by this service.
      Specified by:
      getDiscoveryType in interface IService
    • getDnsRecordType

      @Stability(Stable) @NotNull public DnsRecordType getDnsRecordType()
      The DnsRecordType used by the service.
      Specified by:
      getDnsRecordType in interface IService
    • getNamespace

      @Stability(Stable) @NotNull public INamespace getNamespace()
      The namespace for the Cloudmap Service.
      Specified by:
      getNamespace in interface IService
    • getRoutingPolicy

      @Stability(Stable) @NotNull public RoutingPolicy getRoutingPolicy()
      The Routing Policy used by the service.
      Specified by:
      getRoutingPolicy in interface IService
    • getServiceArn

      @Stability(Stable) @NotNull public String getServiceArn()
      The Arn of the namespace that you want to use for DNS configuration.
      Specified by:
      getServiceArn in interface IService
    • getServiceId

      @Stability(Stable) @NotNull public String getServiceId()
      The ID of the namespace that you want to use for DNS configuration.
      Specified by:
      getServiceId in interface IService
    • getServiceName

      @Stability(Stable) @NotNull public String getServiceName()
      A name for the Cloudmap Service.
      Specified by:
      getServiceName in interface IService