Allocating per-tenant DynamoDB cost with the least operational effort

Answer Correct answer: B — Log tenant ID with consumed RCUs/WCUs per transaction and calculate per-tenant cost from those metrics plus overall DynamoDB cost.

A software as a service (SaaS) company has developed a multi-tenant environment. The company uses Amazon DynamoDB tables that the tenants share for the storage layer. The company uses AWS Lambda functions for the application services. The company wants to offer a tiered subscription model that is based on resource consumption by each tenant. Each tenant is identified by a unique tenant ID that is sent as part of each request to the Lambda functions. The company has created an AWS Cost and Usage Report (AWS CUR) in an AWS account. The company wants to allocate the DynamoDB costs to each tenant to match that tenant's resource consumption. Which solution will provide a granular view of the DynamoDB cost for each tenant with the LEAST operational effort?

  1. Associate a new tag that is named tenant ID with each table in DynamoDB. Activate the tag as a cost allocation tag in the AWS Billing and Cost Management console. Deploy new Lambda function code to log the tenant ID in Amazon CloudWatch Logs. Use the AWS CUR to separate DynamoDB consumption cost for each tenant ID.
  2. Configure the Lambda functions to log the tenant ID and the number of RCUs and WCUs consumed from DynamoDB for each transaction to Amazon CloudWatch Logs. Deploy another Lambda function to calculate the tenant costs by using the logged capacity units and the overall DynamoDB cost from the AWS Cost Explorer API. Create an Amazon EventBridge rule to invoke the calculation Lambda function on a schedule. Correct Answer
  3. Create a new partition key that associates DynamoDB items with individual tenants. Deploy a Lambda function to populate the new column as part of each transaction. Deploy another Lambda function to calculate the tenant costs by using Amazon Athena to calculate the number of tenant items from DynamoDB and the overall DynamoDB cost from the AWS CUR. Create an Amazon EventBridge rule to invoke the calculation Lambda function on a schedule.
  4. Deploy a Lambda function to log the tenant ID, the size of each response, and the duration of the transaction call as custom metrics to Amazon CloudWatch Logs. Use CloudWatch Logs Insights to query the custom metrics for each tenant. Use AWS Pricing Calculator to obtain the overall DynamoDB costs and to calculate the tenant costs.

Community Votes

B
83%
A
17%

83% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

DynamoDB already emits consumed read/write capacity; logging tenant ID with RCU/WCU per transaction and aggregating on a schedule yields per-tenant cost visibility with the least operational overhead compared with tagging or re-partitioning tables.

A SaaS provider wants granular per-tenant DynamoDB cost with minimal operations. Logging the tenant ID and the consumed RCUs/WCUs per transaction to CloudWatch Logs and calculating tenant cost from those metrics plus the overall DynamoDB cost gives a fine-grained view without building a tagging or partitioning pipeline.

Assuming cost allocation tags (Option A) alone give DynamoDB per-tenant granularity — DynamoDB costs are not broken out by item or tenant via tags, so tags cannot isolate a single shared table's per-tenant consumption.

Community Discussion (9 comments)

kejam 👍 5 Selected: B
Answer B: LEAST operational effort and fine grained approach. https://aws.amazon.com/blogs/apn/optimizing-cost-per-tenant-visibility-in-saas-solutions/ RCU and WCU metrics are already logged in CloudWatch. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/metrics-dimensions.html
TomTom 👍 2 Selected: A
Option A is the preferred solution for providing a granular view of DynamoDB costs for each tenant with the least operational effort. Advantages of Option A: Utilizes AWS's built-in tagging capabilities for cost allocation, which is straightforward to implement and maintain. Provides detailed cost reports in AWS Cost Explorer without requiring additional custom code or complex calculations. Disadvantages of Option B: While it offers precise tracking of resource consumption, it significantly increases operational complexity and maintenance requirements. Thus, for a balance of granularity and minimal operational effort, Option A is the optimal choice.
Chicote 👍 1 Selected: B
es B, seguro
career360guru 👍 1 Selected: B
Option B
zzyy 👍 1 Selected: B
Answer B
aabdlmouna 👍 1 Selected: B
Answer is B
07c2d2a 👍 4
AWS Cost Explorer API vs cost calculator is really all you need to consider here.
TheCloudGuruu 👍 1 Selected: B
Answer is B
alexis123456 👍 1
Correct Answer is A

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option B meets the 'least operational effort' bar: the Lambda functions already receive the tenant ID, so logging it alongside the consumed RCUs and WCUs per transaction requires minimal code change. A scheduled calculation Lambda uses those logged capacity units with the overall DynamoDB cost from the Cost Explorer API to allocate cost per tenant. No table restructuring or tagging program is needed.

Why the Other Options Are Wrong

Option A relies on cost allocation tags, but DynamoDB does not attribute a shared table's cost to individual tenants via tags, so granularity is lost. Option C adds a new partition key and an Athena pipeline, increasing operational effort. Option D uses CloudWatch Logs Insights and Pricing Calculator but still lacks a clean per-tenant consumption metric and adds manual pricing work.

Community Comment Notes

kejam (likes 5) endorses B as the least-effort fine-grained approach and references the AWS SaaS cost-per-tenant blog. TomTom prefers A for built-in tagging, but tagging cannot isolate per-tenant consumption in a single shared table.

Official Reference

Related Analysis

Practice All SAP-C02 Questions

Access 85 questions with complete answers and detailed explanations.

View Full SAP-C02 Practice Test →

← Back to SAP-C02 Study Guide