Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does AWS has cross account data transfer cost if both service are in same region?

I want to transfer data from an EC2 machine in one account to an S3 bucket on another account. Here, both the services are in the same region. Is the transfer of data happening over the internet as both are on different accounts?

like image 778
Neron Joseph Avatar asked Dec 23 '22 16:12

Neron Joseph


2 Answers

There is no charge for Data Transfer between Amazon EC2 and Amazon S3 in the same region. This includes situations where information is being transferred between AWS Accounts.

From Amazon S3 Simple Storage Service Pricing - Amazon Web Services:

You pay for all bandwidth into and out of Amazon S3, except for ... Data transferred out to an Amazon Elastic Compute Cloud (Amazon EC2) instance, when the instance is in the same AWS Region as the S3 bucket (including to a different account in the same AWS region).

I know the wording is confusing, but basically traffic between EC2 and S3 in the same region is not charged.

like image 68
John Rotenstein Avatar answered Dec 25 '22 04:12

John Rotenstein


Yes, the data transfer is happening over the internet if ec2 and s3 are in different regions ( irrespectivie of same account or different account ) .

But for ec2 and s3 in same region you can use VPC Endpoint specific to S3 to route the data internal to AWS .

For more clarity, use tcpdump to capture the packets specific to s3 or take a tcpdump on port 53 ( dns ) you should get an s3 endpoint URL for s3 which ec2 is using to access s3.like this :

12:05:40.479211 IP ip-10-80-0-2.eu-central-1.compute.internal.domain > ip-172-18-0-12.eu-central-1.compute.internal.34545: 21349 2/0/0 CNAME s3-r-w.eu-central-1.amazonaws.com., A 52.219.72.229 (124)
12:05:40.479213 IP ip-10-80-0-2.eu-central-1.compute.internal.domain > ip-172-18-0-12.eu-central-1.compute.internal.34545: 21349 2/0/0 CNAME s3-r-w.eu-central-1.amazonaws.com., A 52.219.72

You can know if it's resolving to Public IP or Private IP

like image 32
Surya Prakash Patel Avatar answered Dec 25 '22 06:12

Surya Prakash Patel