AWS Cost Explorer uses a variety of data sources to calculate the cost of resources. This includes the AWS Billing and Cost Management API, Amazon Simple Storage Service (S3) data, and AWS Config. Cost Explorer also uses other AWS services to provide Augmented Cost Analysis.
To generate a cost report for EC2 instances, Cost Explorer first looks at the cost and usage information for the account. This data is then combined with other data sources, such as AWS Config, to provide contextual information about the resources. To generate a report for EC2 instances tagged with a specific billing tag, Cost Explorer first looks at the cost and usage information for the account. This data is then combined with other data sources, such as AWS Config, to provide contextual information about the resources.
For more information on how Cost Explorer calculates costs, see the AWS Billing and Cost Management documentation.