Creating your report - Application Cost Profiler

Creating your report

After fulfilling the prerequisites, you're ready to configure the report for your AWS account and send your usage data to AWS Application Cost Profiler. This section describes how to configure the report and how to send the usage data to Application Cost Profiler.

Configure your Application Cost Profiler report

The following procedure shows how to configure the report that you want to generate based on your usage date. You configure details such as the frequency that the report is generated.

Note

If your AWS account is part of an AWS organization, you can configure the report using either the management account or an individual member account. Reports configured for individual accounts only contain data for that account. Reports configured using the management account can include data for the entire organization.

The Amazon S3 bucket used for report output must belong to the account creating the report configuration.

To configure your Application Cost Profiler report

  1. Open a web browser and sign in to the Application Cost Profiler console.

  2. Choose Get started now to configure or modify a report.

  3. Enter a Report Name and Report Description for your report.

  4. Enter the name of your S3 bucket in the Enter S3 bucket name field and enter the S3 prefix in the Enter S3 prefix field. For more information about creating S3 buckets and giving Application Cost Profiler permissions, see Setting up Amazon S3 buckets for Application Cost Profiler.

  5. Select the options that you want your report to have:

    • Time Frequency – Choose whether the report is generated on a Daily or Monthly cadence, or Both.

    • Report Output Format – Choose the type of file to create within your Amazon S3 bucket. If you choose CSV, Application Cost Profiler creates a comma-separated values text file with gzip compression for the reports. If you choose Parquet, a Parquet file is generated for the reports.

  6. Choose Configure to save your report configuration.

Note

You can also use the AWS Application Cost Profiler API to configure reports.

Verify the report settings by choosing Get started now to view the current report configuration.

Note

You can only have a single report configured. Returning to the configuration page will edit your existing report.

After you have configured your report, data ingestion is enabled. You can integrate your services with Application Cost Profiler to provide usage data for your resources.

Reporting tenant usage data from your services

After you have configured the report, you are ready to send tenant usage data from the resources or services in your account. You must inform Application Cost Profiler when your resource is being used for a specific tenant. For example, if your service accepts API calls from different tenants, you record a start and end time for each tenant as you start and end an API call from that tenant. Application Cost Profiler uses that data to generate reports about the cost of your service, by the amount of time spent on work for each tenant.

To give Application Cost Profiler the usage data, you do the following:

  • Prepare resource usage data – Create tables that describe when a resource is used for a specific tenant.

  • Upload usage data – Upload the tables to an Amazon S3 bucket that you have given Application Cost Profiler permission to access.

  • Import usage data – Call the ImportApplicationUsage API operation to let Application Cost Profiler know the data is ready to be processed.

The following sections describe each of these steps in more detail.

Step 1: Preparing your resource usage data

As a resource is being used in your service, you track which tenant is using it. Record this data into a table that you can later upload for Application Cost Profiler to import. Each row in the table describes a resource , the tenant that is using the resource, and the start and end times of that usage. An example of a resource is an Amazon Elastic Compute Cloud (Amazon EC2) instance that is being used.

This step requires that you integrate code into your service to output the correct information about the usage.

The fields that are in a resource usage table are listed in the following table.

Field Description
ApplicationId Identifies the application or product in your system that is being used. Defines the scope of the tenant metadata.
TenantId An identifier in your system for the tenant who is consuming the specified resource. Application Cost Profiler aggregates to this level within the ApplicationId.
TenantDesc (Optional) Additional data about the tenant for your own additional reporting.
UsageAccountId The account that the resource runs in (important for accounts that are part of an organization).
StartTime Timestamp (in milliseconds and microseconds) from Epoch, in UTC. Indicates the start time of the period for the usage by the specified tenant.
EndTime Timestamp (in milliseconds and microseconds) from Epoch, in UTC. Indicates the end time of the period for the usage by the specified tenant.
ResourceId Amazon Resource Name (ARN) for resource being used.
Name (Optional) As an alternative to specifying a ResourceId, you can specify a Name resource tag to attribute costs to a set of resources (the field must include the value you want to use for the Name tag). Resource tags are enabled as part of your Cost and Usage Report. For more information about resource tags, see Resource tags details in the Cost and Usage Report User Guide.

The output must be in a comma-separated values (.csv) file that includes a heading row, as shown in the following example.

ApplicationId,TenantId,TenantDesc,UsageAccountId,StartTime,EndTime,ResourceId MyApp,Tenant1,,123456789012,1613681437032.9001,1613681437041.5312,arn:aws:ec2:us-east-1:123456789012:instance/1234-abcd-example-1234 MyApp,Tenant2,,123456789012,1613681245531.4426,1613681245551.1323,arn:aws:ec2:us-east-1:123456789012:instance/1234-abcd-example-1234 MyApp,Tenant1,,123456789012,1613681904815.3381,1613681904930.0972,arn:aws:ec2:us-east-1:123456789012:instance/1234-abcd-example-1234 MyApp,Tenant2,,123456789012,1613681904765.1956,1613681904946.574,arn:aws:ec2:us-east-1:123456789012:instance/1234-abcd-example-1234

Save the data as a file, with a .csv extension (or .csv.gzip if compressed with gzip). When you upload this data to Application Cost Profiler, each time slice is assigned to the associated tenant. In this example, the report includes the time slice of the Amazon EC2 instance cost for that tenant. For Amazon EC2 instances only, slices that are not associated with a specific tenant are added to an unattributed tenant. Overlapping time slices are counted multiple times. It's your responsibility to ensure that the data in your usage table is accurate.

Note

Your file must represent one hour of time. If a resource is used over multiple hours, end the usage on the hour, and have a new record in the next file that starts at the same time.

You must submit a single file containing an entire hour's data. If multiple files are submitted for the same hour's data, Application Cost Profiler only considers the data in the latest file.

For example, the following table shows how Application Cost Profiler calculates usage for three tenants, over an hour (3,600,000 milliseconds), based on provided time slices.

Tenant Provided time slices Calculated percent of hourly cost
Tenant1 1,200,000 ms 33.34%
Tenant2 600,000 ms 16.66%
<unattributed> 50.00%

In this example, Tenant1 is assigned one-third of the hour and Tenant2 is assigned one-sixth of the hour. The remaining half-hour (1,800,000 ms) is not attributed to either of the clients, which is 50% of the hour.

Currently, the following resources are enabled for Application Cost Profiler:

  • Amazon EC2 instances (on demand and spot instances only)

  • Lambda functions (If you are sending data for a Lambda function, you must send the Unqualified Resource ARN as ResourceId.)

  • Amazon Elastic Container Service (Amazon ECS) instances

  • Amazon Simple Queue Service (Amazon SQS) queues

  • Amazon Simple Notification Service (Amazon SNS) topics

  • Amazon DynamoDB reads and writes

Note

Amazon SQS, Amazon SNS, and DynamoDB usage is not charged by time, unlike most resources. In their case, the usage during an hour (for example, a number of reads and writes in DynamoDB), is categorized by the percentage of the hour that you allocate to different tenants, regardless of when the reads or writes happened during the hour.

Step 2: Uploading your resource usage

After you have a file of usage by tenant, upload your data file to Amazon S3 and make sure that Application Cost Profiler has permission to access it.

To learn more about creating an S3 bucket, see Application Cost Profiler specific prerequisites.

You must make sure that Application Cost Profiler has access to your S3 bucket. This only needs to be done once per S3 bucket (you can reuse the same bucket for uploading multiple usage files). For information about giving access to the bucket, see Giving Application Cost Profiler access to your usage data S3 bucket. If the bucket is encrypted,see Giving Application Cost Profiler access to SSE-KMS encrypted S3 buckets.

Note

It is not required that you encrypt the S3 buckets that you use for usage data.

Upload your data to the S3 bucket as a file, with a .csv extension (or .csv.gzip if compressed with gzip), at hourly intervals. After you upload a new file, you must inform Application Cost Profiler that you have uploaded it so that the file can be imported into your report.

Note

By giving Application Cost Profiler access to your usage data, you agree that we may temporarily copy such usage data objects to the US East (N. Virginia) AWS Region while processing reports. These data objects will be kept in the US East (N. Virginia) Region until the monthly report generation is complete.

Step 3: Importing usage data into Application Cost Profiler

After you have uploaded usage data to an Amazon S3 bucket that Application Cost Profiler has access to, inform Application Cost Profiler that the data exists and to import it into your final report. You do this by using the ImportApplicationUsage operation in the Application Cost Profiler API.

For information about the AWS Application Cost Profiler API, including the ImportApplicationUsage operation, see the AWS Application Cost Profiler API Reference.

The following example shows how to call ImportApplicationUsage. Replace the input text in brackets with the values for your S3 bucket and uploaded object.

POST /ImportApplicationUsage HTTP/1.1 Content-type: application/json { "sourceS3Location" : { "bucket": "<bucket-name>", "key": "<object-key>", "region": "<region-id>" } }
Note

The region parameter is only required if your bucket is in an AWS Region that is disabled by default. For more information, see Managing AWS Regions in the AWS General Reference.

Application Cost Profiler generates a new report at the frequency that you requested when configuring your report, using the data that you imported with ImportApplicationUsage.

After you have configured your report and automated importing your usage data into Application Cost Profiler, you are ready to view your generated reports. For more information about reports, see Using Application Cost Profiler reports.