Package com.pulumi.aws.lightsail
Class StaticIpAttachment
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.lightsail.StaticIpAttachment
-
public class StaticIpAttachment extends com.pulumi.resources.CustomResourceManages a static IP address attachment - relationship between a Lightsail static IP and Lightsail instance. Use this resource to attach a static IP address to a Lightsail instance to provide a consistent public IP address that persists across instance restarts. > **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details. ## Example Usage
## Import Using `pulumi import`, import `aws.lightsail.StaticIpAttachment` using the static IP name. For example: ```sh $ pulumi import aws:lightsail/staticIpAttachment:StaticIpAttachment example example-static-ip ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.lightsail.StaticIp; import com.pulumi.aws.lightsail.StaticIpArgs; import com.pulumi.aws.lightsail.Instance; import com.pulumi.aws.lightsail.InstanceArgs; import com.pulumi.aws.lightsail.StaticIpAttachment; import com.pulumi.aws.lightsail.StaticIpAttachmentArgs; 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) { var example = new StaticIp("example", StaticIpArgs.builder() .name("example") .build()); var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder() .name("example") .availabilityZone("us-east-1a") .blueprintId("ubuntu_20_04") .bundleId("nano_2_0") .build()); var exampleStaticIpAttachment = new StaticIpAttachment("exampleStaticIpAttachment", StaticIpAttachmentArgs.builder() .staticIpName(example.name()) .instanceName(exampleInstance.name()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description StaticIpAttachment(java.lang.String name)StaticIpAttachment(java.lang.String name, StaticIpAttachmentArgs args)StaticIpAttachment(java.lang.String name, StaticIpAttachmentArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StaticIpAttachmentget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, StaticIpAttachmentState 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>ipAddress()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>staticIpName()
-
-
-
Constructor Detail
-
StaticIpAttachment
public StaticIpAttachment(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
StaticIpAttachment
public StaticIpAttachment(java.lang.String name, StaticIpAttachmentArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
StaticIpAttachment
public StaticIpAttachment(java.lang.String name, StaticIpAttachmentArgs 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 Lightsail instance to attach the IP to.
-
ipAddress
public com.pulumi.core.Output<java.lang.String> ipAddress()
- Returns:
- Allocated static IP address.
-
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.
-
staticIpName
public com.pulumi.core.Output<java.lang.String> staticIpName()
- Returns:
- Name of the allocated static IP. The following arguments are optional:
-
get
public static StaticIpAttachment get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable StaticIpAttachmentState 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.
-
-