github.com/hobbeswalsh/terraform@v0.3.7-0.20150619183303-ad17cf55a0fa/website/source/docs/providers/aws/r/volume_attachment.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_volume_attachment" 4 sidebar_current: "docs-aws-resource-volume-attachment" 5 description: |- 6 Provides an AWS EBS Volume Attachment 7 --- 8 9 # aws\_volume\_attachment 10 11 Provides an AWS EBS Volume Attachment as a top level resource, to attach and 12 detach volumes from AWS Instances. 13 14 ## Example Usage 15 16 ``` 17 resource "aws_volume_attachment" "ebs_att" { 18 device_name = "/dev/sdh" 19 volume_id = "${aws_ebs_volume.example.id}" 20 instance_id = "${aws_instance.web.id}" 21 } 22 23 resource "aws_instance" "web" { 24 ami = "ami-21f78e11" 25 availability_zone = "us-west-2a" 26 instance_type = "t1.micro" 27 tags { 28 Name = "HelloWorld" 29 } 30 } 31 32 resource "aws_ebs_volume" "example" { 33 availability_zone = "us-west-2a" 34 size = 1 35 } 36 ``` 37 38 ## Argument Reference 39 40 The following arguments are supported: 41 42 * `device_name` - (Required) The device name to expose to the instance (for 43 example, `/dev/sdh` or `xvdh`) 44 * `instance_id` - (Required) ID of the Instance to attach to 45 * `volume_id` - (Required) ID of the Volume to be attached 46 * `force_detach` - (Optional, Boolean) Set to `true` if you want to force the 47 volume to detach. Useful if previous attempts failed, but use this option only 48 as a last resort, as this can result in **data loss**. See 49 [Detaching an Amazon EBS Volume from an Instance][1] for more information. 50 51 ## Attributes Reference 52 53 * `device_name` - The device name exposed to the instance 54 * `instance_id` - ID of the Instance 55 * `volume_id` - ID of the Volume 56 57 [1]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-detaching-volume.html