CloudWiki
Resource

Elastic IP

Amazon Web Services
Network
An Elastic IP (EIP) is a public and static IPv4 address that is reachable from the internet and replaces the default public IP address of your EC2 instance. An Elastic IP address is allocated to your AWS account, and it’s yours until you release it. Its main purpose is to mask a failure of your EC2 instance or application by remapping the IP address to another instance within your account.
Terraform Name
terraform
aws_eip
Elastic IP
attributes:
  • address - (Optional) IP address from an EC2 BYOIP pool. This option is only available for VPC EIPs.
  • associate_with_private_ip - (Optional) User-specified primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.
  • customer_owned_ipv4_pool - (Optional) ID of a customer-owned address pool. For more on customer owned IP addressed check out Customer-owned IP addresses guide.
  • instance - (Optional) EC2 instance ID.
  • network_border_group - (Optional) Location from which the IP address is advertised. Use this parameter to limit the address to this location.
  • network_interface - (Optional) Network interface ID to associate with.
  • public_ipv4_pool - (Optional) EC2 IPv4 address pool identifier or amazon. This option is only available for VPC EIPs.
  • tags - (Optional) Map of tags to assign to the resource. Tags can only be applied to EIPs in a VPC. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
  • vpc - (Optional) Boolean if the EIP is in a VPC or not. Defaults to true unless the region supports EC2-Classic.

Associating resources with a
Elastic IP
Resources do not "belong" to a
Elastic IP
Rather, one or more Security Groups are associated to a resource.
Create
Elastic IP
via Terraform:
The following HCL associates an instance with a single Elastic IP
Syntax:

resource "aws_eip" "lb" {
 instance = aws_instance.web.id
 vpc      = true
}

Create
Elastic IP
via CLI:
Parametres:

allocate-address
[--domain <value>]
[--address <value>]
[--public-ipv4-pool <value>]
[--network-border-group <value>]
[--customer-owned-ipv4-pool <value>]
[--dry-run | --no-dry-run]
[--tag-specifications <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]

Example:
aws cost
Costs
Elastic IP charges a fee for each Elastic IP address associated with a running instance, with a fee for each hour the IP address is not associated with a running instance. There is no additional charge for using Elastic IPs with EC2 instances, but charges may apply for data transfer. The cost of using Elastic IPs depends on the number of IP addresses associated with running instances and the amount of data transferred.
Direct Cost

--

Indirect Cost
No items found.
Best Practices for
Elastic IP

Categorized by Availability, Security & Compliance and Cost

Low
Access allowed from VPN
No items found.
Low
Auto Scaling Group not in use
No items found.
Medium
Connections towards DynamoDB should be via VPC endpoints
No items found.
Medium
Container in CrashLoopBackOff state
No items found.
Low
EC2 with GPU capabilities
No items found.
Medium
EC2 with high privileged policies
No items found.
Medium
ECS cluster delete alarm
No items found.
Critical
ECS task with Admin access (*:*)
Medium
ECS task with high privileged policies
No items found.
Critical
EKS cluster delete alarm
No items found.
Medium
ElastiCache cluster delete alarm
No items found.
Medium
Ensure Container liveness probe is configured
No items found.
Medium
Ensure ECS task definition has memory limit
No items found.
Critical
Ensure EMR cluster master nodes are not publicly accessible
No items found.
More from
Amazon Web Services