Reputation: 4649
I am running e-commerce website, built on ruby on rails. App is running on ec2 ubuntu 10.04 instance and all the images are stored in s3 buckets. I want to track how many GB/TB of data we have served to our users or customers. Is there any way to track??? Kindly help me out
Upvotes: 0
Views: 131
Reputation: 12901
Most of your network costs are probably based on serving images from S3. To know how much data you are serving from S3, you should upload your S3 access logs to a bucket in S3, and then you can use any web analytics tools (like webtrends.com) that knows how to process access log files to analyze it for you.
You can see the instruction of setting up "Server Access Logging" here: http://docs.aws.amazon.com/AmazonS3/latest/dev/ServerLogs.html
To be able to know how much data you are serving from your EC2 instance you can simply use CloudWatch. This is the monitoring service of AWS, which has about 100 metrics on the various services. The relevant metric for you is NetwrokOut
on the relevant instance. You can also get it using The API with
mon-get-stats NetwrokOut --start-time 2013-01-14T23:00:00.000Z --end-time 2013-01-14T23:00:00.000Z --period 3600 --statistics "Average,Minimum,Maximum" --namespace "AWS/EC2" --dimensions "InstanceId=i-c07704a9"
If you want to keep a better eye on your costs running in AWS, you have a rather new option to access your billing information programatically.
You can set up an S3 bucket that will be used to upload a detailed billing information in CSV format every few hours. Then you can access these CSV files and analyze what are your costs in different sections as EC2, RDS, DynamoDB and all others.
It gives you a better solution for checking your costs status beyond a single instance. You can access your billing information files in S3 with your Ruby SDK.
See more details here: http://docs.aws.amazon.com/awsaccountbilling/latest/about/programaccess.html
Upvotes: 2