github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/aws/r/eip_association.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_eip_association" 4 sidebar_current: "docs-aws-resource-eip-association" 5 description: |- 6 Provides an AWS EIP Association 7 --- 8 9 # aws\_eip\_association 10 11 Provides an AWS EIP Association as a top level resource, to associate and 12 disassociate Elastic IPs from AWS Instances and Network Interfaces. 13 14 ~> **NOTE:** `aws_eip_association` is useful in scenarios where EIPs are either 15 pre-existing or distributed to customers or users and therefore cannot be changed. 16 17 ## Example Usage 18 19 ```hcl 20 resource "aws_eip_association" "eip_assoc" { 21 instance_id = "${aws_instance.web.id}" 22 allocation_id = "${aws_eip.example.id}" 23 } 24 25 resource "aws_instance" "web" { 26 ami = "ami-21f78e11" 27 availability_zone = "us-west-2a" 28 instance_type = "t1.micro" 29 30 tags { 31 Name = "HelloWorld" 32 } 33 } 34 35 resource "aws_eip" "example" { 36 vpc = true 37 } 38 ``` 39 40 ## Argument Reference 41 42 The following arguments are supported: 43 44 * `allocation_id` - (Optional) The allocation ID. This is required for EC2-VPC. 45 * `allow_reassociation` - (Optional, Boolean) Whether to allow an Elastic IP to 46 be re-associated. Defaults to `true` in VPC. 47 * `instance_id` - (Optional) The ID of the instance. This is required for 48 EC2-Classic. For EC2-VPC, you can specify either the instance ID or the 49 network interface ID, but not both. The operation fails if you specify an 50 instance ID unless exactly one network interface is attached. 51 * `network_interface_id` - (Optional) The ID of the network interface. If the 52 instance has more than one network interface, you must specify a network 53 interface ID. 54 * `private_ip_address` - (Optional) The primary or secondary private IP address 55 to associate with the Elastic IP address. If no private IP address is 56 specified, the Elastic IP address is associated with the primary private IP 57 address. 58 * `public_ip` - (Optional) The Elastic IP address. This is required for EC2-Classic. 59 60 ## Attributes Reference 61 62 * `association_id` - The ID that represents the association of the Elastic IP 63 address with an instance. 64 * `allocation_id` - As above 65 * `instance_id` - As above 66 * `network_interface_id` - As above 67 * `private_ip_address` - As above 68 * `public_ip` - As above