Try AWS Native preview for resources not in the classic version.
aws.lightsail.Disk_attachment
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Attaches a Lightsail disk to a Lightsail Instance
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var available = Aws.GetAvailabilityZones.Invoke(new()
{
State = "available",
Filters = new[]
{
new Aws.Inputs.GetAvailabilityZonesFilterInputArgs
{
Name = "opt-in-status",
Values = new[]
{
"opt-in-not-required",
},
},
},
});
var testDisk = new Aws.LightSail.Disk("testDisk", new()
{
SizeInGb = 8,
AvailabilityZone = available.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Names[0]),
});
var testInstance = new Aws.LightSail.Instance("testInstance", new()
{
AvailabilityZone = available.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Names[0]),
BlueprintId = "amazon_linux_2",
BundleId = "nano_1_0",
});
var testDisk_attachment = new Aws.LightSail.Disk_attachment("testDisk_attachment", new()
{
DiskName = testDisk.Name,
InstanceName = testInstance.Name,
DiskPath = "/dev/xvdf",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
"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 {
available, err := aws.GetAvailabilityZones(ctx, &aws.GetAvailabilityZonesArgs{
State: pulumi.StringRef("available"),
Filters: []aws.GetAvailabilityZonesFilter{
{
Name: "opt-in-status",
Values: []string{
"opt-in-not-required",
},
},
},
}, nil)
if err != nil {
return err
}
testDisk, err := lightsail.NewDisk(ctx, "testDisk", &lightsail.DiskArgs{
SizeInGb: pulumi.Int(8),
AvailabilityZone: *pulumi.String(available.Names[0]),
})
if err != nil {
return err
}
testInstance, err := lightsail.NewInstance(ctx, "testInstance", &lightsail.InstanceArgs{
AvailabilityZone: *pulumi.String(available.Names[0]),
BlueprintId: pulumi.String("amazon_linux_2"),
BundleId: pulumi.String("nano_1_0"),
})
if err != nil {
return err
}
_, err = lightsail.NewDisk_attachment(ctx, "testDisk_attachment", &lightsail.Disk_attachmentArgs{
DiskName: testDisk.Name,
InstanceName: testInstance.Name,
DiskPath: pulumi.String("/dev/xvdf"),
})
if err != nil {
return err
}
return nil
})
}
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.lightsail.Disk;
import com.pulumi.aws.lightsail.DiskArgs;
import com.pulumi.aws.lightsail.Instance;
import com.pulumi.aws.lightsail.InstanceArgs;
import com.pulumi.aws.lightsail.Disk_attachment;
import com.pulumi.aws.lightsail.Disk_attachmentArgs;
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) {
final var available = AwsFunctions.getAvailabilityZones(GetAvailabilityZonesArgs.builder()
.state("available")
.filters(GetAvailabilityZonesFilterArgs.builder()
.name("opt-in-status")
.values("opt-in-not-required")
.build())
.build());
var testDisk = new Disk("testDisk", DiskArgs.builder()
.sizeInGb(8)
.availabilityZone(available.applyValue(getAvailabilityZonesResult -> getAvailabilityZonesResult.names()[0]))
.build());
var testInstance = new Instance("testInstance", InstanceArgs.builder()
.availabilityZone(available.applyValue(getAvailabilityZonesResult -> getAvailabilityZonesResult.names()[0]))
.blueprintId("amazon_linux_2")
.bundleId("nano_1_0")
.build());
var testDisk_attachment = new Disk_attachment("testDisk_attachment", Disk_attachmentArgs.builder()
.diskName(testDisk.name())
.instanceName(testInstance.name())
.diskPath("/dev/xvdf")
.build());
}
}
import pulumi
import pulumi_aws as aws
available = aws.get_availability_zones(state="available",
filters=[aws.GetAvailabilityZonesFilterArgs(
name="opt-in-status",
values=["opt-in-not-required"],
)])
test_disk = aws.lightsail.Disk("testDisk",
size_in_gb=8,
availability_zone=available.names[0])
test_instance = aws.lightsail.Instance("testInstance",
availability_zone=available.names[0],
blueprint_id="amazon_linux_2",
bundle_id="nano_1_0")
test_disk_attachment = aws.lightsail.Disk_attachment("testDisk_attachment",
disk_name=test_disk.name,
instance_name=test_instance.name,
disk_path="/dev/xvdf")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const available = aws.getAvailabilityZones({
state: "available",
filters: [{
name: "opt-in-status",
values: ["opt-in-not-required"],
}],
});
const testDisk = new aws.lightsail.Disk("testDisk", {
sizeInGb: 8,
availabilityZone: available.then(available => available.names?.[0]),
});
const testInstance = new aws.lightsail.Instance("testInstance", {
availabilityZone: available.then(available => available.names?.[0]),
blueprintId: "amazon_linux_2",
bundleId: "nano_1_0",
});
const testDisk_attachment = new aws.lightsail.Disk_attachment("testDisk_attachment", {
diskName: testDisk.name,
instanceName: testInstance.name,
diskPath: "/dev/xvdf",
});
resources:
testDisk:
type: aws:lightsail:Disk
properties:
sizeInGb: 8
availabilityZone: ${available.names[0]}
testInstance:
type: aws:lightsail:Instance
properties:
availabilityZone: ${available.names[0]}
blueprintId: amazon_linux_2
bundleId: nano_1_0
testDisk_attachment:
type: aws:lightsail:Disk_attachment
properties:
diskName: ${testDisk.name}
instanceName: ${testInstance.name}
diskPath: /dev/xvdf
variables:
available:
fn::invoke:
Function: aws:getAvailabilityZones
Arguments:
state: available
filters:
- name: opt-in-status
values:
- opt-in-not-required
Create Disk_attachment Resource
new Disk_attachment(name: string, args: Disk_attachmentArgs, opts?: CustomResourceOptions);
@overload
def Disk_attachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
disk_name: Optional[str] = None,
disk_path: Optional[str] = None,
instance_name: Optional[str] = None)
@overload
def Disk_attachment(resource_name: str,
args: Disk_attachmentArgs,
opts: Optional[ResourceOptions] = None)
func NewDisk_attachment(ctx *Context, name string, args Disk_attachmentArgs, opts ...ResourceOption) (*Disk_attachment, error)
public Disk_attachment(string name, Disk_attachmentArgs args, CustomResourceOptions? opts = null)
public Disk_attachment(String name, Disk_attachmentArgs args)
public Disk_attachment(String name, Disk_attachmentArgs args, CustomResourceOptions options)
type: aws:lightsail:Disk_attachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args Disk_attachmentArgs
- 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 Disk_attachmentArgs
- 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 Disk_attachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args Disk_attachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args Disk_attachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Disk_attachment 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 Disk_attachment resource accepts the following input properties:
- Disk
Name string The name of the Lightsail Disk.
- Disk
Path string The disk path to expose to the instance.
- Instance
Name string The name of the Lightsail Instance to attach to.
- Disk
Name string The name of the Lightsail Disk.
- Disk
Path string The disk path to expose to the instance.
- Instance
Name string The name of the Lightsail Instance to attach to.
- disk
Name String The name of the Lightsail Disk.
- disk
Path String The disk path to expose to the instance.
- instance
Name String The name of the Lightsail Instance to attach to.
- disk
Name string The name of the Lightsail Disk.
- disk
Path string The disk path to expose to the instance.
- instance
Name string The name of the Lightsail Instance to attach to.
- disk_
name str The name of the Lightsail Disk.
- disk_
path str The disk path to expose to the instance.
- instance_
name str The name of the Lightsail Instance to attach to.
- disk
Name String The name of the Lightsail Disk.
- disk
Path String The disk path to expose to the instance.
- instance
Name String The name of the Lightsail Instance to attach to.
Outputs
All input properties are implicitly available as output properties. Additionally, the Disk_attachment resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing Disk_attachment Resource
Get an existing Disk_attachment 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?: Disk_attachmentState, opts?: CustomResourceOptions): Disk_attachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
disk_name: Optional[str] = None,
disk_path: Optional[str] = None,
instance_name: Optional[str] = None) -> Disk_attachment
func GetDisk_attachment(ctx *Context, name string, id IDInput, state *Disk_attachmentState, opts ...ResourceOption) (*Disk_attachment, error)
public static Disk_attachment Get(string name, Input<string> id, Disk_attachmentState? state, CustomResourceOptions? opts = null)
public static Disk_attachment get(String name, Output<String> id, Disk_attachmentState 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.
- Disk
Name string The name of the Lightsail Disk.
- Disk
Path string The disk path to expose to the instance.
- Instance
Name string The name of the Lightsail Instance to attach to.
- Disk
Name string The name of the Lightsail Disk.
- Disk
Path string The disk path to expose to the instance.
- Instance
Name string The name of the Lightsail Instance to attach to.
- disk
Name String The name of the Lightsail Disk.
- disk
Path String The disk path to expose to the instance.
- instance
Name String The name of the Lightsail Instance to attach to.
- disk
Name string The name of the Lightsail Disk.
- disk
Path string The disk path to expose to the instance.
- instance
Name string The name of the Lightsail Instance to attach to.
- disk_
name str The name of the Lightsail Disk.
- disk_
path str The disk path to expose to the instance.
- instance_
name str The name of the Lightsail Instance to attach to.
- disk
Name String The name of the Lightsail Disk.
- disk
Path String The disk path to expose to the instance.
- instance
Name String The name of the Lightsail Instance to attach to.
Import
Using pulumi import
, import aws_lightsail_disk
using the id attribute. For example:
$ pulumi import aws:lightsail/disk_attachment:Disk_attachment test test-disk,test-instance
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.