Try AWS Native preview for resources not in the classic version.
aws.lightsail.StaticIpAttachment
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides a static IP address attachment - relationship between a Lightsail static IP & Lightsail instance.
Note: Lightsail is currently only supported in a limited number of AWS Regions, please see “Regions and Availability Zones in Amazon Lightsail” for more details
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const testStaticIp = new aws.lightsail.StaticIp("test", {name: "example"});
const testInstance = new aws.lightsail.Instance("test", {
name: "example",
availabilityZone: "us-east-1b",
blueprintId: "string",
bundleId: "string",
keyPairName: "some_key_name",
});
const test = new aws.lightsail.StaticIpAttachment("test", {
staticIpName: testStaticIp.id,
instanceName: testInstance.id,
});
import pulumi
import pulumi_aws as aws
test_static_ip = aws.lightsail.StaticIp("test", name="example")
test_instance = aws.lightsail.Instance("test",
name="example",
availability_zone="us-east-1b",
blueprint_id="string",
bundle_id="string",
key_pair_name="some_key_name")
test = aws.lightsail.StaticIpAttachment("test",
static_ip_name=test_static_ip.id,
instance_name=test_instance.id)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
testStaticIp, err := lightsail.NewStaticIp(ctx, "test", &lightsail.StaticIpArgs{
Name: pulumi.String("example"),
})
if err != nil {
return err
}
testInstance, err := lightsail.NewInstance(ctx, "test", &lightsail.InstanceArgs{
Name: pulumi.String("example"),
AvailabilityZone: pulumi.String("us-east-1b"),
BlueprintId: pulumi.String("string"),
BundleId: pulumi.String("string"),
KeyPairName: pulumi.String("some_key_name"),
})
if err != nil {
return err
}
_, err = lightsail.NewStaticIpAttachment(ctx, "test", &lightsail.StaticIpAttachmentArgs{
StaticIpName: testStaticIp.ID(),
InstanceName: testInstance.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var testStaticIp = new Aws.LightSail.StaticIp("test", new()
{
Name = "example",
});
var testInstance = new Aws.LightSail.Instance("test", new()
{
Name = "example",
AvailabilityZone = "us-east-1b",
BlueprintId = "string",
BundleId = "string",
KeyPairName = "some_key_name",
});
var test = new Aws.LightSail.StaticIpAttachment("test", new()
{
StaticIpName = testStaticIp.Id,
InstanceName = testInstance.Id,
});
});
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.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 testStaticIp = new StaticIp("testStaticIp", StaticIpArgs.builder()
.name("example")
.build());
var testInstance = new Instance("testInstance", InstanceArgs.builder()
.name("example")
.availabilityZone("us-east-1b")
.blueprintId("string")
.bundleId("string")
.keyPairName("some_key_name")
.build());
var test = new StaticIpAttachment("test", StaticIpAttachmentArgs.builder()
.staticIpName(testStaticIp.id())
.instanceName(testInstance.id())
.build());
}
}
resources:
test:
type: aws:lightsail:StaticIpAttachment
properties:
staticIpName: ${testStaticIp.id}
instanceName: ${testInstance.id}
testStaticIp:
type: aws:lightsail:StaticIp
name: test
properties:
name: example
testInstance:
type: aws:lightsail:Instance
name: test
properties:
name: example
availabilityZone: us-east-1b
blueprintId: string
bundleId: string
keyPairName: some_key_name
Create StaticIpAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new StaticIpAttachment(name: string, args: StaticIpAttachmentArgs, opts?: CustomResourceOptions);
@overload
def StaticIpAttachment(resource_name: str,
args: StaticIpAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def StaticIpAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_name: Optional[str] = None,
static_ip_name: Optional[str] = None)
func NewStaticIpAttachment(ctx *Context, name string, args StaticIpAttachmentArgs, opts ...ResourceOption) (*StaticIpAttachment, error)
public StaticIpAttachment(string name, StaticIpAttachmentArgs args, CustomResourceOptions? opts = null)
public StaticIpAttachment(String name, StaticIpAttachmentArgs args)
public StaticIpAttachment(String name, StaticIpAttachmentArgs args, CustomResourceOptions options)
type: aws:lightsail:StaticIpAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args StaticIpAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args StaticIpAttachmentArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args StaticIpAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args StaticIpAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args StaticIpAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var staticIpAttachmentResource = new Aws.LightSail.StaticIpAttachment("staticIpAttachmentResource", new()
{
InstanceName = "string",
StaticIpName = "string",
});
example, err := lightsail.NewStaticIpAttachment(ctx, "staticIpAttachmentResource", &lightsail.StaticIpAttachmentArgs{
InstanceName: pulumi.String("string"),
StaticIpName: pulumi.String("string"),
})
var staticIpAttachmentResource = new StaticIpAttachment("staticIpAttachmentResource", StaticIpAttachmentArgs.builder()
.instanceName("string")
.staticIpName("string")
.build());
static_ip_attachment_resource = aws.lightsail.StaticIpAttachment("staticIpAttachmentResource",
instance_name="string",
static_ip_name="string")
const staticIpAttachmentResource = new aws.lightsail.StaticIpAttachment("staticIpAttachmentResource", {
instanceName: "string",
staticIpName: "string",
});
type: aws:lightsail:StaticIpAttachment
properties:
instanceName: string
staticIpName: string
StaticIpAttachment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The StaticIpAttachment resource accepts the following input properties:
- Instance
Name string - The name of the Lightsail instance to attach the IP to
- Static
Ip stringName - The name of the allocated static IP
- Instance
Name string - The name of the Lightsail instance to attach the IP to
- Static
Ip stringName - The name of the allocated static IP
- instance
Name String - The name of the Lightsail instance to attach the IP to
- static
Ip StringName - The name of the allocated static IP
- instance
Name string - The name of the Lightsail instance to attach the IP to
- static
Ip stringName - The name of the allocated static IP
- instance_
name str - The name of the Lightsail instance to attach the IP to
- static_
ip_ strname - The name of the allocated static IP
- instance
Name String - The name of the Lightsail instance to attach the IP to
- static
Ip StringName - The name of the allocated static IP
Outputs
All input properties are implicitly available as output properties. Additionally, the StaticIpAttachment resource produces the following output properties:
- id str
- The provider-assigned unique ID for this managed resource.
- ip_
address str - The allocated static IP address
Look up Existing StaticIpAttachment Resource
Get an existing StaticIpAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: StaticIpAttachmentState, opts?: CustomResourceOptions): StaticIpAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
instance_name: Optional[str] = None,
ip_address: Optional[str] = None,
static_ip_name: Optional[str] = None) -> StaticIpAttachment
func GetStaticIpAttachment(ctx *Context, name string, id IDInput, state *StaticIpAttachmentState, opts ...ResourceOption) (*StaticIpAttachment, error)
public static StaticIpAttachment Get(string name, Input<string> id, StaticIpAttachmentState? state, CustomResourceOptions? opts = null)
public static StaticIpAttachment get(String name, Output<String> id, StaticIpAttachmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Instance
Name string - The name of the Lightsail instance to attach the IP to
- Ip
Address string - The allocated static IP address
- Static
Ip stringName - The name of the allocated static IP
- Instance
Name string - The name of the Lightsail instance to attach the IP to
- Ip
Address string - The allocated static IP address
- Static
Ip stringName - The name of the allocated static IP
- instance
Name String - The name of the Lightsail instance to attach the IP to
- ip
Address String - The allocated static IP address
- static
Ip StringName - The name of the allocated static IP
- instance
Name string - The name of the Lightsail instance to attach the IP to
- ip
Address string - The allocated static IP address
- static
Ip stringName - The name of the allocated static IP
- instance_
name str - The name of the Lightsail instance to attach the IP to
- ip_
address str - The allocated static IP address
- static_
ip_ strname - The name of the allocated static IP
- instance
Name String - The name of the Lightsail instance to attach the IP to
- ip
Address String - The allocated static IP address
- static
Ip StringName - The name of the allocated static IP
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.