Regional data transfer charge between EC2 from separated AWS accounts - amazon-web-services

1, if 2 EC2 instances in separated VPC in the same AZ, so they can not connected by private IP right? so BOTH of ec2 will be charged the regional data transfer fee right?
2, said 2 ec2 instances in the same AZ from 2 separated AWS accounts. It is very common case due to lot of servers are from EC2. For example, one ec2 instance is from a 3rd party service provider, and one instance is from me. Even if they are in the same AZ, When my ec2 send/receive data from/to that ec2 from 3rd party, BOTH of us will be charged regional data transfer fee, right?
3, Is it possible to use private IPs to connect/send traffic between EC2 instances in the same AZ from different accounts?
4, how can I launch a ec2 without VPC?

VPCs can be peered, in which case the instances can communicate via private IP addresses, as long as the CIDR supernets of the VPCs don't overlap.
However, you'll still be charged the regional transfer rate.
There is no such concept as instances from two different AWS accounts being in "the same" availability zone, because this isn't something you can readily determine, and even if you can, it doesn't matter:
To ensure that resources are distributed across the Availability Zones for a region, we independently map Availability Zones to identifiers for each account. For example, your Availability Zone us-east-1a might not be the same location as us-east-1a for another account. Note that there's no way for you to coordinate Availability Zones between accounts.
—http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
The charge is always the same, between accounts -- it's regional data transfer, within the region.
Note that both instances are billed $0.01/GB. The net charge, then, is $0.02/GB, split across the two instances, whether you use private or public IP addresses, the charge is the same whether you use VPC peering or simple connect directly over public IP addresses.

Related

Is the data traffic between EC2 and Lightsail free (in EC2 billing)?

I looked at the pricing pages for both EC2 and Lightsail but could not find anything.
I am more concerned about data bills on EC2 side as EC2 data is much more expensive.
I can relocate servers to be in the same region if that helps reduce cost.
Data between Regions is definitely charged at full Data Transfer prices.
Data within the same Region but in different AZs would be charged at 1c/GB (possibly 2c/GB since it might be charged from both ends).
The lowest-cost option would be to establish VPC Peering between Lightsail and your VPC, and having the resources in the same AZ. This should (?) eliminate any Data Transfer charge.
This might be helpful: Understanding Data Transfer in AWS - The Duckbill Group

How does an EBS volume in an Availability zone get restricted only to a specific AWS account & its users?

In AWS, an EC2 instance is launched within a subnet created in an Availability Zone which is again, in a VPC. So, the VPC can be thought of like a container to which only the AWS account and its users have access to. But when creating EBS volumes, only the Availability Zone is asked for / provided and the same EBS volume can be attached to any EC2 instance irrespective of the VPC it belongs to (Of course, for the same AWS account only). My question is - How does AWS prevent other AWS accounts from seeing this EBS volume present in the AZ? Is that implementation abstracted by AWS?
An Amazon VPC is a virtual construct that is used to connect virtual computers according to traditional networking. Resources (eg EC2 instances, RDS databases) can be connected via a VPC, which determines how network traffic flows between them. It is not necessarily how the resources are physically created.
An Availability Zone is a physical data center (or a group of data centers). Resources are created in an AZ, which determines their physical location. For example, an Amazon EBS volume resides in a data center, so it is in only one AZ. It can be logically connected to any EC2 instance in the same account in the same AZ.
Amazon EBS volumes are connected via a backplane that is invisible to the resources. It just magically "attaches" to the instance. It does not use the same network as a VPC.
The Amazon EBS service will only provide EBS volumes to EC2 instances in the same AWS account.
According to AWS Shared Responsibility Model:
AWS responsibility “Security of the Cloud” - AWS is responsible for
protecting the infrastructure that runs all of the services offered in
the AWS Cloud. This infrastructure is composed of the hardware,
software, networking, and facilities that run AWS Cloud services.
AWS provides isolation of all resources between accounts, and this implementation is abstracted, and a part of AWS responsibility.
In addition, it is recommended to Encrypt EBS Volumes, it is free and doesn't impact volume performance.

Can you explain AWS billing rates on data transfer

To design a system I need to decide on where to deploy the instances (suppose that I don't really care where they are but only want to optimize costs).
The on-demand page mentions several billing items:
Data Transfer IN To Amazon EC2 From Internet
Data Transfer OUT From Amazon EC2 To Internet
Data Transfer OUT From Amazon EC2 To (a list of regions)
Data Transfer Across AZ within this Region
My questions:
About item 1 - they say this is free, is it? does it make sense that from Internet to Amazon is free while from Amazon to Amazon is not free? (I'm talking on the inbound data here, not the outbound).
In items 2-3: does "Amazon" refer to all AWS services, including another EC2 instance?
Regarding item 4: it is written "Data transferred "in" to and "out" of Amazon EC2, Amazon RDS, Amazon Redshift , Amazon DynamoDB Accelerator (DAX), and Amazon ElastiCache instances or Elastic Network Interfaces across VPC peering connections in the same AWS region is charged at $0.01/GB." Is that meaning that if I run a process between 2 EC2 instances on the same region then I pay for each GB twice? first for outbound from one instance and second for the inbound on the other instance.
The simple rules-of-thumb are:
Inbound traffic from the Internet to the AWS Cloud is free.
Outbound traffic from the AWS Cloud to the Internet is charged at the applicable rates in each region (this is the majority of the cost). This applies to anything that sends traffic out to the Internet from your AWS services.
Outbound traffic from the AWS Cloud to Amazon CloudFront has a lesser rate
Traffic within a region but between Availability Zones is 1c/GB in each direction. In fact, the wording on the EC2 Instance Pricing page now shows this.
To answer your specific questions:
Inbound is free
Outbound is for any AWS service that sends traffic to the Internet
Traffic between AZs or via VPC Peering is charged in "each direction"

AWS - VPC Limits - Efficient Infrastructure

For my fairly modest web application, I seem to be hitting some of the AWS VPC limits, which made wonder if I'm maybe structuring things incorrectly:
I have an application for which we have three environments: Staging, QA, Production. So I have a VPC for each.
These three VPCs exist in the US-East-1 Region
Each Application is available in two availability zones (us-east-1b & us-east-1c)
An example of a limit I'm hitting is for the following circumstance:
I have Public and Private facing subnets. And because I'm using two Availability Zones, I have Public and Private Subnets for each (4 subnets in total, per VPC)
The Private Subnets need internet access, so their respective Route Tables have entries for NAT Gateways.
So in the end, this means each Private Subnet has a NAT Gateway, and therefore each NAT Gateway has an Elastic IP. And because I have three environments, and two Availability Zones for each, that's already 6 Elastic IP addresses, and the Elastic IP limit per Region is 5.
So obviously, I can request an increase, but it made me wonder if I'm doing something wrong. Could some of these resources in fact share NAT Gateways, or Elastic IPs, or something to that effect?
You're not doing anything wrong, but you could be doing some things better.
Since you have 3 separated environments, you could separate the environments into separated AWS accounts.
For example, it's not uncommon to have Development in one AWS account, and Staging + Production in another AWS account. This has the added benefit of separating resources, identities, etc. for security purposes and avoids "oh $#&!, I just deleted the production stack by mistake".

Subnets and availability zones

considering the statement :
When adding an RDS instance to VPC, there needs to be three subnets in
the subnet group across three different AZs for that VPC
what is the difference between three subnets and AZs here?
I know that we need AZs for any RDS instance and it is created automatically by amazon at deployment time. So, this of course means that there should be one subnet in each three AZs to enable access to RDS replicas and instances. Or it means that each AZ should have three subnets created within to enable that?
Amazon provides 99.95% RDS availability
Multi-AZ configurations for MySQL, MariaDB, Oracle, and PostgreSQL are covered by the Amazon RDS Service Level Agreement ("SLA"). The RDS SLA affirms that AWS will use commercially reasonable efforts to make Multi-AZ instances of Amazon RDS available with a Monthly Uptime Percentage of at least 99.95% during any monthly billing cycle.
In order to achieve that database has to be replicated in three different AZ. That is the reason why Amazon requires three subnets in three AZ. The relationship is:
The region has more than one AZ
AZ belongs only to one region
AZ has more than one data center
AZ can have more than one subnets. However, there is a soft limit of 200 subnets per AZ. You can ask Amazon for more than 200 if you need.
Subnet belongs only to one AZ
VPC belongs only to one region. You can have more than one VPC per region. However, there is a soft limit of 5 VPCs per region. You can ask Amazon for more than 5 if you need.
VPC can span more than one AZ.
You can have as many Subnets as you like in each AZ. By default AWS creates one VPC containing one Subnet in each AZ. The number of AZ varies from region to region.
The quote you gave in your question is saying that you must have three subnets, that these three subnets must all be be in different AZ but all three subnets must be in the same VPC.