1. Packages
  2. AWS
  3. API Docs
  4. lightsail
  5. Disk_attachment
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.lightsail.Disk_attachment

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Attaches a Lightsail disk to a Lightsail Instance

    Example Usage

    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 test = new aws.lightsail.Disk("test", {
        name: "test-disk",
        sizeInGb: 8,
        availabilityZone: available.then(available => available.names?.[0]),
    });
    const testInstance = new aws.lightsail.Instance("test", {
        name: "test-instance",
        availabilityZone: available.then(available => available.names?.[0]),
        blueprintId: "amazon_linux_2",
        bundleId: "nano_3_0",
    });
    const testDisk_attachment = new aws.lightsail.Disk_attachment("test", {
        diskName: test.name,
        instanceName: testInstance.name,
        diskPath: "/dev/xvdf",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    available = aws.get_availability_zones(state="available",
        filters=[{
            "name": "opt-in-status",
            "values": ["opt-in-not-required"],
        }])
    test = aws.lightsail.Disk("test",
        name="test-disk",
        size_in_gb=8,
        availability_zone=available.names[0])
    test_instance = aws.lightsail.Instance("test",
        name="test-instance",
        availability_zone=available.names[0],
        blueprint_id="amazon_linux_2",
        bundle_id="nano_3_0")
    test_disk_attachment = aws.lightsail.Disk_attachment("test",
        disk_name=test.name,
        instance_name=test_instance.name,
        disk_path="/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
    		}
    		test, err := lightsail.NewDisk(ctx, "test", &lightsail.DiskArgs{
    			Name:             pulumi.String("test-disk"),
    			SizeInGb:         pulumi.Int(8),
    			AvailabilityZone: pulumi.String(available.Names[0]),
    		})
    		if err != nil {
    			return err
    		}
    		testInstance, err := lightsail.NewInstance(ctx, "test", &lightsail.InstanceArgs{
    			Name:             pulumi.String("test-instance"),
    			AvailabilityZone: pulumi.String(available.Names[0]),
    			BlueprintId:      pulumi.String("amazon_linux_2"),
    			BundleId:         pulumi.String("nano_3_0"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = lightsail.NewDisk_attachment(ctx, "test", &lightsail.Disk_attachmentArgs{
    			DiskName:     test.Name,
    			InstanceName: testInstance.Name,
    			DiskPath:     pulumi.String("/dev/xvdf"),
    		})
    		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 available = Aws.GetAvailabilityZones.Invoke(new()
        {
            State = "available",
            Filters = new[]
            {
                new Aws.Inputs.GetAvailabilityZonesFilterInputArgs
                {
                    Name = "opt-in-status",
                    Values = new[]
                    {
                        "opt-in-not-required",
                    },
                },
            },
        });
    
        var test = new Aws.LightSail.Disk("test", new()
        {
            Name = "test-disk",
            SizeInGb = 8,
            AvailabilityZone = available.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Names[0]),
        });
    
        var testInstance = new Aws.LightSail.Instance("test", new()
        {
            Name = "test-instance",
            AvailabilityZone = available.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Names[0]),
            BlueprintId = "amazon_linux_2",
            BundleId = "nano_3_0",
        });
    
        var testDisk_attachment = new Aws.LightSail.Disk_attachment("test", new()
        {
            DiskName = test.Name,
            InstanceName = testInstance.Name,
            DiskPath = "/dev/xvdf",
        });
    
    });
    
    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 test = new Disk("test", DiskArgs.builder()
                .name("test-disk")
                .sizeInGb(8)
                .availabilityZone(available.applyValue(getAvailabilityZonesResult -> getAvailabilityZonesResult.names()[0]))
                .build());
    
            var testInstance = new Instance("testInstance", InstanceArgs.builder()
                .name("test-instance")
                .availabilityZone(available.applyValue(getAvailabilityZonesResult -> getAvailabilityZonesResult.names()[0]))
                .blueprintId("amazon_linux_2")
                .bundleId("nano_3_0")
                .build());
    
            var testDisk_attachment = new Disk_attachment("testDisk_attachment", Disk_attachmentArgs.builder()
                .diskName(test.name())
                .instanceName(testInstance.name())
                .diskPath("/dev/xvdf")
                .build());
    
        }
    }
    
    resources:
      test:
        type: aws:lightsail:Disk
        properties:
          name: test-disk
          sizeInGb: 8
          availabilityZone: ${available.names[0]}
      testInstance:
        type: aws:lightsail:Instance
        name: test
        properties:
          name: test-instance
          availabilityZone: ${available.names[0]}
          blueprintId: amazon_linux_2
          bundleId: nano_3_0
      testDisk_attachment:
        type: aws:lightsail:Disk_attachment
        name: test
        properties:
          diskName: ${test.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

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Disk_attachment(name: string, args: Disk_attachmentArgs, opts?: CustomResourceOptions);
    @overload
    def Disk_attachment(resource_name: str,
                        args: Disk_attachmentArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @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)
    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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var disk_attachmentResource = new Aws.LightSail.Disk_attachment("disk_attachmentResource", new()
    {
        DiskName = "string",
        DiskPath = "string",
        InstanceName = "string",
    });
    
    example, err := lightsail.NewDisk_attachment(ctx, "disk_attachmentResource", &lightsail.Disk_attachmentArgs{
    	DiskName:     pulumi.String("string"),
    	DiskPath:     pulumi.String("string"),
    	InstanceName: pulumi.String("string"),
    })
    
    var disk_attachmentResource = new Disk_attachment("disk_attachmentResource", Disk_attachmentArgs.builder()
        .diskName("string")
        .diskPath("string")
        .instanceName("string")
        .build());
    
    disk_attachment_resource = aws.lightsail.Disk_attachment("disk_attachmentResource",
        disk_name="string",
        disk_path="string",
        instance_name="string")
    
    const disk_attachmentResource = new aws.lightsail.Disk_attachment("disk_attachmentResource", {
        diskName: "string",
        diskPath: "string",
        instanceName: "string",
    });
    
    type: aws:lightsail:Disk_attachment
    properties:
        diskName: string
        diskPath: string
        instanceName: string
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Disk_attachment resource accepts the following input properties:

    DiskName string
    The name of the Lightsail Disk.
    DiskPath string
    The disk path to expose to the instance.
    InstanceName string
    The name of the Lightsail Instance to attach to.
    DiskName string
    The name of the Lightsail Disk.
    DiskPath string
    The disk path to expose to the instance.
    InstanceName string
    The name of the Lightsail Instance to attach to.
    diskName String
    The name of the Lightsail Disk.
    diskPath String
    The disk path to expose to the instance.
    instanceName String
    The name of the Lightsail Instance to attach to.
    diskName string
    The name of the Lightsail Disk.
    diskPath string
    The disk path to expose to the instance.
    instanceName 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.
    diskName String
    The name of the Lightsail Disk.
    diskPath String
    The disk path to expose to the instance.
    instanceName 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.
    The following state arguments are supported:
    DiskName string
    The name of the Lightsail Disk.
    DiskPath string
    The disk path to expose to the instance.
    InstanceName string
    The name of the Lightsail Instance to attach to.
    DiskName string
    The name of the Lightsail Disk.
    DiskPath string
    The disk path to expose to the instance.
    InstanceName string
    The name of the Lightsail Instance to attach to.
    diskName String
    The name of the Lightsail Disk.
    diskPath String
    The disk path to expose to the instance.
    instanceName String
    The name of the Lightsail Instance to attach to.
    diskName string
    The name of the Lightsail Disk.
    diskPath string
    The disk path to expose to the instance.
    instanceName 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.
    diskName String
    The name of the Lightsail Disk.
    diskPath String
    The disk path to expose to the instance.
    instanceName 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
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi