I have an ECS cluster of services running on a few EC2 machines. Each service is internet facing and forms a target group, all these target groups are on the same load balancer.

Service 1 -> TG1 -> ELB
Service 2 -> TG2 -> ELB

ELB Rules:
If request from 1.domain.com -> route to Service 1
If request from 2.domain.com -> route to Service 2

The services communicate with one another via their public CNAMEs.

I'm trying to figure out data-out transfer costs when Service 1 communicates with Service 2 by calling an endpoint on 2.domain.com. I think we'd be charged at the same rate as data-out to public internet even though the services are in the same region (could literally be hosted on the same machine), as the communication doesn't happen through a private IP but through the public internet. I've consulted the AWS documentation and can't find anything related to confirm this. Can someone help with this please?

Edited to Add: My AWS bill reflects data out charges because we use several public services and we provide information to clients outside the network. I want to know if this specific case is charged as well.

  • 1
    What does your AWS bill say when you try it? – womble Apr 17 '19 at 6:52
  • OpenGuide may help, specifically this picture. – Tim Apr 17 '19 at 7:34
  • Updated my question to include billing output. – svetha.cvl Apr 17 '19 at 15:37

Even though you are accessing a service within the same server or VPC, if you access that service through the public IP address, then the connection will exit your VPC and re-enter. This will incur outgoing data transfer costs.

To access a service within the same VPC (or within the same server) without incurring data transfer costs, use the private IP address or localhost/ (if the service is on the same server).

| improve this answer | |
  • That makes sense, thanks. I have multiple tasks to a service, all of them behind a load balancer, plus dynamic port management by ECS. So I don't think I can access using the private IP or localhost. – svetha.cvl Apr 18 '19 at 5:16
  • If your load balancer was internal only, then you could access it via the internal IP addresses and that wouldn't incur any data transfer costs. – Matt Houser Apr 18 '19 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.