Package com.pulumi.aws.lightsail
Class LbAttachment
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.lightsail.LbAttachment
-
public class LbAttachment extends com.pulumi.resources.CustomResourceManages a Lightsail Load Balancer Attachment. Use this resource to attach Lightsail instances to a load balancer for distributing traffic across multiple instances. ## Example Usage
## Import Using `pulumi import`, import `aws.lightsail.LbAttachment` using the name attribute. For example: ```sh $ pulumi import aws:lightsail/lbAttachment:LbAttachment example example-load-balancer,example-instance ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.AwsFunctions; import com.pulumi.aws.inputs.GetAvailabilityZonesArgs; import com.pulumi.aws.inputs.GetAvailabilityZonesFilterArgs; import com.pulumi.aws.lightsail.Lb; import com.pulumi.aws.lightsail.LbArgs; import com.pulumi.aws.lightsail.Instance; import com.pulumi.aws.lightsail.InstanceArgs; import com.pulumi.aws.lightsail.LbAttachment; import com.pulumi.aws.lightsail.LbAttachmentArgs; import java.util.ArrayList; import java.util.Arrays; 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) { final var available = AwsFunctions.getAvailabilityZones(GetAvailabilityZonesArgs.builder() .filters(GetAvailabilityZonesFilterArgs.builder() .name("opt-in-status") .values("opt-in-not-required") .build()) .state("available") .build()); var example = new Lb("example", LbArgs.builder() .name("example-load-balancer") .healthCheckPath("/") .instancePort(80) .tags(Map.of("foo", "bar")) .build()); var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder() .name("example-instance") .availabilityZone(available.names()[0]) .blueprintId("amazon_linux_2") .bundleId("nano_3_0") .build()); var exampleLbAttachment = new LbAttachment("exampleLbAttachment", LbAttachmentArgs.builder() .lbName(example.name()) .instanceName(exampleInstance.name()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description LbAttachment(java.lang.String name)LbAttachment(java.lang.String name, LbAttachmentArgs args)LbAttachment(java.lang.String name, LbAttachmentArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LbAttachmentget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, LbAttachmentState 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>instanceName()com.pulumi.core.Output<java.lang.String>lbName()com.pulumi.core.Output<java.lang.String>region()
-
-
-
Constructor Detail
-
LbAttachment
public LbAttachment(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
LbAttachment
public LbAttachment(java.lang.String name, LbAttachmentArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
LbAttachment
public LbAttachment(java.lang.String name, LbAttachmentArgs 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
-
instanceName
public com.pulumi.core.Output<java.lang.String> instanceName()
- Returns:
- Name of the instance to attach to the load balancer.
-
lbName
public com.pulumi.core.Output<java.lang.String> lbName()
- Returns:
- Name of the Lightsail load balancer. The following arguments are optional:
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
get
public static LbAttachment get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable LbAttachmentState 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.
-
-