Skip to main content
You can connect AWS CloudWatch to Costory to import custom usage metrics (for example S3 storage size, request counts, CPU usage, or queue depth). This helps you build richer unit economics by combining billing data with real product and infrastructure signals.
  1. Create an AWS CloudWatch integration in Integrations: a. In AWS, attach the following policy to the existing federated IAM role that Costory uses:
    {
    "Version": "2012-10-17",
    "Statement": [
        {
        "Sid": "CloudWatchReadForCostory",
        "Effect": "Allow",
        "Action": [
            "cloudwatch:ListMetrics",
            "cloudwatch:GetMetricData",
            "cloudwatch:GetMetricStatistics"
        ],
        "Resource": "*"
        }
    ]
    }
    
    b. Make sure the new policy is attached to the federated IAM role for Costory.
  2. In Costory, go to Metrics > Import new metrics datasource > AWS CloudWatch.
  3. Provide the CloudWatch query, aggregation, and optional group-by fields. a. You should import the metric as an AWS CloudWatch insight query:
    SELECT SUM(BucketSizeBytes) FROM SCHEMA("AWS/S3", BucketName,StorageType) GROUP BY BucketName
    
    AWS CloudWatch insight query
    AWS CloudWatch metric in Costory
    b. After a few seconds, the metric will be available in Costory. Common examples you can import:
    • S3 storage size: total bytes per bucket (AWS/S3 BucketSizeBytes)
    • HTTP request volume: number of requests per API, ALB, or distribution (e.g. AWS/ApiGateway, AWS/ApplicationELB, AWS/CloudFront)
    • CPU and memory utilization: average CPU/memory by service, cluster, or Auto Scaling group (AWS/EC2, AWS/ECS, AWS/EKS)
    • Queue depth and throughput: SQS queue length, messages sent/received (AWS/SQS)
    • Database load: connections, CPU, IOPS for RDS or Aurora (AWS/RDS)
AWS CloudWatch metric in Costory
Last modified on April 1, 2026