Skip to content

Data Source: awsEip

awsEip provides details about a specific Elastic IP.

Example Usage

Search By Allocation ID (VPC only)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsEip.DataAwsEip(this, "by_allocation_id", {
  id: "eipalloc-12345678",
});

Search By Filters (EC2-Classic or VPC)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsEip.DataAwsEip(this, "by_filter", {
  filter: [
    {
      name: "tag:Name",
      values: ["exampleNameTagValue"],
    },
  ],
});

Search By Public IP (EC2-Classic or VPC)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsEip.DataAwsEip(this, "by_public_ip", {
  publicIp: "1.2.3.4",
});

Search By Tags (EC2-Classic or VPC)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsEip.DataAwsEip(this, "by_tags", {
  tags: {
    Name: "exampleNameTagValue",
  },
});

Argument Reference

The arguments of this data source act as filters for querying the available Elastic IPs in the current region. The given filters must match exactly one Elastic IP whose data will be exported as attributes.

  • filter - (Optional) One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out the EC2 API Reference.
  • id - (Optional) Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set id, only set publicIp
  • publicIp - (Optional) Public IP of the specific EIP to retrieve.
  • tags - (Optional) Map of tags, each pair of which must exactly match a pair on the desired Elastic IP

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • associationId - ID representing the association of the address with an instance in a VPC.
  • domain - Whether the address is for use in EC2-Classic (standard) or in a VPC (vpc).
  • id - If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address.
  • instanceId - ID of the instance that the address is associated with (if any).
  • networkInterfaceId - The ID of the network interface.
  • networkInterfaceOwnerId - The ID of the AWS account that owns the network interface.
  • privateIp - Private IP address associated with the Elastic IP address.
  • privateDns - Private DNS associated with the Elastic IP address.
  • publicIp - Public IP address of Elastic IP.
  • publicDns - Public DNS associated with the Elastic IP address.
  • publicIpv4Pool - ID of an address pool.
  • carrierIp - Carrier IP address.
  • customerOwnedIpv4Pool - The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide
  • customerOwnedIp - Customer Owned IP.
  • tags - Key-value map of tags associated with Elastic IP.

\~> Note: The data source computes the publicDns and privateDns attributes according to the VPC DNS Guide as they are not available with the EC2 API.

Timeouts

Configuration options:

  • read - (Default 20M)