AWS EC2 Elastic IPs bandwidth usage and charges
Asked Answered
L

3

31

I have a little questions regarding Elastic IPs and its charge. Some blogs says that Elastic IP will charge you by the bandwidth you use

Elastic IP addresses charge by bandwidth and have an hourly price when they are not attached to a running instance

From http://things.zarate.org/scaling-a-single-ec2-instance-and-downsizing

From my understanding after reading some blogs and the documentation, you will only be charged if you use the elastic IPs in communicating between instances and if you have elastic IPs standing there idle on your account without being associated to your instance

If you communicate between instances using public or elastic IP address even in the same region you pay regional data transfer rates(0.01$ per GB in/out).

From http://www.cloudiquity.com/2009/02/using-amazon-ec2-public-ip-address-inside-ec2-network/

See AWS calculator screenshot -> http://shareimage.org/images/lzjj3eull2ux0lo663fr.png

So my confusion is on the part whether AWS charge for any kinds of traffic requests (using my browser, SSH) using the elastic IPs?

So if for example: I ssh-ed to my instances using the elastic IPs (For example 8.8.8.8) instead of the public dns name given like ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com, will this bandwidth registered as simple bandwidth in/out usage or the public/elastic IP bandwidth?

Limiting answered 7/4, 2012 at 3:39 Comment(1)
There is an option that does not require an Elastic IP.to be assignedLaunch
S
82

You should decouple the data transfer charge question from the Elastic IP address charge one, insofar they are completely independent from each other:

Elastic IP addresses

Allocating and using one Elastic IP addresses per instance is basically free, except if the Elastic IP address is not currently associated with an instance, see section Elastic IP Addresses on page Amazon EC2 Pricing:

  • $0.00 for one Elastic IP address associated with a running instance
  • $0.005 per additional Elastic IP address associated with a running instance per hour on a pro rata basis
  • $0.005 per Elastic IP address not associated with a running instance per hour on a pro rata basis
  • $0.00 per Elastic IP address remap for the first 100 remaps per month
  • $0.10 per Elastic IP address remap for additional remaps over 100 per month

    [emphasis mine]

The rationale behind this approach is explained in the respective FAQ Why am I charged when my Elastic IP address is not associated with an instance?:

In order to help ensure our customers are efficiently using the Elastic IP addresses, we impose a small hourly charge for each address when it is not associated to a running instance.

Data Transfer

Again, the key aspect is explained in section Data Transfer on page Amazon EC2 Pricing (and detailed by some FAQs):

You primarily pay for Internet Data Transfer, i.e. data transferred "in" and "out" of Amazon EC2, which specifically excludes the following:

There is no Data Transfer charge between Amazon EC2 and other Amazon Web Services within the same region (i.e. between Amazon EC2 US West and Amazon S3 in US West). Data transferred between Amazon EC2 instances located in different Availability Zones in the same Region will be charged Regional Data Transfer. Data transferred between AWS services in different regions will be charged as Internet Data Transfer on both sides of the transfer.

Caveat

The important caveat to be aware of indeed follows below that statement though:

Public and Elastic IP and Elastic Load Balancing Data Transfer

  • $0.01 per GB in/out – If you choose to communicate using your Public or Elastic IP address or Elastic Load Balancer inside of the Amazon EC2 network, you’ll pay Regional Data Transfer rates even if the instances are in the same Availability Zone. For data transfer within the same Availability Zone, you can easily avoid this charge (and get better network performance) by using your private IP whenever possible.

Remedy

Not mentioned in the aforementioned paragraph is an important and quite helpful feature of the AWS DNS infrastructure though, see Public IP Addresses and External DNS Hostnames:

We provide each instance that has a public IP address with an external DNS hostname. We resolve an external DNS hostname to the public IP address of the instance outside the network of the instance, and to the private IP address of the instance from within the network of the instance.

That is, it's resolving the public DNS (e.g. ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com) to the Private IP address when you are using it inside the Amazon EC2 network, and to the Public or Elastic IP address when using it outside the Amazon EC2 network. Like so you get the free Availability Zone Data Transfer and reduced charge Regional Data Transfer automatically, e.g. they are actively applying their advise to Always use the internal address when you are communicating between Amazon EC2 instances [which] ensures that your network traffic follows the highest bandwidth, lowest cost, and lowest latency path through our network.

This obviously doesn't work, if you are using the IP addresses directly (i.e. without DNS), which is thus usually best avoided for this and other reasons in the context of EC2.

Systematology answered 7/4, 2012 at 17:39 Comment(8)
@Steffen Opel, excellent answer otherwise but one thing is not clear. Does the public DNS name rule apply to EIP also? i.e, is it possible to generate a DNS name for a given EIP and use that to communicate with an internal instance? At which point Amazon will automatically resolve the EIP DNS to the EIP and therefore to the internal IP, thus saving internet transfer costs? Or is the ONLY option to use the DNS of the EC2 instance itself, and not one generated based on the EIP?Pilloff
@DevKanchen - very good point, with an unfortunate answer indeed: the moment you assign an EIP the public DNS name is gone and not replaced; this could/should be a feature of Amazon's own Route 53 DNS management at least, but I'm using that as well and it doesn't currently offer this functionality. Guess it boils down to relying less on EIPs the more you start using AWS (esp. including Route 53), think Auto Scaling and EC2 spot instances for example; still this is certainly a feature they should support.Systematology
Right, so EIP is not the silver bullet I was hoping for :) Thanks for the information.Pilloff
@DevKanchen - I need to recall my previous comment (got myself confused with differing behavior within an Amazon Virtual Private Cloud (VPC)): Associating an Elastic IP Address (EIP) with a regular (i.e. non VPC) EC2 instance does update the public DNS name as expected (i.e. similar pattern as w/o an EIP), and this public DNS name does resolve correctly to the internal IP address when queried inside of EC2! I'm very sorry for being misleading here, hope you do have a silver bullet now :)Systematology
Too much confusion around this topic somehow. I remember reading a similar note here: alestic.com/2009/06/ec2-elastic-ip-internal. But the pricing matrix for Data Transfer contradicts both: aws.amazon.com/ec2/pricingPilloff
@DevKanchen - The pricing matrix doesn't contradict this, rather "just" doesn't manage to avoid the understandable confusion around the topic: it explicitly states "Using a public or Elastic IP address" ($0.01 per GB), and that's true; the DNS magic in place is based on the public DNS name automatically generated from the public IP address (be it elastic or not), which resolves to the private IP address when queried from within EC2, thus "Using a private IP address" ($0.00 per GB) applies - confusing indeed, but correct ;)Systematology
As a tip; you can easily test if connections between nodes within the same region/az are using the private ip address by issueing following command: sudo netstat -ntap | grep ESTABLISHED The -p option makes it easy to find the offending process. The aws console lists both the pulib ip and the private ip.Gastrocnemius
Update: All public IPv4s are charged $0.005. aws.amazon.com/blogs/aws/…Edmee
E
3

All public IPv4 addresses are charged regardless whether they are being used or not.

enter image description here

Reference: https://aws.amazon.com/blogs/aws/new-aws-public-ipv4-address-charge-public-ip-insights/

Edmee answered 3/1 at 11:28 Comment(0)
S
0

When does an Elastic IP incur charges?

If you have created an elastic IP and it is not associated with any virtual machine If you have created an elastic IP, and also have associated it with a Virtual Machine but the Virtual Machine is not running You have multiple Elastic IPs associated with a single EC2 instance

Checkout this link which has more relevant info around the same: https://tech-blog-yo.com/devops/aws-amozon-web-services/what-is-an-elastic-ip-in-aws-why-do-we-need-it-when-it-incurs-charges-in-billing

Subordinate answered 3/11, 2022 at 21:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.