Show / Hide Table of Contents

Class VolumeAttachment

Provides an AWS EBS Volume Attachment as a top level resource, to attach and detach volumes from AWS Instances.

NOTE on EBS block devices: If you use ebs_block_device on an aws.ec2.Instance, this provider will assume management over the full set of non-root EBS block devices for the instance, and treats additional block devices as drift. For this reason, ebs_block_device cannot be mixed with external aws.ebs.Volume + aws_ebs_volume_attachment resources for a given instance.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var web = new Aws.Ec2.Instance("web", new Aws.Ec2.InstanceArgs
    {
        Ami = "ami-21f78e11",
        AvailabilityZone = "us-west-2a",
        InstanceType = "t1.micro",
        Tags = 
        {
            { "Name", "HelloWorld" },
        },
    });
    var example = new Aws.Ebs.Volume("example", new Aws.Ebs.VolumeArgs
    {
        AvailabilityZone = "us-west-2a",
        Size = 1,
    });
    var ebsAtt = new Aws.Ec2.VolumeAttachment("ebsAtt", new Aws.Ec2.VolumeAttachmentArgs
    {
        DeviceName = "/dev/sdh",
        InstanceId = web.Id,
        VolumeId = example.Id,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
VolumeAttachment
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Ec2
Assembly: Pulumi.Aws.dll
Syntax
public class VolumeAttachment : CustomResource

Constructors

View Source

VolumeAttachment(String, VolumeAttachmentArgs, CustomResourceOptions)

Create a VolumeAttachment resource with the given unique name, arguments, and options.

Declaration
public VolumeAttachment(string name, VolumeAttachmentArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

VolumeAttachmentArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

DeviceName

The device name to expose to the instance (for example, /dev/sdh or xvdh). See Device Naming on Linux Instances and Device Naming on Windows Instances for more information.

Declaration
public Output<string> DeviceName { get; }
Property Value
Type Description
Output<System.String>
View Source

ForceDetach

Set to true if you want to force the volume to detach. Useful if previous attempts failed, but use this option only as a last resort, as this can result in data loss. See Detaching an Amazon EBS Volume from an Instance for more information.

Declaration
public Output<bool?> ForceDetach { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

InstanceId

ID of the Instance to attach to

Declaration
public Output<string> InstanceId { get; }
Property Value
Type Description
Output<System.String>
View Source

SkipDestroy

Set this to true if you do not wish to detach the volume from the instance to which it is attached at destroy time, and instead just remove the attachment from this provider state. This is useful when destroying an instance which has volumes created by some other means attached.

Declaration
public Output<bool?> SkipDestroy { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

VolumeId

ID of the Volume to be attached

Declaration
public Output<string> VolumeId { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, VolumeAttachmentState, CustomResourceOptions)

Get an existing VolumeAttachment resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static VolumeAttachment Get(string name, Input<string> id, VolumeAttachmentState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

VolumeAttachmentState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
VolumeAttachment
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.