No, it is not possible to allocate Amazon EC2 usage costs to a fine-grained level, such as individual directory, application or user.
Amazon EC2 is charged on an hourly basis, with the cost varying by:
- Instance Type (CPU, RAM, chipset)
- Operating System (eg Windows instances include an hourly charge for Windows)
- Billing type (On-Demand, Reserved Instance, Spot)
While the AWS billing system can allocate EC2 costs based on tags (eg Department), this is only done for a whole instance on an hourly basis.
Some ideas for fine-grained allocation of costs:
- Record usage in CloudWatch via a Custom Metric, then extract data for billing purposes
- Store usage information in log files and send them to CloudWatch Logs, then extra data for billing purposes
- Track usage in a file, send it to Amazon S3 and then aggregate information each billing cycle
Each of these options would require custom coding and processing.