Package com.pulumi.aws.servicediscovery
Class Instance
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.servicediscovery.Instance
-
public class Instance extends com.pulumi.resources.CustomResource
Provides a Service Discovery Instance resource. ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Vpc; import com.pulumi.aws.ec2.VpcArgs; import com.pulumi.aws.servicediscovery.PrivateDnsNamespace; import com.pulumi.aws.servicediscovery.PrivateDnsNamespaceArgs; import com.pulumi.aws.servicediscovery.Service; import com.pulumi.aws.servicediscovery.ServiceArgs; import com.pulumi.aws.servicediscovery.inputs.ServiceDnsConfigArgs; import com.pulumi.aws.servicediscovery.inputs.ServiceHealthCheckCustomConfigArgs; import com.pulumi.aws.servicediscovery.Instance; import com.pulumi.aws.servicediscovery.InstanceArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var exampleVpc = new Vpc("exampleVpc", VpcArgs.builder() .cidrBlock("10.0.0.0/16") .enableDnsSupport(true) .enableDnsHostnames(true) .build()); var examplePrivateDnsNamespace = new PrivateDnsNamespace("examplePrivateDnsNamespace", PrivateDnsNamespaceArgs.builder() .description("example") .vpc(exampleVpc.id()) .build()); var exampleService = new Service("exampleService", ServiceArgs.builder() .dnsConfig(ServiceDnsConfigArgs.builder() .namespaceId(examplePrivateDnsNamespace.id()) .dnsRecords(ServiceDnsConfigDnsRecordArgs.builder() .ttl(10) .type("A") .build()) .routingPolicy("MULTIVALUE") .build()) .healthCheckCustomConfig(ServiceHealthCheckCustomConfigArgs.builder() .failureThreshold(1) .build()) .build()); var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder() .instanceId("example-instance-id") .serviceId(exampleService.id()) .attributes(Map.ofEntries( Map.entry("AWS_INSTANCE_IPV4", "172.18.0.1"), Map.entry("custom_attribute", "custom") )) .build()); } } ``` ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.servicediscovery.HttpNamespace; import com.pulumi.aws.servicediscovery.HttpNamespaceArgs; import com.pulumi.aws.servicediscovery.Service; import com.pulumi.aws.servicediscovery.ServiceArgs; import com.pulumi.aws.servicediscovery.Instance; import com.pulumi.aws.servicediscovery.InstanceArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var exampleHttpNamespace = new HttpNamespace("exampleHttpNamespace", HttpNamespaceArgs.builder() .description("example") .build()); var exampleService = new Service("exampleService", ServiceArgs.builder() .namespaceId(exampleHttpNamespace.id()) .build()); var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder() .instanceId("example-instance-id") .serviceId(exampleService.id()) .attributes(Map.of("AWS_EC2_INSTANCE_ID", "i-0abdg374kd892cj6dl")) .build()); } } ``` ## Import Using `pulumi import`, import Service Discovery Instance using the service ID and instance ID. For example: ```sh $ pulumi import aws:servicediscovery/instance:Instance example 0123456789/i-0123 ```
-
-
Constructor Summary
Constructors Constructor Description Instance(java.lang.String name)
Instance(java.lang.String name, InstanceArgs args)
Instance(java.lang.String name, InstanceArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>
attributes()
static Instance
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, InstanceState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
instanceId()
com.pulumi.core.Output<java.lang.String>
serviceId()
-
-
-
Constructor Detail
-
Instance
public Instance(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
Instance
public Instance(java.lang.String name, InstanceArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
Instance
public Instance(java.lang.String name, InstanceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
attributes
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> attributes()
- Returns:
- A map contains the attributes of the instance. Check the [doc](https://docs.aws.amazon.com/cloud-map/latest/api/API_RegisterInstance.html#API_RegisterInstance_RequestSyntax) for the supported attributes and syntax.
-
instanceId
public com.pulumi.core.Output<java.lang.String> instanceId()
- Returns:
- The ID of the service instance.
-
serviceId
public com.pulumi.core.Output<java.lang.String> serviceId()
- Returns:
- The ID of the service that you want to use to create the instance.
-
get
public static Instance get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable InstanceState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-