← Back to DevBytes

Monitoring Cloud Storage: Metrics, Alarms, and Dashboards

Understanding Cloud Storage Monitoring

Monitoring cloud storage is the continuous process of collecting, analyzing, and acting on performance and usage data from object, block, and file storage services. In platforms like AWS S3, Azure Blob Storage, or Google Cloud Storage, monitoring exposes metrics such as request counts, latency, data transfer volume, error rates, and storage footprint. These metrics are typically surfaced through each provider’s native observability service—CloudWatch, Azure Monitor, or Cloud Monitoring—and can be consumed via APIs, SDKs, and dashboards.

Effective monitoring goes far beyond checking whether a bucket exists. It gives you insight into access patterns, cost drivers, security anomalies, and potential bottlenecks. A well-instrumented storage layer helps prevent outages, control costs, and meet compliance requirements.

What Cloud Storage Metrics Look Like

Typical built-in metrics include:

Why Monitoring Cloud Storage Matters

Cloud storage is often treated as an “always available” commodity, but silent failures, cost overruns, and performance regressions can happen without proper visibility. Monitoring helps you:

Key Metrics to Watch

Start with the “golden signals” adapted for storage: request rate, latency, errors, and saturation (storage capacity / throughput limits). Depending on your provider, the exact metric names differ, but the concepts are universal.

Example: AWS S3 Metrics in CloudWatch

AWS exposes two classes of S3 metrics:

You enable request metrics on a per-bucket basis (or via prefix/object filters). Once enabled, they appear in the AWS/S3 namespace in CloudWatch.

Example: Azure Blob Storage Metrics

Azure Monitor captures transaction count, ingress/egress, availability, and blob capacity by tier. Metrics like Transactions (per API), E2ELatency, and ServerLatency are available for storage accounts.

Setting Up Alarms

Alarms translate metrics into actionable notifications. You define a threshold and a period of evaluation; when breached, the alarm fires an action—typically an email, SMS, or webhook call. Modern cloud monitoring also supports composite alarms and anomaly detection to reduce noise.

Creating an AWS CloudWatch Alarm with Boto3

Below is a Python script that creates an alarm on the 5xxErrors metric for an S3 bucket. It triggers when the sum of errors over 5 minutes exceeds 3, sending a notification to an existing SNS topic.

import boto3

# Initialize CloudWatch client
cw = boto3.client('cloudwatch')

# Define the alarm
response = cw.put_metric_alarm(
    AlarmName='HighS3-5xxErrors',
    AlarmDescription='Triggers when 5xx errors exceed 3 in 5 minutes',
    Namespace='AWS/S3',
    MetricName='5xxErrors',
    Dimensions=[
        {
            'Name': 'BucketName',
            'Value': 'my-critical-bucket'
        },
        {
            'Name': 'FilterId',
            'Value': 'EntireBucket'
        }
    ],
    Statistic='Sum',
    Period=300,          # 5 minutes
    EvaluationPeriods=1,
    Threshold=3,
    ComparisonOperator='GreaterThanThreshold',
    AlarmActions=[
        'arn:aws:sns:us-east-1:123456789012:ops-alert-topic'
    ],
    TreatMissingData='notBreaching'
)

print("Alarm created:", response['AlarmArn'])

Infrastructure-as-Code Example: Terraform for CloudWatch Alarm

Here’s an equivalent alarm defined in Terraform. It uses the same logic but fits into a repeatable, version-controlled setup.

resource "aws_cloudwatch_metric_alarm" "s3_5xx_errors" {
  alarm_name          = "HighS3-5xxErrors"
  comparison_operator = "GreaterThanThreshold"
  evaluation_periods  = 1
  metric_name         = "5xxErrors"
  namespace           = "AWS/S3"
  period              = 300
  statistic           = "Sum"
  threshold           = 3
  alarm_description   = "Triggers when 5xx errors exceed 3 in 5 minutes"
  treat_missing_data  = "notBreaching"

  dimensions = {
    BucketName = "my-critical-bucket"
    FilterId   = "EntireBucket"
  }

  alarm_actions = ["arn:aws:sns:us-east-1:123456789012:ops-alert-topic"]
}

Creating Alarms in Azure

Using the Azure CLI, you can create an alert rule on Blob Storage latency:

az monitor metrics alert create \
  --name "HighBlobLatency" \
  --resource-group "myResourceGroup" \
  --scopes "/subscriptions/.../resourceGroups/.../providers/Microsoft.Storage/storageAccounts/mystorageaccount" \
  --condition "avg E2ELatency > 1000" \
  --window-size 5m \
  --evaluation-frequency 1m \
  --action "/subscriptions/.../resourceGroups/.../providers/microsoft.insights/actionGroups/ops-alerts"

Building Dashboards

Dashboards consolidate your storage metrics into visual panels—line charts, heatmaps, single-value widgets, and gauges. They provide at-a-glance health status and are essential for on-call engineers and cost-conscious teams.

AWS CloudWatch Dashboard JSON

A CloudWatch dashboard is defined as a JSON string containing widget definitions. Here’s a dashboard that shows bucket size, request count, and 5xx errors side by side.

{
  "widgets": [
    {
      "type": "metric",
      "x": 0,
      "y": 0,
      "width": 8,
      "height": 6,
      "properties": {
        "view": "timeSeries",
        "stacked": false,
        "metrics": [
          [ "AWS/S3", "BucketSizeBytes", { "stat": "Average" } ],
          [ ".", "NumberOfObjects", { "stat": "Average" } ]
        ],
        "region": "us-east-1",
        "title": "Bucket Size & Object Count",
        "period": 86400
      }
    },
    {
      "type": "metric",
      "x": 8,
      "y": 0,
      "width": 8,
      "height": 6,
      "properties": {
        "view": "timeSeries",
        "stacked": true,
        "metrics": [
          [ "AWS/S3", "AllRequests", { "stat": "Sum", "label": "Total Requests" } ],
          [ ".", "GetRequests", { "stat": "Sum", "label": "GET" } ],
          [ ".", "PutRequests", { "stat": "Sum", "label": "PUT" } ]
        ],
        "region": "us-east-1",
        "title": "Requests per Minute",
        "period": 60
      }
    },
    {
      "type": "metric",
      "x": 16,
      "y": 0,
      "width": 8,
      "height": 6,
      "properties": {
        "view": "timeSeries",
        "stacked": false,
        "metrics": [
          [ "AWS/S3", "5xxErrors", { "stat": "Sum", "color": "#d62728" } ]
        ],
        "region": "us-east-1",
        "title": "5xx Errors",
        "period": 300
      }
    }
  ]
}

You can create the dashboard via the AWS Console, or programmatically with boto3:

import boto3
import json

dashboard_name = "S3-Health-Dashboard"
dashboard_body = json.dumps({
    "widgets": [
        # ... paste the widgets JSON above ...
    ]
})

cw = boto3.client('cloudwatch')
cw.put_dashboard(
    DashboardName=dashboard_name,
    DashboardBody=dashboard_body
)
print("Dashboard created:", dashboard_name)

Grafana for Multi-Cloud Dashboards

Many teams use Grafana to unify storage metrics from AWS, Azure, GCP, and on-premise sources. CloudWatch data sources, Azure Monitor, and Google Cloud Monitoring can all feed into a single dashboard with templated variables for bucket or account selection.

# Example Prometheus-style query for an S3 metric in Grafana
cloudwatch_aws_s3_5xxerrors_a1e2a3b4c5d6e7f8{stat="Sum"}

Best Practices for Monitoring Cloud Storage

Putting It All Together

A complete monitoring loop for cloud storage includes metric collection (enabled via provider settings), alarm definitions for critical conditions, and a dashboard that gives both real-time and historical context. Start small: enable request metrics on your most important bucket, create an alarm on 5xx errors, and build a single-page dashboard. Expand to billing alerts and latency monitoring as your confidence grows.

Conclusion

Monitoring cloud storage is not optional—it is a core part of operating reliable, cost-efficient, and secure cloud applications. By understanding the available metrics, setting meaningful alarms, and building intuitive dashboards, you transform opaque storage services into transparent, well-governed components. Use the code examples and best practices here as a foundation, and continuously refine your observability posture as your storage footprint evolves. With the right alarms and dashboards in place, you’ll catch issues before they impact users and keep storage costs firmly under control.

🚀 Need a reliable AI agent for your project?

Deploy Hermes Agent in 10 minutes. Managed hosting, zero DevOps.

Get Started — $23.99/mo
← Back to all articles