- Newest
- Most votes
- Most comments
Based on AWS cost management best practices, here are answers to your questions about attributing Textract costs in a centralized account architecture:
1. Per-request Cost Allocation Tags for Textract API calls: Unfortunately, there is no mechanism to pass Cost Allocation Tags on individual Textract API calls. The tagging capability exists only at the resource level (adapter ARN) during creation, not per API request. This limitation means you cannot directly use tags in Cost Explorer to separate costs by individual API calls.
2. Cross-account identity in Cost & Usage Reports: When external accounts assume roles in your Hub account to call Textract, the calling account identity does not automatically appear as a cost dimension in the Cost and Usage Reports or Cost Explorer for the Hub account. The costs are attributed to the Hub account where the resources exist and where the API calls are executed, not to the originating account. This information would only be visible through CloudTrail logs, not in native cost reporting tools.
3. AWS recommended best practices for granular cost tracking: For your centralized account scenario, AWS recommends implementing a chargeback strategy using AWS Cost and Usage Reports combined with Amazon Athena. Since you have different adapter versions for each environment and separate IAM roles per environment (role-dev, role-staging, role-prod), you can:
- Use CloudTrail to capture the assumed role identity and adapter ARN for each API call
- Export this data to Amazon Athena for analysis
- Correlate CloudTrail data with Cost and Usage Reports to build a custom chargeback model
- Calculate and allocate costs based on the assumed role identity and adapter version used
This approach allows you to accurately calculate and allocate monthly charges across your different environments and track cost savings for each individual environment, even when all costs are incurred in a single centralized account.
4. CloudTrail logging for cost attribution: Yes, CloudTrail does log the assumed role identity and adapter version (via the Adapters parameter) for each AnalyzeDocument and StartDocumentAnalysis call. The CloudTrail events will show:
- The assumed role ARN (userIdentity.sessionContext.sessionIssuer.arn)
- The adapter ARN used in the request
- Timestamp and request parameters
You can use CloudTrail combined with Athena to build an external cost attribution model by:
- Querying CloudTrail logs to count API calls per assumed role and adapter
- Joining this usage data with Cost and Usage Reports
- Calculating proportional cost allocation based on usage patterns
5. Future roadmap for per-request tagging: Information about future AWS feature releases and roadmap items is not publicly disclosed. For the most current capabilities and any updates to Textract's tagging functionality, you should consult with your AWS account team or Technical Account Manager.
Recommended Implementation Approach: Given your architecture, the most effective solution is to implement a custom chargeback model using:
- CloudTrail for capturing assumed role identity and adapter usage per API call
- Cost and Usage Reports for actual Textract costs in the Hub account
- Amazon Athena to query and correlate CloudTrail data with cost data
- A proportional allocation method to distribute costs based on usage by each environment's assumed role
This approach provides accurate cost allocation and visibility into usage patterns across your different environments, even though all resources and costs exist in the centralized Hub account. AWS Support and Technical Account Managers can provide guidance on implementing this chargeback strategy effectively for your specific use case.
Sources
Implementing an effective chargeback strategy with Savings Plans | AWS re:Post
Improve Cost Visibility and Observability with AWS Cost Categories – Part 1: Fundamentals and Basic Grouping Techniques | AWS Cloud Financial Management
COST06-BP04 Consider using shared resources - AWS Well-Architected Framework
Relevant content
- asked 2 years ago
