github.com/jrasell/terraform@v0.6.17-0.20160523115548-2652f5232949/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 ``` 20 resource "aws_eip_association" "eip_assoc" { 21 instance_id = "${aws_instance.web.id}" 22 allocation_id = "${aws_eip.example.allocation_id}" 23 } 24 25 resource "aws_instance" "web" { 26 ami = "ami-21f78e11" 27 availability_zone = "us-west-2a" 28 instance_type = "t1.micro" 29 tags { 30 Name = "HelloWorld" 31 } 32 } 33 34 resource "aws_eip" "example" { 35 vpc = true 36 } 37 ``` 38 39 ## Argument Reference 40 41 The following arguments are supported: 42 43 * `allocation_id` - (Optional) The allocation ID. This is required for EC2-VPC. 44 * `allow_reassociation` - (Optional, Boolean) Whether to allow an Elastic IP to 45 be re-associated. Defaults to `true` in VPC. 46 * `instance_id` - (Optional) The ID of the instance. This is required for 47 EC2-Classic. For EC2-VPC, you can specify either the instance ID or the 48 network interface ID, but not both. The operation fails if you specify an 49 instance ID unless exactly one network interface is attached. 50 * `network_interface_id` - (Optional) The ID of the network interface. If the 51 instance has more than one network interface, you must specify a network 52 interface ID. 53 * `private_ip_address` - (Optional) The primary or secondary private IP address 54 to associate with the Elastic IP address. If no private IP address is 55 specified, the Elastic IP address is associated with the primary private IP 56 address. 57 * `public_ip` - (Optional) The Elastic IP address. This is required for EC2-Classic. 58 59 ## Attributes Reference 60 61 * `association_id` - The ID that represents the association of the Elastic IP 62 address with an instance. 63 * `allocation_id` - As above 64 * `instance_id` - As above 65 * `network_interface_id` - As above 66 * `private_ip_address` - As above 67 * `public_ip` - As above