It has been a long time since I’ve posted here. I recently got promoted at work and that has been eating up a lot of my time, but I am back and ready to learn and share! Enough with the introductions let’s get back into it.
So when using AWS you need to keep in mind the costs of the data you’re transferring. For instance, data coming into your ec2 instances and being shared in the same AZ is free, if using a private IP. However if you are transferring between different AZ it will be $0.01 per GB if you are using private IP and $0.02 per GB if you are using public IP. Inter-region traffic, traffic between two regions, will be $0.02 per GB. So when working with AWS it is important to ensure that you keep use of public IP to a minimum if you want to keep costs down. You can even keep all traffic in the same AZ for lower costs at the risk of high availability.
Another cost to consider is S3, ingress traffic is free same as before. When users download data straight from S3 through the internet they will pay $0.09 per GB! Using S3 transfer acceleration for faster transfer times could add from $0.04 to $0.08 on top of that! One way you can minimize the cost would be to transfer data from S3 to CloudFront for free and then that egress traffic only costs $0.085 cents per GB the data is then also cached and allows for easier access, a win-win! Cross-region replication between the two S3 buckets is $0.02 per GB as well, so you are definitely paying for your HA.
When you are using NAT Gateway versus VPC gateway the costs can be very different. Let’s say in both instances you have a private subnet with an EC2 instance both subnets are in a VPC. You have a NAT Gateway, inside a public subnet, in the VPC that goes out through an internet gateway, this goes out to the internet and then goes into an S3 bucket in the respective region. The costs associated would be $0.045 per hour for the NAT gateway, $0.045 per GB of data processed through the NAT gateway, and $0.09 per GB cross-region or $0.00 per GB if it’s the same region. If you just used VPC gateway in this example to access the S3 bucket you would have only payed $0.01 per GB of data transferred in the same-region.