Prometheus & Grafana Hour 4: Moving to the Cloud Platform (AWS)

Move the myapp monitoring from the first three lessons to AWS: metrics from the EKS cluster prom-lab are scraped “agentlessly” by an AMP managed collector and stored in Amazon Managed Service for Prometheus; they are viewed with Amazon Managed Grafana + IAM Identity Center; alerts go through the AMP Alertmanager to SNS; and CloudWatch metrics are added to the same dashboard
AMP · ca-central-1AMG versions 9/10/12/13ADOT Collector v0.51.0Amazon EKS 1.37Verified against docs.aws.amazon.com · 2026-11-15
Overall learning objectives
  • Draw the three AWS Prometheus monitoring architectures (self-managed kube-prometheus-stack / AMP + managed collector / AMP + ADOT or Prometheus agent), and choose among them based on team size, compliance and cost.
  • Create an AMP workspace prom-lab, understand its data-plane endpoint (aps-workspaces.ca-central-1.amazonaws.com),SigV4 signing, IAM actions (aps:RemoteWrite / aps:QueryMetrics), default 150-day retention and the main quotas.
  • Create an AMP managed collector (scraper): private endpoint, two-AZ subnets, security groups, automatic access entry authorization, custom scrape configuration (interval ≥ 30 seconds), and knowing when to use ADOT or a Prometheus agent to do remote_write.
  • Understand that AMG is not offered in ca-central-1, so place the AMG workspace in us-east-1 and query AMP across regions; IAM Identity Center assign Admin/Editor/Viewer roles, and grant data source permissions through a customer-managed workspace role.
  • Migrate the lesson 2 alerting rules to AMP rule groups namespace, and write the AMP-format Alertmanager definition (alertmanager_config: wrapper, only SNS receivers supported,sigv4.region required), and configure the SNS topic access policy to prevent the confused deputy problem.
  • Use AMP (PromQL) and CloudWatch (ALB/RDS and other AWS service metrics) together in one Grafana, and understand the OTel metrics + PromQL path that CloudWatch has offered since 2026 and its cost differences.
  • Troubleshoot typical cloud monitoring failures (403 / no targets scraped / AMG shows no data / alerts not reaching SNS), estimate costs, and clean up in the correct order so the managed collector and AMG licenses stop billing.

One-hour time allocation table

#TimeModuleCore contentAnimations / InteractiveLab (EKS prom-lab · ca-central-1)
0Before classWarm-up and EKS preparationCosts, permissions, tools; create the cluster with eksctl (private endpoint + access entry API mode); deploy myapp to the myapp namespaceEnvironment self-check listkubectl get pods -n myapp All Running
100–05Choosing a Monitoring Architecture on AWSSelf-managed vs AMP vs CloudWatch; managed collector vs ADOT vs Prometheus agent; AMG region limitsArchitecture selector (scored by requirements)Check regional availability
205–13AMP workspacecreate-workspace, endpoints, SigV4, IAM actions, retention, quotas, label set limitsSigV4 signing + remote write request path animationCreate a workspace prom-lab and query with awscurl
313–21Collection: managed collector and ADOTcreate-scraper, access entry policy, scrape configuration limits,up diagnostics; ADOT sigv4auth + prometheusremotewriteCore animation: managed collector → AMP → AMG data and identity flow (fault injection available)Create a scraper for prom-lab and scrape myapp
421–29AMG: Identity Center, permissions and data sourcesIdentity Center prerequisites, customer-managed roles, update-permissions, AMP data source plugin, cross-regionLogin and query identity chain animationCreate AMG in us-east-1 prom-lab, import the myapp dashboard
529–37AMP rules and Alertmanager to SNSRule groups namespace, Alertmanager definition format, SNS policy, templates, silencesSimulator: alert from rule evaluation to SNS emailMyappRedisDown alert delivered to the inbox
637–45Combining CloudWatch metrics with PrometheusGrafana CloudWatch data source, Container Insights, CloudWatch exporter, OTel + PromQL, AMP usage metrics“Where does this metric go?” cost comparatorShow ALB and myapp metrics on the same dashboard
745–54Hands-on troubleshooting in the cloud403 signature/permission, missing up, AMG no data, no SNS messages, throttling and rejected samplesSegmented fault reproduction simulatorReproduce and fix 4 faults
854–60Cost, cleanup and self-testAMP / collector / AMG / CloudWatch billing, cost reduction methods, cleanup orderCost calculator + cleanup order sorting + interactive troubleshooting treeComplete cleanup and verify zero leftovers
—After classCheat sheet · Comprehensive labmyapp: EKS → scraper → AMP → rules/SNS → AMG (Identity Center) → CloudWatch merge → cleanupFinal quiz (12 questions)Comprehensive lab

Knowledge Coverage Matrix

Target skillM1M2M3M4M5M6M7M8Key commandsLab
Choose an AWS monitoring architecture✓·✓··✓·✓—Regional availability check
Create and configure an AMP workspace·✓····✓✓aws amp create-workspace,update-workspace-configurationprom-lab workspace
SigV4 and IAM authorization·✓✓✓✓·✓·awscurl --service aps, Pod IdentityQuery / write verification
Managed collector scrapes EKS✓·✓···✓✓aws amp create-scrapermyapp is scraped
ADOT / agent remote_write✓✓✓···✓·sigv4auth,prometheusremotewriteOptional labs
AMG + Identity Center✓··✓·✓✓✓aws grafana create-workspace,update-permissionsus-east-1 workspace
AMP rules and alerts to SNS····✓·✓·create-rule-groups-namespace,create-alert-manager-definitionemail alerts
CloudWatch combined with Prometheus✓··✓·✓·✓aws cloudwatch get-metric-dataMixed dashboard
Cost estimation and cleanup·✓✓✓·✓·✓delete-scraper,delete-workspacezero leftovers

Topics not covered in this lesson (and where to learn them)

TopicWhy it is not in this lessonWhere to learn it
Prometheus basics: scraping, PromQL,rate(), myapp's /metricsCovered in lesson 1; this lesson reuses the metric names directlyLesson 1
Alerting rule syntax, Alertmanager routing / inhibition / silencing principlesLesson 2 topic; this lesson only covers the AMP differencesLesson 2
Azure Monitor managed Prometheus and Azure Managed GrafanaAzure editionLesson 3
kube-prometheus-stack, ServiceMonitor, OperatorLesson 5 topic (this lesson does not run Prometheus in the cluster)Lesson 5
EKS itself (VPC CNI, the full access entry model, Auto Mode)Belongs to Kubernetes on AWSKubernetes 8 hours · Helm lesson 4 (EKS)
Thanos / Mimir, long-term storage and self-built multi-cluster federationLesson 6 topicLesson 6
Managing AMP/AMG/rules with TerraformBelongs to the IaC topicTerraform 8 hours

How to use this courseware

10 pages per module
Principles · diagrams · animations · commands · labs · production cases · troubleshooting · quizzes · voice · videos. Read “Principles” and “Animations” first, then do the “Labs”. All labs incur AWS charges: read the module 0 cost notes first, and clean up according to module 8 on the day you finish.
Learning progress
A quiz score ≥ 70% or clicking “Mark this module complete” counts toward progress, saved in this browser (cleared on refresh when local storage is disabled).
Chinese voice
The “Voice” page reads the narration script aloud using the browser's built-in Web Speech API (en-US); without a Chinese voice pack you can read the narration script directly.
Version and region notes This lesson is based on official documentation verified on 2026-11-15: AMP is available in ca-central-1 (control plane aps.ca-central-1.amazonaws.com, data plane aps-workspaces.ca-central-1.amazonaws.com); the Amazon Managed Grafana service endpoint list does not include ca-central-1 (available regions include us-east-1, us-east-2, us-west-2, eu-*, ap-*, etc.), so the AMG workspace for this lesson is prom-lab created in us-east-1, querying AMP in ca-central-1 across regions. Selectable AMG Grafana versions are 9, 10, 12, 13 (v12 includes features of open-source 11.0–12.4, v13 includes 13.0–13.2). The latest ADOT Collector is v0.51.0 (2026-10-29). The EKS version follows this series' 1.37. The managed collector requires the cluster endpoint to include private access, VPC DNS enabled, and a scrape interval ≥ 30 seconds.

Module 0 · Warm-up and EKS Preparation (complete before class)

Confirm costs and permissions, install tools, use eksctl to create a cluster named prom-lab with “private + public endpoint, access entry API mode”, and deploy myapp (port 5000, with /metrics) to the myapp namespace
Before class ≈ 30 minutes (cluster creation takes about 15–20 minutes)EKS 1.37 · ca-central-1Incurs costs
Prerequisites
  • Complete Lesson 1(myapp's /metrics: myapp_http_requests_total{method,route,status},myapp_http_request_duration_seconds,myapp_redis_up) and Lesson 2(alerting rules prometheus/rules/*.yml, Alertmanager routing).
  • An AWS account that can create EKS / EC2 / VPC / IAM / ECR / AMP / AMG / SNS resources. Using AMG with IAM Identity Center requires AWS Organizations to be enabled on the account (AMG can enable it on your behalf the first time it is created). In an enterprise account, first ask an administrator whether Identity Center is enabled and whether SCPs allow it.
  • Tools: AWS CLI v2 (newer is better; the AMP managed collector commands need a recent CLI), eksctl, kubectl (within ±1 minor version of the cluster), Docker, jq, Python 3 (install awscurl).

Costs, permissions and security risks (read before you start)

ResourceBilling (order-of-magnitude estimates; see the pricing page)Notes
EKS control plane0.10 USD / hour (standard support period)Extended support costs more
2 × m6i.large nodes + NAT gatewayAbout 0.25 USD / hourThe NAT gateway is the easiest to forget
AMP managed collector0.04 USD / collector-hour + 0.03 USD / 10 million collected samplesRates from the official pricing page example; one collector running for a month has a base fee of about 29 USD
AMP write / storage / queryWrite 0.90 USD / 10 million samples (first 2 billion); storage 0.03 USD / GB-month; query 0.10 USD / 1 billion processed samplesFree tier: 40 million write samples, 200 billion query samples and 10 GB storage per month. Lab-scale usage usually stays within the free allowance
AMGEditor/Admin 9 USD, Viewer 5 USD / active user / workspace / month90-day free trial, up to 5 free users per account; the enterprise plugin adds 45 USD per user
SNS email / CloudWatch APINegligibleGrafana querying CloudWatch uses GetMetricData, billed by the number of metrics requested

Lab total about 0.4–0.5 USD / hour + AMG user licenses (free during the trial). Required permissions: The simplest option in a lab account is an Identity Center user with AdministratorAccess. Minimum permissions require eks:*, ec2:* (VPC / subnets / security groups / instances), cloudformation:* (used by eksctl), iam:CreateRole / PassRole / AttachRolePolicy / CreateServiceLinkedRole (the managed collector creates a service-linked role on first use), aps:*, grafana:*, sso:* (AMG binds to Identity Center, corresponding managed policy AWSGrafanaAccountAdministrator + AWSSSOMemberAccountAdministrator + AWSSSODirectoryAdministrator), sns:*, cloudwatch:GetMetricData. Security risks: The AMG workspace URL is publicly reachable by default (protected by Identity Center authentication); enable network access control in production, and do not give the Grafana workspace role aps:*, grant query actions only.

Step 1: check tools and identity

aws --version
eksctl version
kubectl version --client
aws sts get-caller-identity

export AWS_REGION=ca-central-1 CLUSTER=prom-lab AMG_REGION=us-east-1
export ACCT=$(aws sts get-caller-identity --query Account --output text)
export REG=$ACCT.dkr.ecr.$AWS_REGION.amazonaws.com
echo "$ACCT $REG"
aws-cli/2.x.x Python/3.x Linux/6.x
0.2xx.0
Client Version: v1.37.x
{
    "UserId": "AROAEXAMPLE:andy",
    "Account": "111122223333",
    "Arn": "arn:aws:sts::111122223333:assumed-role/AWSReservedSSO_Admin_xxxx/andy"
}
111122223333 111122223333.dkr.ecr.ca-central-1.amazonaws.com

Step 2: create prom-lab with eksctl (private endpoint + access entries)

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: prom-lab
  region: ca-central-1
  version: "1.37"
accessConfig:
  authenticationMode: API_AND_CONFIG_MAP   # managed collector requires API or API_AND_CONFIG_MAP
vpc:
  clusterEndpoints:
    privateAccess: true                    # managed collector requires the endpoint to “include private access”
    publicAccess: true                     # keep public access for kubectl from this machine
addons:
  - name: vpc-cni
  - name: coredns
  - name: kube-proxy
  - name: eks-pod-identity-agent           # optional lab: ADOT uses Pod Identity to write to AMP
managedNodeGroups:
  - name: ng-base
    instanceType: m6i.large
    desiredCapacity: 2
    minSize: 2
    maxSize: 3
    privateNetworking: true
eksctl create cluster -f prom-lab.yaml          # about 15–20 minutes
kubectl get nodes
aws eks describe-cluster --name $CLUSTER \
  --query '{auth:cluster.accessConfig.authenticationMode,private:cluster.resourcesVpcConfig.endpointPrivateAccess,sg:cluster.resourcesVpcConfig.clusterSecurityGroupId,subnets:cluster.resourcesVpcConfig.subnetIds}'
NAME                                             STATUS   ROLES    AGE   VERSION
ip-192-168-101-23.ca-central-1.compute.internal  Ready    <none>   3m    v1.37.x-eks-xxxx
ip-192-168-140-77.ca-central-1.compute.internal  Ready    <none>   3m    v1.37.x-eks-xxxx
{
    "auth": "API_AND_CONFIG_MAP",
    "private": true,
    "sg": "sg-0abc1234def567890",
    "subnets": ["subnet-0aaa...", "subnet-0bbb...", "subnet-0ccc...", "subnet-0ddd..."]
}
Why must the private endpoint be enabled? The managed collector creates elastic network interfaces (ENIs) in the subnets you specify, reaches the Kubernetes API from inside the VPC for service discovery, and then scrapes Pod IPs directly. The official documentation explicitly requires “cluster endpoint access control must include private access” and VPC DNS to be enabled. eksctl only enables the public endpoint by default, so it is set explicitly here: privateAccess: true For an existing cluster, you can use aws eks update-cluster-config --resources-vpc-config endpointPrivateAccess=true to modify it.

Step 3: deploy myapp and Redis (reuse the images from earlier lessons)

aws ecr create-repository --repository-name myapp --region $AWS_REGION 2>/dev/null || true
aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $REG
cd ~/promlab/myapp          # myapp source directory with /metrics added in lesson 1 (port 5000)
docker build -t $REG/myapp:1.1 --build-arg APP_VERSION=1.1 .
docker push $REG/myapp:1.1
apiVersion: v1
kind: Namespace
metadata: { name: myapp }
---
apiVersion: apps/v1
kind: Deployment
metadata: { name: redis, namespace: myapp }
spec:
  replicas: 1
  selector: { matchLabels: { app: redis } }
  template:
    metadata: { labels: { app: redis } }
    spec:
      containers:
        - name: redis
          image: public.ecr.aws/docker/library/redis:7
          ports: [{ containerPort: 6379 }]
---
apiVersion: v1
kind: Service
metadata: { name: redis, namespace: myapp }
spec: { selector: { app: redis }, ports: [{ port: 6379 }] }
---
apiVersion: apps/v1
kind: Deployment
metadata: { name: myapp, namespace: myapp }
spec:
  replicas: 2
  selector: { matchLabels: { app: myapp } }
  template:
    metadata:
      labels: { app: myapp }
    spec:
      containers:
        - name: myapp
          image: ACCOUNT.dkr.ecr.ca-central-1.amazonaws.com/myapp:1.1
          env:
            - { name: REDIS_HOST, value: redis }
            - { name: PROMETHEUS_MULTIPROC_DIR, value: /tmp/prom }   # gunicorn multi-process mode
          ports: [{ name: http, containerPort: 5000 }]
          readinessProbe: { httpGet: { path: /healthz, port: 5000 } }
          volumeMounts: [{ name: prom, mountPath: /tmp/prom }]
      volumes: [{ name: prom, emptyDir: {} }]
---
apiVersion: v1
kind: Service
metadata: { name: myapp, namespace: myapp, labels: { app: myapp } }
spec: { selector: { app: myapp }, ports: [{ name: http, port: 5000, targetPort: http }] }
sed "s/ACCOUNT/$ACCT/" myapp-eks.yaml | kubectl apply -f -
kubectl -n myapp rollout status deploy/myapp
kubectl -n myapp port-forward svc/myapp 5000:5000 &
curl -s localhost:5000/healthz; curl -s localhost:5000/metrics | grep -E '^myapp_(redis_up|http_requests_total)' | head -3
deployment "myapp" successfully rolled out
ok
myapp_redis_up 1.0
myapp_http_requests_total{method="GET",route="/healthz",status="200"} 3.0

This lesson does not run Prometheus in the cluster: scraping is done outside the cluster by the AMP managed collector (module 3), so no ServiceMonitor is needed, and no prometheus.io/scrape annotations are needed; which Pods get scraped is fully determined by the collector's scrape_configs + relabel.

Step 4: install awscurl (for querying AMP with SigV4 signing)

python3 -m pip install --user awscurl
awscurl --version

Warm-up: answer from memory (30 seconds)

rate(myapp_http_requests_total[5m]) Why must the window cover at least 4 scrape intervals?

rate needs at least two samples within the window and extrapolates at the boundaries (lesson 1). The managed collector's minimum scrape interval is 30 seconds, so a [1m] window contains only about 2 samples and the results fluctuate heavily; this lesson uses [5m] consistently.

Which field controls the transition from pending to firing? Who handles grouping and sending notifications?

The rule's for: controls the pending duration. Alertmanager handles grouping (group_by / group_wait), inhibition, silences and sending (lesson 2). In AMP, both parts are run by the managed service, and you only upload two files: the “rule groups namespace” and the “Alertmanager definition”.

When a Pod accesses AWS APIs, what is the fundamental difference between EKS Pod Identity and IRSA?

IRSA adds an eks.amazonaws.com/role-arn annotation to the ServiceAccount and exchanges credentials through the cluster's OIDC provider. Pod Identity mappings are stored as “associations” in the EKS API, credentials are delivered by the Pod Identity Agent, and the SA has no annotation. Both let the SDK obtain temporary credentials, which are then used for SigV4 signing.

Environment self-check list

Module 1 · Choosing a Monitoring Architecture on AWS

00:00 – 05:00 · Collection, storage, visualization and alerting: each stage can be “self-managed” or “managed”. First understand the boundaries and regional limits
5 minutesAMP / AMG GAAMG is not in ca-central-1★★★★☆
Learning objectives
  • Name the four stages of Prometheus monitoring on AWS (collection → storage/query → alerting → visualization) and the self-managed and managed options for each.
  • Compare three mainstream architectures: self-managed kube-prometheus-stack in the cluster,AMP + managed collector + AMG,AMP + ADOT/Prometheus agent + AMG, and know where CloudWatch fits in.
  • Know the regional limits: AMP is available in ca-central-1, AMG is not, and the managed collector requires the EKS cluster, collector and workspace to be in the same region.
Prerequisites: Lesson 1 Prometheus architecture; lesson 3 Azure managed solution (for comparison). Importance:★★★★☆

What: splitting Prometheus into four stages

A standalone Prometheus puts “scraping, storage, rule evaluation, querying” in a single process, with Alertmanager and Grafana as external components. AWS's managed solution splits these and manages them separately:

StageSelf-managed (lessons 1, 2, 5)AWS managedUse in this lesson
CollectionPrometheus server / agent scrapes inside the clusterAMP managed collector (scraper): agentless, ENI placed in your VPC; or ADOT (AWS-distributed OpenTelemetry Collector)Managed collector as the main option, ADOT optional
Storage and queryLocal TSDB (15 days by default) + Thanos/Mimir (lesson 6)Amazon Managed Service for Prometheus (AMP): compatible with remote write and the PromQL query API; default retention 150 days (configurable 1–1095 days)Workspace prom-lab
Rules and alertsPrometheus rules + AlertmanagerAMP Rule groups namespace + AMP Alertmanager (receivers support SNS only)SNS → email
VisualizationGrafana OSSAmazon Managed Grafana (AMG): Identity Center / SAML login, Grafana 9/10/12/13us-east-1 workspace prom-lab
AWS service metricsCloudWatch Exporter / YACE pullsCloudWatch (native); since 2026 CloudWatch also supports OTel metrics and PromQL queriesAdd the CloudWatch data source directly in Grafana

Why: why use managed services

  • Capacity and high availability: AMP is backed by a multi-AZ Cortex architecture; a single workspace supports 50 million active series by default (higher on request), and you no longer manage TSDB disks, compaction or replicas.
  • Unified identity: Writes and queries both use IAM + SigV4, so there is no need for a basic-auth reverse proxy in front of Prometheus. Grafana logins use Identity Center, so access ends as soon as someone leaves.
  • One fewer component to upgrade: The managed collector does not run Pods in the cluster at all, so the monitoring stack does not fail first during a cluster upgrade.

How: how to choose among the three architectures

A. Self-managed kube-prometheus-stack in the clusterB. AMP + managed collector + AMGC. AMP + ADOT / Prometheus agent + AMG
In-cluster componentsPrometheus, Alertmanager, Grafana, OperatorNone (only access entry authorization)ADOT Collector or Prometheus agent
Configuration methodServiceMonitor / PodMonitor CRDPrometheus-format scrape_configs (uploaded as base64), supporting only kubernetes_sd_configsfull Prometheus receiver configuration, or ServiceMonitor (Prometheus Operator agent mode)
LimitsYou are responsible for capacity and HAScrape interval ≥ 30 seconds; static targets can only use IPs; 10 collectors per region per account (can be raised); a single /metrics response ≤ 50 MBYou must give Pods IAM (Pod Identity / IRSA) and resources yourself
CostNodes + EBS0.04 USD / collector-hour + 0.03 USD / 10 million collected samples + AMP write / storage / queryNode resources + AMP write / storage / query
Suited toOffline, consistent multi-cloud, heavy customizationStandard metrics on EKS, zero operations wantedNeed OTLP, traces, a more flexible processing pipeline, or non-EKS sources

When: key selection points

  • EKS only with standard requirements → B; needs 10-second scraping, complex processing (filter / transform processors) and trace collection → C; offline or strong multi-cloud consistency → A (lesson 5).
  • Metrics for AWS managed services (RDS, ALB, SQS, …) live in CloudWatch. Do not try to re-collect a copy with Prometheus; query CloudWatch directly in Grafana (module 6).
  • Region: EKS, the managed collector and the AMP workspace must be in the same region; AMG is only a query front end and can sit in another region.
Common misconceptions① “The managed collector means AWS installed a Prometheus in my cluster for me”: no. There are no collector Pods in the cluster; it reaches the cluster from outside via ENIs. ② “AMG and AMP must be in the same region”: no. The AMG data source sends SigV4 requests based on region and workspace ID, so cross-region queries work (with a small amount of cross-region traffic). ③ “AMP comes with a Grafana UI”: no. AMP only has an API; you need AMG or a self-managed Grafana to query it.

Architecture diagram: this lesson's target architecture

Region ca-central-1 EKS cluster prom-lab (VPC) myapp ×2 :5000/metrics · redis kube-apiserver (private endpoint) Managed collector ENI ×2Two subnets · cluster security group AMP workspace prom-lab remote_write · PromQL API Rule groups namespace myapp Alertmanager definition Retained 150 days (default) SigV4 SNS prom-lab-alerts→ Email / Lambda / Chatbot CloudWatchALB / EC2 / EKS control plane metrics Region us-east-1 AMG workspace prom-labData source: AMP (ca-central-1)Data source: CloudWatchWorkspace role prom-lab-grafana-role IAM Identity CenterUsers / groups → Admin / Editor / Viewer Query Login
Figure 1-1 Collection and storage in ca-central-1; AMG sits in us-east-1 because of regional limits and queries across regions

Decision diagram: choosing a collection method

Metric sourceEKS / EC2 / other EKS and only Prometheus metrics neededIs a 30-second interval enough? Yes → AMP managed collector (agentless)create-scraper · automatic access entry authorization Need OTLP / traces / processing pipeline → ADOT Collectorsigv4auth + prometheusremotewrite Already have Prometheus / Operator → agent mode remote_writesigv4: region · Pod Identity/IRSA
Figure 1-2 Three ways to write to AMP; storage and querying are identical

Interactive: architecture selector

Tick your requirements. On the right, the three architectures are scored on “fit / operational effort / typical monthly cost”, and the log shows starter commands. The scoring rules come from the comparison table on the “Principles” page.

Tick requirements to see a recommendation.
$ # Starter commands for the recommended option appear here

Core commands: confirm regional availability and existing resources

CommandPurposeNotes
aws amp list-workspaces --region ca-central-1List AMP workspacesReturns a result (even if empty), showing that the region has an AMP endpoint
aws grafana list-workspaces --region ca-central-1Verify AMG regionca-central-1 has no grafana endpoint, so it reports that the endpoint cannot be reached
aws amp list-scrapersList managed collectorsDefault maximum is 10 per region per account
aws eks describe-cluster --name $CLUSTERCheck the authentication mode and private endpointPrerequisites for the managed collector
aws service-quotas list-service-quotas --service-code apsCheck AMP quotasActive series, write rate, rule count, etc.
aws amp list-workspaces --region ca-central-1 --query 'workspaces[].{alias:alias,id:workspaceId,status:status.statusCode}'
aws grafana list-workspaces --region ca-central-1 2>&1 | head -2
aws grafana list-workspaces --region us-east-1 --query 'workspaces[].{name:name,id:id,ver:grafanaVersion}'
[]

Could not connect to the endpoint URL: "https://grafana.ca-central-1.amazonaws.com/workspaces"
[]

How to verify: The error from the second command proves that AMG has no service endpoint in ca-central-1 (consistent with the AWS service endpoint table). Common errors: Confusing AMG's data residency requirement with AMP. AMG only caches dashboards and configuration; metric data stays in AMP in ca-central-1. If compliance requires that “the query interface must also be in Canada”, switch to a self-managed Grafana (for example Grafana OSS inside EKS, using the AMP data source plugin + SigV4). Production use: Record regional availability in an architecture decision record (ADR).

Lab 1: write an architecture decision record for prom-lab monitoring (about 4 minutes)

Confirm regional endpoints: run the three commands on the “Commands” page and record the regions where AMP and AMG are available.
Confirm the cluster meets the managed collector prerequisites:
aws eks describe-cluster --name $CLUSTER --query 'cluster.{auth:accessConfig.authenticationMode,priv:resourcesVpcConfig.endpointPrivateAccess,vpc:resourcesVpcConfig.vpcId}'
VPC=$(aws eks describe-cluster --name $CLUSTER --query cluster.resourcesVpcConfig.vpcId --output text)
aws ec2 describe-vpc-attribute --vpc-id $VPC --attribute enableDnsSupport --query EnableDnsSupport.Value
{ "auth": "API_AND_CONFIG_MAP", "priv": true, "vpc": "vpc-0123abcd" }
true
Fill in the ADR:
Decision: prom-lab uses architecture B (AMP + managed collector + AMG)
Collection: AMP managed collector, 30 s interval, scrapes only the myapp namespace + kube-state-type metrics
Storage: AMP workspace prom-lab (ca-central-1), 150-day retention (default)
Alerting: AMP rule groups namespace myapp + Alertmanager → SNS prom-lab-alerts
Visualization: AMG workspace prom-lab (us-east-1, because AMG is not in ca-central-1), Identity Center login
AWS service metrics: CloudWatch data source (no duplicate collection)
Alternative: add ADOT when OTLP/traces are needed; for offline environments, return to lesson 5's kube-prometheus-stack
Think about it: if compliance requires all monitoring components to stay inside Canada, which stage must change? (Answer: visualization. Switch to a self-managed Grafana or evaluate other regional strategies; AMP and the collector are already in ca-central-1.)

Case 1: Prometheus disks running out across 30 EKS clusters

Problem: Each cluster runs one kube-prometheus-stack with 30-day retention; PVs fill up frequently, and rules are occasionally lost when the Operator is upgraded. Approach: Create AMP workspaces per environment (prod / nonprod); each cluster writes via the managed collector, and rules are uploaded centrally to AMP. Clusters keep only the exporters the business needs. Limits: The managed collector's minimum interval is 30 seconds, so SLO rules that were originally based on 15-second scraping must be adjusted to a rate() window. The default quota of 10 collectors per region must be raised in advance.

Case 2: data residency and the AMG region

Problem: A Canadian public-sector customer requires data to stay in-country, but AMG is not available in ca-central-1. Approach: Metric data (AMP) stays in ca-central-1. Visualization moves to Grafana OSS running inside EKS (installed with Helm, using the Amazon Managed Service for Prometheus data source plugin + Pod Identity to sign SigV4), with SSO through Identity Center / SAML. Limits: A self-managed Grafana means you handle upgrades, backups and high availability yourself.

Case 3: duplicate collection of RDS metrics

Problem: A team deployed CloudWatch Exporter to pull all RDS metrics into Prometheus, and GetMetricData costs hundreds of dollars a month. Approach: Import only the small set of metrics that must take part in joint PromQL calculations (for example, a ratio against the application error rate). Query the rest directly from CloudWatch in Grafana. Configuration: see module 6.

Common errors and fixes

Could not connect to the endpoint URL: "https://grafana.ca-central-1.amazonaws.com/workspaces"

Cause: AMG has no service endpoint in this region.

aws grafana list-workspaces --region us-east-1

Fix: Create AMG in a supported region (us-east-1 in this lesson), and in the data source specify AMP's region as ca-central-1.

create-scraper reports ValidationException: cluster endpoint private access must be enabled (or the collector stays in CREATING and then goes to CREATION_FAILED)

Cause: The cluster endpoint only has public access enabled, or VPC DNS is not enabled. Use the exact wording of the error returned in your environment.

aws eks describe-cluster --name $CLUSTER --query cluster.resourcesVpcConfig.endpointPrivateAccess
aws eks update-cluster-config --name $CLUSTER --resources-vpc-config endpointPrivateAccess=true,endpointPublicAccess=true
ServiceQuotaExceededException: creating the 11th scraper failed

Cause: The default maximum is 10 managed collectors per region per account.

aws amp list-scrapers --query 'length(scrapers)'

Fix: Delete collectors you no longer use, or request a quota increase through Service Quotas. One cluster usually needs only one collector.

The managed collector can see Pods, but the RDS metrics in CloudWatch are “not found”

Cause: The managed collector only supports kubernetes_sd_configs (and IP-based static targets); it does not pull from CloudWatch.

Fix: Add the CloudWatch data source in Grafana, or import a small set of metrics with CloudWatch Exporter / YACE (module 6).

Command-line tasks
1. Use one command to check whether prom-lab meets the managed collector's authentication mode and private endpoint requirements.
aws eks describe-cluster --name prom-lab --region ca-central-1 \
  --query 'cluster.{auth:accessConfig.authenticationMode,private:resourcesVpcConfig.endpointPrivateAccess}'
2. Count how many managed collectors already exist in the current region.
aws amp list-scrapers --region ca-central-1 --query 'length(scrapers)'
Scenario analysis
A team needs to monitor a high-frequency trading service with a 10-second scrape interval, wants zero operations, and also needs to collect OTLP traces. How should this be designed?

The managed collector's minimum is 30 seconds, so it cannot meet 10 seconds, and traces are outside its scope. Use architecture C: ADOT Collector (deployment or daemonset mode), with the prometheus receiver scraping the high-frequency service every 10 seconds and the OTLP receiver collecting traces. Metrics are sent using prometheusremotewrite + sigv4auth to write to AMP, and traces go to X-Ray / CloudWatch. Other ordinary services can still be scraped every 30 seconds by the managed collector, converging on the same workspace. Note that 10-second scraping triples the number of written samples, so costs need to be evaluated.

Verified instructional videos

▶
AWS re:Invent 2022 - Observability the open-source way (COP301-R) — AWS Events
English · Overview of AWS open-source observability: how AMP, AMG and ADOT divide the work (recorded earlier; functionality follows this lesson)
▶
AWS re:Invent 2025 - Scaling open source observability stack feat. Warner Bros Discovery (COP333) — AWS Events
English · Large-scale open-source observability architecture in practice
▶
Monitoring container workloads with Amazon Managed Service for Prometheus and Grafana — Containers from the Couch
English · End-to-end demo of AMP + AMG for container workloads

Official documentation

Video storyboard script (about 75 seconds)

This courseware cannot directly generate video / MP3; the storyboard below can be handed to a video tool.

Shot 1 · 0–20s
Visual: a single standalone Prometheus is split into four blocks (collection, storage, alerting, visualization), each with an AWS managed icon beside it.
Narration: On AWS, all four stages of Prometheus can be managed: the managed collector, AMP, AMP alerting, and Amazon Managed Grafana.
Shot 2 · 20–50s
Visual: on a map, ca-central-1 lights up EKS and AMP, us-east-1 lights up AMG, and a dashed line labeled “query” runs between them.
Narration: Note the regions. AMP is available in central Canada and AMG is not, so Grafana sits in the US East region and queries across regions.
Shot 3 · 50–75s
Visual: three cards A / B / C side by side, with card B highlighted as “agentless”.
Narration: For standard EKS metrics, use the managed collector. For OTLP or 10-second scraping, use ADOT. For offline or multi-cloud, return to Prometheus inside the cluster.
or score ≥ 70% in the quiz

Module 2 · Amazon Managed Service for Prometheus Workspace

05:00 – 13:00 · One workspace = one managed “Prometheus storage + query + rules + Alertmanager” tenant. All reads and writes use IAM + SigV4.
8 minutesDefault retention 150 days (configurable 1–1095 days)Samples older than 1 hour are rejected★★★★★
Learning objectives
  • Create, view and configure AMP workspaces with the CLI prom-lab, and read the workspace ARN and endpoints.
  • Explain the SigV4 signing process (service name aps, region, credential scope) and the IAM actions (aps:RemoteWrite,aps:QueryMetrics , etc.) and managed policies.
  • Remember the key quotas that affect design: active series, write rate, labels per series, query sample limits, out-of-order window and sample age. Use label set limits to protect the workspace.
Prerequisites: Lesson 1 TSDB and remote_write; IAM basics. Importance:★★★★★

What: what a workspace is

An AMP workspace is a logically isolated Prometheus tenant. Its ID looks like ws-1234abcd-..., and its ARN looks like arn:aws:aps:ca-central-1:111122223333:workspace/ws-.... It offers two kinds of API:

CategoryEndpointExampleIAM action
Control plane (AWS API)aps.ca-central-1.amazonaws.comCreateWorkspace, CreateScraper, CreateRuleGroupsNamespace, PutAlertManagerDefinitionaps:CreateWorkspace etc.
Data plane (Prometheus-compatible API)aps-workspaces.ca-central-1.amazonaws.com/workspaces/ws-…/api/v1/remote_write,/api/v1/query,/api/v1/query_range,/api/v1/series,/api/v1/labels,/api/v1/rules,/api/v1/alerts,/alertmanager/api/v2/…aps:RemoteWrite,aps:QueryMetrics,aps:GetSeries,aps:GetLabels,aps:GetMetricMetadata,aps:ListRules,aps:ListAlerts …

Commonly used managed policies: AmazonPrometheusRemoteWriteAccess (write-only, for the collection side),AmazonPrometheusQueryAccess (read-only query, for Grafana),AmazonPrometheusFullAccess,AmazonPrometheusConsoleFullAccess. In production, write custom policies and restrict Resource to specific workspace ARNs.

Why: why everything must be signed

The data plane does not accept usernames and passwords or bearer tokens. Every HTTP request must carry AWS Signature Version 4: the client signs the request method, path, query string, key headers and body hash with HMAC-SHA256, using temporary credentials (Pod Identity / IRSA / instance role / SSO). The scope is date/region/aps/aws4_request. The server recomputes the signature and uses IAM to check whether this identity has the matching action on this workspace ARN. Benefits: no shared secrets, auditable (CloudTrail records control-plane calls), and permissions scoped down to the workspace.

How: key quotas and limits (defaults, verified 2026-11)

ItemDefaultAdjustableDesign implication
Active series per workspace50,000,000 (2M–50M, adjusted automatically based on usage over the last 30 minutes)Yes (up to 1.5 billion)A series counts as active if it has samples within 2 hours
Write rate per workspace1,666,666 samples/secondYesAutomatically 1/30 of the active series limit
Labels per series150YesTotal label size limit 7 KB (not adjustable)
Sample ageSamples older than 1 hour are rejectedNoData backlogged on the collection side for more than 1 hour is lost
Out-of-order windowNew workspace 60 seconds, maximum 600 secondsYes--out-of-order-time-window-in-seconds
Single queryPer 24-hour range, at most 50 million samples, 12 million series and 5 GB scanned; time range up to 95 daysNoPre-aggregate long-range dashboards with recording rules
QueryMetrics TPS300 / workspaceYesWatch out when many Grafana users refresh
Rules2000 per workspace, minimum evaluation interval 30 secondsYesModule 5
Number of workspaces25 per regionYesDivide by environment / team

When: how to divide workspaces

  • By environment (prod / nonprod) is the most common split: permissions, alert routing and retention all differ.
  • Within one workspace, use cluster external labels to tell clusters apart; cross-workspace queries can use Grafana mixed data sources.
  • Use label set limits (--limits-per-label-set) to cap active series per team / namespace, so one team's cardinality explosion cannot drag down the whole workspace (lesson 7 covers cardinality in detail).
Common misconceptions① “AMP is one big Prometheus, so I can open the 9090 UI directly”: there is no UI, only an API. ② “remote_write failures retry until they succeed”: AMP rejects samples older than 1 hour, and data backlogged for more than 1 hour in the collector's WAL is discarded. ③ “Giving the Grafana role AmazonPrometheusFullAccess is the easiest option”: this would allow deleting the workspace; Grafana only needs query actions.

Diagram: the stages a remote write request passes through

Collection sideCollector / ADOT / agentprotobuf + snappy Credential providerSLR / Pod Identity / IRSATemporary AK/SK/Token SigV4 signingCanonical request → string to signScope date/ca-central-1/aps aps-workspaces endpointSignature verification + IAM authorizationaps:RemoteWrite on ws ARN HTTPS Distribution and validationLabel count / size / ageSeries and rate limits Multi-AZ storageRetained 150 days (default)Queryable with PromQL Failure responses403 signature / permission · 400 invalid samples429 throttling (the collection side retries)
Figure 2-1 Write path: signing happens on the client, authorization happens at the AMP endpoint, and limits are checked during distribution

Diagram: the four steps of SigV4 signing

① Canonical requestPOST/workspaces/ws-…/api/v1/remote_writehost;x-amz-date;…SHA256(body) ② String to signAWS4-HMAC-SHA25620261115T080000Z20261115/ca-central-1/aps/aws4_requestSHA256(①) ③ Signing keyHMAC(“AWS4”+SK, date)→ region → service aps→ aws4_requestsignature = HMAC(key, ②) ④ Request headersAuthorization:Credential=ASIA…/…/aps/…SignedHeaders=…x-amz-security-token
Figure 2-2 Writing the wrong region (for example us-east-1) makes the server compute a different signature → 403

Animation: the life of a remote write request (fault injection available)

Choose a scenario and play. Under each step, the real configuration, HTTP headers or API responses are shown.

Scenario:
After choosing a scenario, click “Play” or “Next”.
$ # Logs

Core commands

CommandPurposeKey parameters
aws amp create-workspaceCreate workspace--alias,--kms-key-arn (customer-managed key, can only be specified at creation),--tags
aws amp wait workspace-activewait for ACTIVE--workspace-id
aws amp describe-workspaceView endpoint and statusprometheusEndpoint Field
aws amp describe-workspace-configuration / update-workspace-configurationRetention, label set limits, out-of-order window, rule query offset--retention-period-in-days,--limits-per-label-set,--out-of-order-time-window-in-seconds,--rule-query-offset-in-seconds
aws amp update-workspace-aliasChange aliasAliases are not unique; use the ID in scripts
awscurl --service aps --region …Call the data plane with signingQuery, view rules, view alerts
aws amp delete-workspaceDelete workspace (including all data)Not recoverable
WS_ID=$(aws amp create-workspace --alias prom-lab --tags project=prom-lab --query workspaceId --output text)
aws amp wait workspace-active --workspace-id $WS_ID
aws amp describe-workspace --workspace-id $WS_ID \
  --query 'workspace.{id:workspaceId,arn:arn,status:status.statusCode,endpoint:prometheusEndpoint}'
export WS_ID WS_ARN=$(aws amp describe-workspace --workspace-id $WS_ID --query workspace.arn --output text)
export AMP_EP=https://aps-workspaces.$AWS_REGION.amazonaws.com/workspaces/$WS_ID
{
    "id": "ws-1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
    "arn": "arn:aws:aps:ca-central-1:111122223333:workspace/ws-1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
    "status": "ACTIVE",
    "endpoint": "https://aps-workspaces.ca-central-1.amazonaws.com/workspaces/ws-1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d/"
}
# View and modify workspace configuration
aws amp describe-workspace-configuration --workspace-id $WS_ID
aws amp update-workspace-configuration --workspace-id $WS_ID --retention-period-in-days 30
# Label set limit: at most 200,000 active series for the myapp namespace
aws amp update-workspace-configuration --workspace-id $WS_ID \
  --limits-per-label-set 'limits={maxSeries=200000},labelSet={namespace=myapp}'
{
    "workspaceConfiguration": {
        "status": { "statusCode": "ACTIVE" },
        "retentionPeriodInDays": 150
    }
}
{ "status": { "statusCode": "UPDATING" } }
# Query with awscurl (there is no data yet, so the result is empty)
awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/query?query=up"
awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/labels"
# PromQL containing { } " and spaces must be URL-encoded first; lab 2 writes the helper tool ampq into ~/promlab/aws.env
ampq(){ awscurl --service aps --region $AWS_REGION \
  "$AMP_EP/api/v1/query?query=$(python3 -c 'import sys,urllib.parse;print(urllib.parse.quote(sys.argv[1]))' "$1")"; }
ampq 'count by (job) (up)'
{"status":"success","data":{"resultType":"vector","result":[]}}
{"status":"success","data":[]}

How to verify:describe-workspace Status is ACTIVE, and awscurl returns "status":"success". Common errors: awscurl's --service written as amp (the signing service name is aps) → 403; missing the /workspaces/ws-… prefix in the URL → 404. Production use: Adjust retention to compliance requirements (shortening it lowers storage costs); label set limits stop a single team from exhausting the quota.

Lab 2: create the prom-lab workspace and write one sample manually (about 7 minutes)

Create workspace: run the first section of the “Commands” page and record WS_ID,WS_ARN,AMP_EP (it is recommended to write ~/promlab/aws.env, source for use in later modules).
cat > ~/promlab/aws.env <<EOF
export AWS_REGION=ca-central-1 CLUSTER=prom-lab AMG_REGION=us-east-1 ACCT=$ACCT
export WS_ID=$WS_ID WS_ARN=$WS_ARN AMP_EP=$AMP_EP
EOF
cat >> ~/promlab/aws.env <<'EOF'
ampq(){ awscurl --service aps --region $AWS_REGION \
  "$AMP_EP/api/v1/query?query=$(python3 -c 'import sys,urllib.parse;print(urllib.parse.quote(sys.argv[1]))' "$1")"; }
EOF
Verify the default retention: aws amp describe-workspace-configuration --workspace-id $WS_ID --query workspaceConfiguration.retentionPeriodInDays, should be 150.
Write one sample using a local temporary Prometheus (agent mode): verify the chain “your identity + SigV4 + aps:RemoteWrite”.
global:
  scrape_interval: 15s
  external_labels: { cluster: laptop }
scrape_configs:
  - job_name: self
    static_configs: [{ targets: ['localhost:9090'] }]
remote_write:
  - url: https://aps-workspaces.ca-central-1.amazonaws.com/workspaces/WS_ID/api/v1/remote_write
    sigv4:
      region: ca-central-1          # without access_key, the default credential chain is used (environment variables / ~/.aws / SSO)
sed -i "s/WS_ID/$WS_ID/" ~/promlab/aws-agent.yml
eval "$(aws configure export-credentials --format env)"    # export the current SSO session credentials as environment variables
docker run --rm -d --name aws-agent -p 9091:9090 \
  -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_REGION \
  -v ~/promlab/aws-agent.yml:/etc/prometheus/prometheus.yml:ro \
  prom/prometheus --config.file=/etc/prometheus/prometheus.yml --agent
sleep 60
source ~/promlab/aws.env && ampq 'up{cluster="laptop"}'
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","cluster":"laptop","instance":"localhost:9090","job":"self"},"value":[1763193600,"1"]}]}}

The image uses the current stable release of the official Prometheus image (3.x; follow the version verified in lesson 1); --agent mode does not keep a local TSDB; it only scrapes and does remote_write.

Fault drill: change sigv4.region to us-east-1 , restart the container, and docker logs aws-agent should appear; 403 change it back to restore.
Cleanup: docker rm -f aws-agent; use unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN to clear the exported temporary credentials (keep the workspace for later modules).

Case 1: separate prod / nonprod workspaces + least privilege

Problem: All clusters write to one workspace, and high-cardinality metrics from the test environment affect production alert queries. Approach: Split into prod and nonprod two workspaces; the collector role's policy Resource only writes to the corresponding workspace ARN, and the Grafana role gets query actions only. Configuration:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["aps:RemoteWrite"],
    "Resource": "arn:aws:aps:ca-central-1:111122223333:workspace/ws-PROD-ID"
  }]
}

Case 2: label set limits stop a cardinality explosion

Problem: A team put user_id into a label, and active series jumped by 30 million within an hour. Approach: For each team namespace, set --limits-per-label-set, so new series over the limit are rejected, affecting only that team. Also set alarms on the AMP usage metrics in CloudWatch (module 6). Limit: Each workspace can have at most 100 label set limits.

Case 3: compliance requires a customer-managed key

Problem: Audit requires metric data to be encrypted with the organization's own KMS key. Approach: Pass --kms-key-arn when creating the workspace (it cannot be changed later). The managed collector writing to this kind of workspace needs --role-configuration (source and target roles in the same account). Limit: Disabling the key causes writes and queries to fail.

Common errors and fixes

server returned HTTP status 403 Forbidden: {"message":"The request signature we calculated does not match the signature you provided..."}

Cause: The signing region or service name does not match the endpoint (for example sigv4.region: us-east-1 writing to the ca-central-1 endpoint), or the system clock is too far off.

grep -A3 sigv4 prometheus.yml
date -u; curl -sI https://aps-workspaces.ca-central-1.amazonaws.com | grep -i '^date'

Fix: Make the region match the region in the URL; for awscurl use --service aps; sync NTP.

403 {"message":"User: arn:aws:sts::111122223333:assumed-role/xxx is not authorized to perform: aps:RemoteWrite on resource: arn:aws:aps:ca-central-1:...:workspace/ws-..."}

Cause: The identity is correct but lacks permission, or the policy's Resource points to a different workspace.

aws iam simulate-principal-policy --policy-source-arn arn:aws:iam::$ACCT:role/ROLE \
  --action-names aps:RemoteWrite --resource-arns $WS_ARN --query 'EvaluationResults[].EvalDecision'

Fix: Attach AmazonPrometheusRemoteWriteAccess or a custom policy.

400 Bad Request: err: out of bounds / sample timestamp too old

Cause: After a network outage on the collection side, the backlog replays samples older than 1 hour (or outside the out-of-order window).

Fix: This data cannot be written, so accept the gap. Shorten the collector outage, or raise --out-of-order-time-window-in-seconds if needed (maximum 600 seconds; this only handles minor out-of-order data).

429 Too Many Requests / limit exceeded: per-labelset series limit

Cause: Write rate, active series or label set limits were triggered.

aws amp describe-workspace-configuration --workspace-id $WS_ID
aws service-quotas list-service-quotas --service-code aps --query 'Quotas[].[QuotaName,Value]' --output table

Fix: First find the source of the cardinality (topk(10, count by (__name__)({__name__=~".+"})), lesson 7), then decide whether to request a higher limit or drop labels.

Command-line tasks
1. Use awscurl to query the current value of myapp_redis_up in the prom-lab workspace.
awscurl --service aps --region ca-central-1 \
  "https://aps-workspaces.ca-central-1.amazonaws.com/workspaces/$WS_ID/api/v1/query?query=myapp_redis_up"
2. Change the workspace retention to 90 days and confirm that it takes effect.
aws amp update-workspace-configuration --workspace-id $WS_ID --retention-period-in-days 90
aws amp describe-workspace-configuration --workspace-id $WS_ID --query workspaceConfiguration.retentionPeriodInDays
Scenario analysis
An EKS cluster lost network connectivity for 90 minutes and then recovered. ADOT logs show many 400 errors, and the dashboards have gaps. Explain the cause and suggest improvements.

AMP rejects samples older than 1 hour, so the first 30 minutes of the backlog cannot be written, which leaves a gap that cannot be backfilled. Improvements: ① key alerts should not rely on “backfilling”; pair them with a heartbeat alert on the collection side or the CloudWatch side (such as absent_over_time(up{cluster="x"}[5m])); ② network redundancy (a VPC endpoint com.amazonaws.ca-central-1.aps-workspaces to avoid depending on the public internet); ③ accept short gaps and handle them in SLO calculations (lesson 6).

Verified instructional videos

▶
Introduction to Amazon Managed Service for Prometheus | Amazon Web Services — Amazon Web Services
English · Introduction to AMP concepts
▶
Prometheus at Scale : Deep Dive Into The Engineering of Amazon Prometheus | Ep24 — Containers from the Couch
English · In-depth look at AMP internals (write, storage, query)
▶
500 million active time series in Amazon Managed Service for Prometheus — Containers from the Couch
English · Large-scale active series and quotas
▶
Run Queries Across Amazon Managed Service for Prometheus Workspaces | Amazon Web Services — Amazon Web Services
English · Cross-workspace queries

Official documentation

Video storyboard script (about 80 seconds)

This courseware cannot directly generate video / MP3; the storyboard below can be handed to a video tool.

Shot 1 · 0–20s
Visual: a vault labeled ws-… with two doors: the control plane aps and the data plane aps-workspaces.
Narration: An AMP workspace has two APIs. The control plane manages resources, and the data plane is Prometheus-compatible for writes and queries.
Shot 2 · 20–55s
Visual: an HTTP request envelope is stamped in turn with four seals: canonical request, string to sign, signing key, Authorization header.
Narration: Every request must be SigV4-signed, and the signing scope includes the region and the service name aps. If the region is wrong, the signature will not match.
Shot 3 · 55–80s
Visual: an hourglass labeled “1 hour”, with timed-out samples falling into a trash bin.
Narration: Remember two limits. Samples older than one hour are rejected, and a single query scans at most fifty million samples, so use recording rules for long ranges.
or score ≥ 70% in the quiz

Module 3 · Collection: managed collector and ADOT

13:00 – 21:00 · The managed collector scrapes from outside the cluster via ENIs and writes to AMP using a service-linked role. ADOT runs inside the cluster and writes using Pod Identity: two paths, one SigV4 endpoint.
8 minutesADOT Collector v0.51.0Scrape interval ≥ 30 seconds · same region★★★★★
Learning objectives
  • Use aws amp create-scraper to create a managed collector for prom-lab: choose subnets (≥ 2 Availability Zones) and security groups, and upload a base64-encoded scrape configuration.
  • Explain the managed collector's identity chain: service-linked role AWSServiceRoleForAmazonPrometheusScraper_* → automatically created EKS access entry (read-only RBAC) → service discovery → scraping → SigV4 writes.
  • Know the scrape configuration limits (only supports kubernetes_sd_configs, static targets must use IPs, authorization only via the SA token file, interval ≥ 30 seconds, single response ≤ 50 MB, ≤ 30,000 endpoints per collector), and diagnose with up .
  • Know how to use ADOT (EKS add-on + OpenTelemetryCollector CR + sigv4auth + prometheusremotewrite) as an alternative.
Prerequisites: Lesson 1 kubernetes_sd and relabel; module 2 SigV4. Importance:★★★★★

What: what a managed collector (scraper) is

An AMP managed collector is an “agentless” scraper that AMP runs in your VPC. When you create it, you provide the EKS cluster ARN, subnets in at least two different Availability Zones, and security groups. AMP creates an ENI in each subnet. The collector reaches the cluster's private endpoint through these ENIs for service discovery, then scrapes Pod IPs directly /metrics, and finally uses a service-linked role to write samples to the AMP workspace in the same region. The cluster has no collector Pods.

Why: why it works well

  • Zero operations: it uses no node resources, and cluster upgrades and node replacement do not affect collection. AWS handles scaling (up to 30,000 endpoints per collector).
  • Automatic authorization: when the cluster's authentication mode is API or API_AND_CONFIG_MAP , AMP automatically creates an access entry for the collector role. RBAC includes get / list / watch on nodes / nodes/proxy / nodes/metrics / services / endpoints / pods / ingresses / configmaps,/metrics get on non-resource URLs, and EKS control-plane metrics (metrics.eks.amazonaws.com kcm/ksh).
  • When creating a cluster in the EKS console you can tick “Send Prometheus metrics” directly, or use “Add scraper” on the cluster's Observability page.

How: rules for scrape configurations

ItemManaged collectorSelf-managed Prometheus / ADOT
Allowed configuration sectionsglobal,scrape_config,static_config,relabel_config,metric_relabel_configs,kubernetes_sd_configAll (ADOT's prometheus receiver supports most)
Service discoveryOnly kubernetes_sd_configsAny
Scrape interval≥ 30 secondsAny
Target namesExcept kubernetes.default.svc , IPs onlyDNS names allowed
AuthorizationNone, or Bearer + /var/run/secrets/kubernetes.io/serviceaccount/tokenAny
Updateupdate-scraper Alias, configuration and target workspace can be changed; changing the cluster requires deleting and recreatingChange ConfigMap / CR
Region / accountEKS, collector and workspace in the same region; cross-account uses --role-configurationAny

When: when to switch to ADOT

  • You need an interval below 30 seconds, static targets with DNS names (VMs outside the cluster), OTLP metrics / traces, or processors (filtering, attribute rewriting, batching). Use ADOT Collector (the AWS-distributed OpenTelemetry Collector, latest v0.51.0, 2026-10-29). EKS provides adot as a managed add-on (installs the ADOT Operator; cert-manager must be installed first).
  • Teams already running Prometheus Operator: run Prometheus in agent mode + remoteWrite.sigv4 (lesson 5's kps can also be configured this way).
  • AWS also notes that if the target is CloudWatch metrics, logs or Container Insights, the amazon-cloudwatch-observability add-on is recommended over ADOT (module 6).
Common misconceptions① “Deleting the cluster automatically deletes the collector”: no. The collector is tied to the cluster ARN, and must be deleted separately. A new cluster with the same name has the same ARN, so the old collector will scrape the new cluster. ② “The collector is outside the cluster, so the security groups do not matter”: the ENI uses the security groups you provide, and the security groups of the nodes where Pods run must allow it to reach the metrics port (passing the cluster security group is simplest). ③ “If scraping fails, check the collector logs”: check the up in AMP first. Absent = no targets discovered; 0 = discovered but scraping fails; 1 = normal.

Diagram: the managed collector's network and identity

VPC (prom-lab) ENI (subnet A)Cluster security group ENI (subnet B)Cluster security group EKS private endpoint kube-apiserverAccess entry → read-only RBAC (list / watch pods…) Nodes (Pod network) myapp-7d9…-abc 10.0.101.23:5000/metrics myapp-7d9…-xyz 10.0.140.77:5000/metrics kubelet cAdvisor (proxied via apiserver) Security group must allow ENI → 5000 ① Discover ② Scrape AMP managed collector serviceRole AWSServiceRoleFor…Scraper_*Scrape configuration (base64) AMP workspace prom-lab③ SigV4 remote writeaps:RemoteWrite
Figure 3-1 The collector's “hands” reach into the VPC (ENIs); its “identity” is the service-linked role + access entry

Diagram: ADOT data flow

myapp Pod:5000/metrics ADOT Collector (OpenTelemetryCollector CR) receiver: prometheus processor: batch prometheusremotewriteauth: sigv4auth AMP prom-labPod Identity role
Figure 3-2 ADOT: receiver → processor → exporter; the sigv4auth extension handles signing

Core animation: managed collector → AMP → AMG data and identity flow

9 steps in total, covering “who, with which identity, calls which API”. You can inject a fault first and then play, to see which step breaks and what symptom appears.

Inject fault:
Managed collectorSLR identity kube-apiserverAccess entry / RBAC myapp Pod:5000/metrics AMP writeaps:RemoteWrite AMP queryaps:QueryMetrics AMG prom-labWorkspace role Identity CenterSAML assertion UserBrowser
Click “Play” to start.
$ # Real API / logs for each step

Core commands

CommandPurposeNotes
aws amp get-default-scraper-configurationDownload the generic scrape configurationreturns the base64-encoded configuration
aws amp create-scraperCreate collector--source eksConfiguration=…,--scrape-configuration configurationBlob=…,--destination ampConfiguration=…,--alias
aws amp wait scraper-activewait for ACTIVECreation takes several minutes
aws amp describe-scraper / list-scrapersCheck status and roleArnroleArn is used to verify the access entry
aws amp update-scraperChange configuration / alias / target workspaceThe source cluster cannot be changed
aws eks list-access-entriesVerify the collector access entrycontains AWSServiceRoleForAmazonPrometheusScraper_*
aws amp delete-scraperDelete collectorDelete before deleting the cluster
source ~/promlab/aws.env
aws amp get-default-scraper-configuration --query configuration --output text | base64 -d > default-scraper.yml
grep -E '^\s+- job_name' default-scraper.yml | head
  - job_name: pod_exporter
  - job_name: cadvisor
  - job_name: kubernetes-apiservers
  - job_name: kube-proxy
  ...

This lesson uses a trimmed custom configuration that scrapes only myapp, apiserver and cAdvisor, to control sample volume:

global:
  scrape_interval: 30s                 # managed collector minimum is 30s
  external_labels:
    cluster: prom-lab
scrape_configs:
  - job_name: myapp
    kubernetes_sd_configs:
      - role: pod
    relabel_configs:
      - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_pod_label_app, __meta_kubernetes_pod_container_port_name]
        regex: myapp;myapp;http
        action: keep
      - source_labels: [__meta_kubernetes_namespace]
        target_label: namespace
      - source_labels: [__meta_kubernetes_pod_name]
        target_label: pod
  - job_name: kubernetes-apiservers
    scheme: https
    authorization:
      type: Bearer
      credentials_file: /var/run/secrets/kubernetes.io/serviceaccount/token
    kubernetes_sd_configs:
      - role: endpoints
    relabel_configs:
      - action: keep
        source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
        regex: default;kubernetes;https
  - job_name: cadvisor
    scheme: https
    authorization:
      type: Bearer
      credentials_file: /var/run/secrets/kubernetes.io/serviceaccount/token
    kubernetes_sd_configs:
      - role: node
    relabel_configs:
      - replacement: kubernetes.default.svc:443
        target_label: __address__
      - source_labels: [__meta_kubernetes_node_name]
        regex: (.+)
        target_label: __metrics_path__
        replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor
    metric_relabel_configs:
      - source_labels: [namespace]
        regex: myapp|kube-system
        action: keep                    # keep only the container metrics of the two namespaces to reduce sample volume
CLUSTER_ARN=$(aws eks describe-cluster --name $CLUSTER --query cluster.arn --output text)
SG=$(aws eks describe-cluster --name $CLUSTER --query cluster.resourcesVpcConfig.clusterSecurityGroupId --output text)
# pick private subnets in two different Availability Zones (eksctl tags private subnets with kubernetes.io/role/internal-elb=1)
read S1 S2 <<< $(aws ec2 describe-subnets \
  --filters Name=tag:alpha.eksctl.io/cluster-name,Values=$CLUSTER Name=tag:kubernetes.io/role/internal-elb,Values=1 \
  --query 'Subnets[0:2].SubnetId' --output text)

SCRAPER_ID=$(aws amp create-scraper --alias prom-lab \
  --source eksConfiguration="{clusterArn='$CLUSTER_ARN',securityGroupIds=['$SG'],subnetIds=['$S1','$S2']}" \
  --scrape-configuration configurationBlob=$(base64 -w0 scraper.yml) \
  --destination ampConfiguration="{workspaceArn='$WS_ARN'}" \
  --query scraperId --output text)
echo "export SCRAPER_ID=$SCRAPER_ID" >> ~/promlab/aws.env
aws amp wait scraper-active --scraper-id $SCRAPER_ID
aws amp describe-scraper --scraper-id $SCRAPER_ID --query 'scraper.{status:status.statusCode,role:roleArn}'
{
    "status": "ACTIVE",
    "role": "arn:aws:iam::111122223333:role/aws-service-role/scraper.aps.amazonaws.com/AWSServiceRoleForAmazonPrometheusScraper_1234abcd-56ef-7"
}
aws eks list-access-entries --cluster-name $CLUSTER --query 'accessEntries[?contains(@, `Scraper`)]'
awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/query?query=up" | jq -r '.data.result[] | "\(.metric.job) \(.metric.instance) \(.value[1])"'
[ "arn:aws:iam::111122223333:role/AWSServiceRoleForAmazonPrometheusScraper_1234abcd-56ef-7" ]
myapp 10.0.101.23:5000 1
myapp 10.0.140.77:5000 1
kubernetes-apiservers 10.0.12.34:443 1
kubernetes-apiservers 10.0.98.76:443 1
cadvisor kubernetes.default.svc:443 1
cadvisor kubernetes.default.svc:443 1

How to verify:up Each target is 1,myapp_http_requests_total can be queried. Common errors: Only one or two subnets given, or both in the same Availability Zone → ValidationException; passing the default Windows line endings directly → configuration parsing fails (use base64 instead) -w0. Production use: Manage the collector with CloudFormation (AWS::APS::Scraper) or Terraform, and put the scrape configuration under Git review.

Optional: ADOT approach (Pod Identity + sigv4auth)

# 1) cert-manager is a prerequisite for the ADOT Operator; 2) install the EKS managed add-on adot
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.x.y/cert-manager.yaml   # choose the version required by the ADOT add-on
aws eks create-addon --cluster-name $CLUSTER --addon-name adot
# 3) create the role (trust pods.eks.amazonaws.com) + Pod Identity association
cat > pod-trust.json <<'EOF'
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"pods.eks.amazonaws.com"},"Action":["sts:AssumeRole","sts:TagSession"]}]}
EOF
aws iam create-role --role-name prom-lab-adot --assume-role-policy-document file://pod-trust.json
aws iam attach-role-policy --role-name prom-lab-adot --policy-arn arn:aws:iam::aws:policy/AmazonPrometheusRemoteWriteAccess
kubectl create namespace adot
aws eks create-pod-identity-association --cluster-name $CLUSTER --namespace adot \
  --service-account adot-collector --role-arn arn:aws:iam::$ACCT:role/prom-lab-adot
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata: { name: amp, namespace: adot }
spec:
  mode: deployment
  serviceAccount: adot-collector
  image: public.ecr.aws/aws-observability/aws-otel-collector:v0.51.0
  config: |
    extensions:
      sigv4auth:
        region: ca-central-1
        service: aps
    receivers:
      prometheus:
        config:
          global: { scrape_interval: 15s, external_labels: { cluster: prom-lab, collector: adot } }
          scrape_configs:
            - job_name: myapp-adot
              kubernetes_sd_configs: [{ role: pod, namespaces: { names: [myapp] } }]
              relabel_configs:
                - source_labels: [__meta_kubernetes_pod_container_port_name]
                  regex: http
                  action: keep
    processors:
      batch: {}
    exporters:
      prometheusremotewrite:
        endpoint: https://aps-workspaces.ca-central-1.amazonaws.com/workspaces/WS_ID/api/v1/remote_write
        auth: { authenticator: sigv4auth }
    service:
      extensions: [sigv4auth]
      pipelines:
        metrics: { receivers: [prometheus], processors: [batch], exporters: [prometheusremotewrite] }

ADOT's prometheus receiver needs RBAC for list / watch on pods (ClusterRole + ClusterRoleBinding bound to adot/adot-collector); some parts are omitted, see the ADOT documentation. If the managed collector and ADOT both scrape the same Pods,Duplicate writes are billed twice— in the lab, choose one, or compare with different job names and then delete one.

Lab 3: Create a managed collector for prom-lab and verify myapp metrics (about 8 minutes + waiting)

Prepare the configuration: Save the scraper.yml from the “Commands” tab; first check the syntax locally with promtool (promtool comes from the Lesson 1 Prometheus image):
docker run --rm -v $PWD:/w --entrypoint promtool prom/prometheus check config /w/scraper.yml
Checking /w/scraper.yml
 SUCCESS: /w/scraper.yml is valid prometheus config file syntax

promtool does not check the managed collector's extra limits (for example, create-scraper rejects a 15s interval), so the API response remains authoritative.

Create the collector: run the create-scraper section on the “Commands” tab; wait for ACTIVE (a few minutes; you can keep reading Module 4 in the meantime).
Verify the access entry: aws eks list-access-entries the collector role appears in the output; aws eks list-associated-access-policies Not needed — the collector's permissions come from the managed Kubernetes permissions on its access entry.
Generate traffic and query:
kubectl -n myapp run load --image=curlimages/curl --restart=Never -- \
  sh -c 'for i in $(seq 1 600); do curl -s myapp:5000/ >/dev/null; curl -s myapp:5000/nope >/dev/null; sleep 0.5; done'
sleep 90
ampq 'sum by (status) (rate(myapp_http_requests_total[5m]))'
{"status":"success","data":{"resultType":"vector","result":[
 {"metric":{"status":"200"},"value":[1763194200,"1.93"]},
 {"metric":{"status":"404"},"value":[1763194200,"1.93"]}]}}
Failure drill (security group): temporarily swapping the collector to a new security group that does not allow port 5000 would require recreating the collector, which is costly; so we use observation instead: kubectl -n myapp scale deploy/myapp --replicas=0, wait 2 minutes, then query up{job="myapp"} the result is empty (target not discovered); after scaling back to 2 replicas it reappears — note the difference between “up absent” and “up=0”.
Cleanup: kubectl -n myapp delete pod load. The collector stays until the Module 8 cleanup (it is billed hourly).

Case 1: after a same-named cluster is rebuilt, the old collector “scraped the new cluster”

Problem: A team deleted and recreated a cluster with the same name prom-lab, without deleting the collector; the new cluster's metrics appeared directly in the old workspace, with labels still carrying the old cluster values. Approach: Add a collector deletion step to the cluster-deletion runbook aws amp delete-scraper; use IaC so the collector shares the cluster's lifecycle. Reason: The collector is associated by cluster ARN, and a same-named cluster has the same ARN (the official docs explicitly warn about this).

Case 2: managed collector + ADOT hybrid

Problem: Most services are fine with a 30-second interval, but the trade-matching service needs 5-second precision, plus OTLP traces. Approach: The managed collector scrapes standard cluster-wide metrics; ADOT (deployment mode) scrapes only the matching service and receives OTLP, sending traces to X-Ray; the two job do not overlap. Limitation: 5-second scraping makes this service's sample volume 6 times higher, so budget its cost separately.

Case 3: multiple accounts: cluster in the application account, workspace in the monitoring account

Problem: A central monitoring account needs to receive EKS metrics from 20 application accounts. Approach: In the source account, create a role that trusts scraper.aps.amazonaws.com as the Source role, and in the target account create a role with AmazonPrometheusRemoteWriteAccess a trust relationship to the Source role (sts:ExternalId = collector ARN) as the Target role,create-scraper --role-configuration then specify both roles. Limitation: The collector still has to be in the same Region as the cluster.

Common errors and fixes

up{job="myapp"} is completely absent (target not discovered)

Cause: a relabel rule dropped all targets (label or port-name mismatch), or the service discovery role lacks permissions, or DNS is not enabled on the VPC.

kubectl -n myapp get pods --show-labels
kubectl -n myapp get pod -l app=myapp -o jsonpath='{.items[0].spec.containers[0].ports}'
aws amp describe-scraper --scraper-id $SCRAPER_ID --query scraper.scrapeConfiguration.configurationBlob --output text | base64 -d | head -30

Fix: Verify regex: myapp;myapp;http against the actual namespace,app labels, and port names; update-scraper upload the new configuration.

up{job="myapp"} == 0, scrape failing (context deadline exceeded / connection refused)

Cause: the node security group does not allow the collector's ENI security group to reach port 5000; or the port/path is wrong; or the /metrics response exceeds 50 MB.

aws ec2 describe-network-interfaces --filters Name=description,Values='*scraper*' --query 'NetworkInterfaces[].{id:NetworkInterfaceId,sg:Groups[0].GroupId,subnet:SubnetId}'
kubectl -n myapp exec deploy/myapp -- sh -c 'wc -c <(wget -qO- localhost:5000/metrics)'

Fix: Create the collector with the cluster security group (the same group can communicate), or add an inbound rule to the node security group (source = collector security group, port 5000). Use the ENI description filter as it actually appears.

kubernetes-apiservers / cadvisor targets are 0: 403 Forbidden or Unauthorized

Cause: the access entry was deleted, or the cluster is still in CONFIG_MAP authentication mode with no manually configured aws-auth + ClusterRole.

aws eks describe-cluster --name $CLUSTER --query cluster.accessConfig.authenticationMode
aws eks list-access-entries --cluster-name $CLUSTER

Fix: Switch to API_AND_CONFIG_MAP mode and recreate the collector (access entries are created automatically); or manually create aps-collector-role ClusterRole and eksctl create iamidentitymapping (note: in roleArn, remove the aws-service-role/scraper.aps.amazonaws.com/ path).

create-scraper: ValidationException (scrape interval / subnet / unsupported config)

Cause: the interval is under 30 seconds; an unsupported SD was used (such as ec2_sd_configs,dns_sd_configs); a static target used a hostname; fewer than 2 subnets or not in 2 Availability Zones; no free IPs in the subnet.

Fix: Check each item against the limits table on the “Principles” tab; if you need these capabilities, use ADOT instead.

CLI exercises
1. Change the collector's scrape configuration to a 60-second interval and update it.
sed -i 's/scrape_interval: 30s/scrape_interval: 60s/' scraper.yml
aws amp update-scraper --scraper-id $SCRAPER_ID --scrape-configuration configurationBlob=$(base64 -w0 scraper.yml)
aws amp wait scraper-active --scraper-id $SCRAPER_ID
2. Find the scrape configuration the collector is actually using.
aws amp describe-scraper --scraper-id $SCRAPER_ID \
  --query scraper.scrapeConfiguration.configurationBlob --output text | base64 -d
Scenario analysis
A new colleague also installed kube-prometheus-stack on prom-lab (agent mode, remote_write to the same workspace). A week later, AMP write costs doubled and some dashboard values doubled. Analyze and fix it.

The managed collector and kps scraped the same targets and wrote to the same workspace: samples are billed twice,sum() queries double because an extra set of series appears (labels differ slightly, e.g. job/prometheus external labels). Fix: pick a single unique collector; if both must coexist, split responsibilities by job/namespace (relabel keep/drop must not overlap); for an HA pair of Prometheus replicas, use cluster + __replica__ external labels so AMP deduplicates (AMP's HA deduplication feature); otherwise duplicate samples are billed.

Verified training videos

▶
Agent-less Observability with Amazon Managed service for Prometheus - AWS OnAir S05 — AWS Events
English · Managed collector (agentless) demo
▶
AWS re:Invent 2023 - Seamless observability with AWS Distro for OpenTelemetry (COM307) — AWS Events
English · ADOT architecture and usage
▶
AWS Supports You | Getting Started with OpenTelemetry and ADOT — Amazon Web Services
English · ADOT getting started

Official documentation

Video storyboard script (about 90 seconds)

This courseware cannot directly generate video/MP3; the storyboard below can be given to a video tool.

Shot 1 · 0–25s
Visual: a VPC box, with two “arms” (ENIs) reaching in from outside the box into two subnets; the arms are labeled “cluster security group”.
Narration: the managed collector does not run inside the cluster; it places two network interfaces in your subnets and reaches the API server and pods from inside the VPC.
Shot 2 · 25–55s
Visual: service-linked role badge → EKS access entry → an RBAC manifest with only get/list/watch.
Narration: the identity is a service-linked role; AMP automatically creates an access entry for it, granting read-only service discovery permissions only.
Shot 3 · 55–90s
Visual: three up metric cards: absent, 0, and 1, labeled “not discovered”, “scrape failed”, and “normal”.
Narration: when troubleshooting, check up first: absent means relabel or discovery went wrong; zero means network or port; one means healthy.
or score ≥ 70% on the “Quiz”

Module 4 · Amazon Managed Grafana: Identity Center, permissions and data sources

21:00 – 29:00 · Keep the two identities separate: “people” sign in to Grafana through IAM Identity Center; “Grafana” queries AMP and CloudWatch through the workspace IAM role
8 minutesGrafana 9 / 10 / 12 / 13Requires AWS Organizations + Identity Center★★★★★
Learning objectives
  • Explain AMG's prerequisites for using IAM Identity Center (Organizations, management permission policies) and the fact that “people cannot sign in to Grafana directly with IAM users/roles.”
  • Create an AMG workspace in us-east-1 with the CLI prom-lab (the CLI/API only supports CUSTOMER_MANAGED the permission type + a self-managed workspace role), and use update-permissions to assign Admin / Editor / Viewer.
  • Add the AMP data source (since Grafana 12, SigV4 has been removed from the core Prometheus plugin and replaced by the Amazon Managed Service for Prometheus plugin), query ca-central-1 across Regions, and import the myapp dashboard.
Prerequisites: Lesson 1 Grafana data sources and dashboards; Lesson 3 Azure Managed Grafana (compare with Entra roles). Importance:★★★★★

What: what AMG is

AMG is an AWS-managed Grafana server (a “workspace”, with an ID like g-1234567890, and a URL like g-xxxx.grafana-workspace.us-east-1.amazonaws.com). AWS handles upgrades, high availability, and plugin execution. You choose the Grafana major version (currently 9, 10, 12, or 13; v12 includes open-source 11.0–12.4 features, v13 includes 13.0–13.2, and in-place upgrades are supported), the authentication methods (IAM Identity Center,SAML or both), permission mode, and network access control. Each account gets 5 workspaces per Region by default; each workspace allows up to 2000 dashboards and 100 alert rule instances (Grafana Alerting).

Why: two identities

IdentityWhoHow it is configuredWhat it controls
User identityEngineers, on-call staffIdentity Center users/groups → update-permissions Assign ADMIN / EDITOR / VIEWER (or role attributes in the SAML assertion)Whether they can sign in, and whether they can edit dashboards and data sources. IAM users/roles cannot be used to grant authorization inside Grafana
Workspace identityGrafana backend pluginsWorkspace IAM role (trusting grafana.amazonaws.com) policies; or the Assume Role ARN in the data source (cross-account)Which AWS data Grafana can read (AMP workspaces, CloudWatch metrics, SNS topics, ...)

When a user clicks “refresh” on a panel, the query is not executed with the user's own AWS identity; instead, Grafana signs it with the workspace role. So “who can see what data” is controlled by Grafana folder/data source permissions, and “what Grafana can read overall” is controlled by the workspace role.

How: permission modes

ModeWho creates the roleWhen to use
SERVICE_MANAGED (current account)AMG creates it automatically AmazonGrafanaServiceRole-* and attaches the selected data source policies (AMP is AmazonGrafanaPrometheusPolicy-*, CloudWatch is AmazonGrafanaCloudWatchAccess)Can only be selected in the console; quick start
SERVICE_MANAGED (organization)Creates it in each member account through CloudFormation StackSets AmazonGrafanaOrgMemberRole-*management account or delegated administrator account; centralized monitoring
CUSTOMER_MANAGEDYou create the role yourself and pass it at creation time --workspace-role-arnCLI / API / CloudFormation must use this; IaC and least privilege

When: versions and networking

  • For new workspaces, use 12 or 13: v12 removes legacy alerting, AngularJS plugins, and API keys (use service accounts instead), and the AMP data source is automatically migrated to the Amazon Managed Service for Prometheus plugin; v13 adds Git Sync and the PromQL query type for the CloudWatch data source, and removes some legacy Alertmanager configuration APIs.
  • For production, enable network access control (prefix list / VPC endpoint com.amazonaws.[region].grafana-workspace); when the data source is in a private VPC, configure a VPC connection (--vpc-configuration).
Common misconceptions① “Granting an IAM role grafana:* access lets you sign in to Grafana”—it does not; sign-in only accepts Identity Center / SAML. ② “A user assigned Viewer can only see data they have AWS permissions for”—queries use the workspace role, which is unrelated to the user's AWS permissions. ③ “Choosing SERVICE_MANAGED when creating via CLI is also fine”—the official CLI docs state that API/CLI/CloudFormation only use CUSTOMER_MANAGED.

Diagram: sign-in chain and query chain

Sign-in chain (user identity) Browserg-xxx.grafana-workspace IAM Identity CenterPassword + MFA / external IdP SAML assertionUser ID · groups AMG role mappingADMIN / EDITOR / VIEWER Query chain (workspace identity) Panel queryPromQL AMP data source pluginSTS AssumeRoleprom-lab-grafana-role SigV4 signingregion ca-central-1service aps AMP prom-lab (ca-central-1)aps:QueryMetrics/api/v1/query_range User roles only affect “whether you can open/edit panels”; data permissions are determined by the workspace role
Figure 4-1 The two chains do not intersect: Identity Center manages “people”, IAM roles manage “Grafana”

Diagram: what Grafana roles can do

VIEWER (USD 5/month)View dashboards; Explore depending on settingsCannot save changesOn-call, business stakeholders EDITOR (USD 9/month)Create/edit dashboards and alert rulesWrite PromQL in ExploreSRE, developers ADMIN (USD 9/month)Manage data sources, plugins, service accountsFolder permissions, organization settingsPlatform team (at least 1 person)
Figure 4-2 Each workspace needs at least one Admin; otherwise, administration is only possible through the AMG API

Animation: the identity chain behind opening a dashboard

Choose a user's role and action in AMG, then step through the sign-in and query process. The log shows the corresponding protocol steps and APIs.

User role:
Action:
Choose a role and action, then play.
$ # Log

Core commands

CommandPurposeNotes
aws grafana list-versionsList available Grafana versionsPass at creation time --grafana-version
aws grafana create-workspaceCreate workspace--account-access-type CURRENT_ACCOUNT,--authentication-providers AWS_SSO,--permission-type CUSTOMER_MANAGED,--workspace-role-arn
aws grafana describe-workspaceStatus and URLWait for ACTIVE before assigning users
aws grafana update-permissionsAssign Admin/Editor/Vieweraction=ADD,role=ADMIN,users=[{id=…,type=SSO_USER}]
aws grafana list-permissionsList assignments
aws grafana create-workspace-service-account + …-tokenAutomate calls to the Grafana HTTP APIAPI keys were removed in v12; use service accounts
aws sso-admin list-instances / aws identitystore list-usersLook up the Identity Center user IDThe ID is a GUID, not a username
source ~/promlab/aws.env
# 1) Workspace role: trusts grafana.amazonaws.com and grants only query permissions
cat > grafana-trust.json <<'EOF'
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"grafana.amazonaws.com"},"Action":"sts:AssumeRole"}]}
EOF
# The above is the minimal trust policy from the official docs; for production, add aws:SourceAccount / aws:SourceArn conditions per the AMG confused deputy protection guide
cat > grafana-read.json <<'EOF'
{"Version":"2012-10-17","Statement":[
 {"Sid":"AmpQuery","Effect":"Allow","Action":["aps:ListWorkspaces","aps:DescribeWorkspace","aps:QueryMetrics","aps:GetLabels","aps:GetSeries","aps:GetMetricMetadata"],"Resource":"*"},
 {"Sid":"CwRead","Effect":"Allow","Action":["cloudwatch:DescribeAlarmsForMetric","cloudwatch:DescribeAlarmHistory","cloudwatch:DescribeAlarms","cloudwatch:ListMetrics","cloudwatch:GetMetricStatistics","cloudwatch:GetMetricData","cloudwatch:GetInsightRuleReport","logs:DescribeLogGroups","logs:GetLogGroupFields","logs:StartQuery","logs:StopQuery","logs:GetQueryResults","logs:GetLogEvents","ec2:DescribeTags","ec2:DescribeInstances","ec2:DescribeRegions","tag:GetResources"],"Resource":"*"}]}
EOF
aws iam create-role --role-name prom-lab-grafana-role --assume-role-policy-document file://grafana-trust.json
aws iam put-role-policy --role-name prom-lab-grafana-role --policy-name read-amp-cw --policy-document file://grafana-read.json

# 2) Create the AMG workspace in us-east-1 (AMG is not in ca-central-1)
aws grafana list-versions --region $AMG_REGION
GF_ID=$(aws grafana create-workspace --region $AMG_REGION --workspace-name prom-lab \
  --account-access-type CURRENT_ACCOUNT --authentication-providers AWS_SSO \
  --permission-type CUSTOMER_MANAGED --workspace-role-arn arn:aws:iam::$ACCT:role/prom-lab-grafana-role \
  --grafana-version 12.4 --tags project=prom-lab --query workspace.id --output text)
echo "export GF_ID=$GF_ID" >> ~/promlab/aws.env
aws grafana describe-workspace --region $AMG_REGION --workspace-id $GF_ID \
  --query 'workspace.{status:status,url:endpoint,ver:grafanaVersion,auth:authentication.providers}'
{
    "grafanaVersions": ["9.4", "10.4", "12.4", "13.x"]
}
{
    "status": "ACTIVE",
    "url": "g-1a2b3c4d5e.grafana-workspace.us-east-1.amazonaws.com",
    "ver": "12.4",
    "auth": ["AWS_SSO"]
}
# 3) Assign ADMIN to your own Identity Center user (replace the username as needed)
IDS=$(aws sso-admin list-instances --query 'Instances[0].IdentityStoreId' --output text)
UID_=$(aws identitystore list-users --identity-store-id $IDS \
  --filters AttributePath=UserName,AttributeValue=andy --query 'Users[0].UserId' --output text)
aws grafana update-permissions --region $AMG_REGION --workspace-id $GF_ID \
  --update-instruction-batch "action=ADD,role=ADMIN,users=[{id=$UID_,type=SSO_USER}]"
aws grafana list-permissions --region $AMG_REGION --workspace-id $GF_ID \
  --query 'permissions[].{role:role,user:user.id,type:user.type}'
{ "errors": [] }
[ { "role": "ADMIN", "user": "9067xxxxxx-1a2b3c4d-....", "type": "SSO_USER" } ]

How to verify: Open https://$URL, select “Sign in with AWS IAM Identity Center”; after signing in, Admin appears in the lower-left corner. Common errors:update-permissions Running it while the workspace is still CREATING → fails; identitystore run the command in the Region where the Identity Center instance lives (add --region) if needed; entering a username as the user ID → regex validation fails. Production use: Grant access by Identity Center groups (type=SSO_GROUP), not per user.

Lab 4: Create AMG, connect AMP, and import the myapp dashboard (about 8 minutes + waiting)

Create the role and workspace: run steps 1)–3) on the “Commands” tab. If this is your first time using Identity Center in the account, the console will prompt you to create the first user and enable Identity Center (and Organizations) when you create the workspace.
Add the AMP data source (Grafana 12 UI): Connections → Add new connection → search for Amazon Managed Service for Prometheus → fill in:
  • Prometheus server URL: https://aps-workspaces.ca-central-1.amazonaws.com/workspaces/ws-… (that is, $AMP_EP, without adding /api/v1)
  • Authentication Provider: Workspace IAM Role; Default Region: ca-central-1 (different from us-east-1, where AMG is located; this is the cross-Region query)
  • Name: AMP prom-lab, click Save & test
You can also use Apps → AWS Data Sources in the left sidebar to discover automatically (the role must include aps:ListWorkspaces/DescribeWorkspace, and select Region ca-central-1 there).
✔ Successfully queried the Prometheus API.
Import the dashboard with a service account + HTTP API (automation demo):
source ~/promlab/aws.env
GF_URL=https://$(aws grafana describe-workspace --region $AMG_REGION --workspace-id $GF_ID --query workspace.endpoint --output text)
SA_ID=$(aws grafana create-workspace-service-account --region $AMG_REGION --workspace-id $GF_ID \
  --grafana-role ADMIN --name lab-automation --query id --output text)
TOKEN=$(aws grafana create-workspace-service-account-token --region $AMG_REGION --workspace-id $GF_ID \
  --service-account-id $SA_ID --name lab --seconds-to-live 3600 --query serviceAccountToken.key --output text)
DS_UID=$(curl -s -H "Authorization: Bearer $TOKEN" "$GF_URL/api/datasources/name/AMP%20prom-lab" | jq -r .uid)
cat > myapp-dash.json <<EOF
{"dashboard":{"title":"myapp on EKS (AMP)","uid":"myapp-amp","panels":[
 {"type":"timeseries","title":"Request rate by status","gridPos":{"x":0,"y":0,"w":12,"h":8},
  "datasource":{"uid":"$DS_UID"},"targets":[{"expr":"sum by (status) (rate(myapp_http_requests_total{cluster=\"prom-lab\"}[5m]))"}]},
 {"type":"timeseries","title":"P95 latency","gridPos":{"x":12,"y":0,"w":12,"h":8},
  "datasource":{"uid":"$DS_UID"},"targets":[{"expr":"histogram_quantile(0.95, sum by (le) (rate(myapp_http_request_duration_seconds_bucket[5m])))"}]},
 {"type":"stat","title":"Redis connectivity","gridPos":{"x":0,"y":8,"w":6,"h":4},
  "datasource":{"uid":"$DS_UID"},"targets":[{"expr":"min(myapp_redis_up)"}]}]},"overwrite":true}
EOF
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  "$GF_URL/api/dashboards/db" -d @myapp-dash.json | jq '{status,url}'
{ "status": "success", "url": "/d/myapp-amp/myapp-on-eks-amp" }
Verify: open the dashboard and confirm all three panels show data; in Explore, run count by (job) (up).
Permissions drill: create another user in Identity Center viewer1, assigned as role=VIEWER ; sign in with it and confirm it can view dashboards but has no “Save” button and cannot see Connections management.
Cleanup (partial): aws grafana delete-workspace-service-account --region $AMG_REGION --workspace-id $GF_ID --service-account-id $SA_ID (the token becomes invalid as well). Keep the workspace until Module 8.

Case 1: grant access by Identity Center group + folder permissions

Problem: 50 engineers were assigned roles one by one, and revocations when people left were often missed. Approach: Create groups in Identity Center (integrated with Entra ID / Okta) grafana-admins,grafana-editors,grafana-viewers,update-permissions use type=SSO_GROUP; put each team's dashboards in their own folder and set folder permissions. Limitation: Licenses are billed per user who actually signs in or calls the API in the month; group members who never sign in are not charged.

Case 2: centralized visualization across multiple accounts

Problem: The AMG in the monitoring account must query AMP and CloudWatch in 10 application accounts. Approach: In each application account, create a role DataSourceRole (trusting the workspace role in the monitoring account) and enter the Assume Role ARN in the data source; or in the delegated administrator account, use organization mode (StackSets automatically creates AmazonGrafanaOrgMemberRole-*). Configuration: For cross-account CloudWatch access, you can also use CloudWatch Observability Access Manager (OAM) to share metrics with the monitoring account.

Case 3: dashboards as code

Problem: Manually edited dashboards cannot be reviewed. Approach: On a v13 workspace, enable Git Sync (GitHub/GitLab/Bitbucket; up to 10 repositories per workspace), or manage dashboards with the Terraform Grafana provider + service account tokens (Lesson 7). Limitation: Each workspace allows up to 100 service account tokens (including expired ones); clean them up regularly.

Common errors and fixes

After sign-in, shows “You are not authorized to access this workspace” / cannot enter

Cause: The Identity Center user/group is not assigned to this workspace (or the workspace was not yet ACTIVE when it was assigned).

aws grafana list-permissions --region $AMG_REGION --workspace-id $GF_ID

Fix:update-permissions action=ADD,role=VIEWER,…; confirm the user has completed Identity Center email activation. Exact page text may vary.

Data source Save & test: 403 / “User: arn:aws:sts::…:assumed-role/prom-lab-grafana-role/… is not authorized to perform: aps:QueryMetrics”

Cause: The workspace role lacks query permissions, or the workspace ARN in the policy's Resource is wrong.

aws iam get-role-policy --role-name prom-lab-grafana-role --policy-name read-amp-cw
aws grafana describe-workspace --region $AMG_REGION --workspace-id $GF_ID --query workspace.workspaceRoleArn
Data source test reports 404 or “bad_data” / a Region error causes a signature mismatch

Cause: An extra /api/v1/query was appended at the end of the URL, or Default Region was left at us-east-1 (where AMG lives), so the signing Region does not match the AMP endpoint.

Fix: The URL should end at /workspaces/ws-…; set Default Region to ca-central-1.

create-workspace: ValidationException — permission type SERVICE_MANAGED not supported / workspaceRoleArn required

Cause: When creating via CLI/API, you can only use CUSTOMER_MANAGED and must provide the role ARN (error text may vary).

Fix: Create the role first following the “Commands” tab; or use Service managed in the console instead.

CLI exercises
1. Add the Identity Center group grafana-viewers (its group ID is stored in $GID) to the workspace with the VIEWER role.
aws grafana update-permissions --region us-east-1 --workspace-id $GF_ID \
  --update-instruction-batch "action=ADD,role=VIEWER,users=[{id=$GID,type=SSO_GROUP}]"
2. Query the workspace's current Grafana version and authentication method.
aws grafana describe-workspace --region us-east-1 --workspace-id $GF_ID \
  --query 'workspace.{ver:grafanaVersion,auth:authentication.providers}'
Scenario analysis
The security team requires that “business users can only see myapp metrics for their own team, not other teams' data.” How should this be implemented in AMG?

Queries use the workspace role, so isolation cannot rely on users' IAM permissions. Options: ① split AMP workspaces by team, with one data source per team; Grafana data source permissions (configured by an Admin) grant access only to the matching team group; put dashboards in team folders and restrict folder permissions. ② use separate AMG workspaces per team, with each workspace role allowed to access only its own AMP workspace ARN (strongest isolation, higher cost). Relying only on dashboard namespace variable filtering cannot stop users from modifying queries in Explore.

Verified training videos

▶
Introduction to Amazon Managed Grafana | Amazon Web Services — Amazon Web Services
English · AMG concepts and console workflow
▶
Integrating Amazon Managed Service for Prometheus with Amazon Managed Grafana | Amazon Web Services — Amazon Web Services
English · AMP data source configuration demo
▶
Demo Video - Amazon Managed Service for Prometheus (AMP) & Amazon Managed Service for Grafana (AMG) — Amazon Web Services
English · early end-to-end demo (the UI has changed; follow this lesson)

Official documentation

Video storyboard script (about 85 seconds)

This courseware cannot directly generate video/MP3; the storyboard below can be given to a video tool.

Shot 1 · 0–25s
Visual: two conveyor belts, one above labeled “People: Identity Center” and one below labeled “Grafana: IAM role”.
Narration: AMG has two identities: people sign in through Identity Center, and Grafana itself reads data through the workspace role.
Shot 2 · 25–55s
Visual: a map; Grafana in us-east-1 extends a line to AMP in ca-central-1, labeled “SigV4 region=ca-central-1”.
Narration: AMG is not available in ca-central-1, so we place it in US East and set the data source Region to ca-central-1.
Shot 3 · 55–85s
Visual: three role cards, Viewer, Editor, and Admin, with price tags of $5, $9, and $9.
Narration: grant access using Identity Center groups and keep at least one administrator; licenses are billed per active user each month.
or score ≥ 70% on the “Quiz”

Module 5 · AMP rules and Alertmanager to SNS

29:00 – 37:00 · The rule file format is the same as in Lesson 2; only the upload method differs. The Alertmanager configuration must be wrapped in alertmanager_config, and the only allowed receiver is SNS
8 minutesMinimum rule evaluation interval: 30 secondsOnly Amazon SNS receivers are supported (Standard topics)★★★★★
Learning objectives
  • Upload the Lesson 2 recording and alerting rules as AMP rule groups namespaces, and check status and rule evaluation results.
  • Write an AMP-format Alertmanager definition (template_files + alertmanager_config), and understand the disallowed fields (api_url,http_config) and sigv4.region required,repeat_interval maximum 5 days.
  • Configure the SNS topic access policy (service principal aps.amazonaws.com, with the condition aws:SourceArn = workspace ARN,aws:SourceAccount). For KMS-encrypted topics, also add a key policy.
Prerequisites: Lesson 2 alert lifecycle and Alertmanager routing. Importance:★★★★★

What: rules and alerts in AMP

  • Rule groups namespace: a standard Prometheus rule YAML (groups: → rules:), uploaded to the workspace under a namespace name. A workspace can have multiple namespaces (for example, one per team); each file is at most 1 MB, a workspace allows up to 2000 rules, and the minimum evaluation interval is 30 seconds.
  • Alertmanager definition: one per workspace; the top level may only contain template_files: and alertmanager_config: (the latter is a string whose contents match open-source Alertmanager configuration). Currently the only supported receiver is SNS; other receivers in the configuration, such as Slack, email, or webhook, will be rejected.
  • Rule evaluation is performed by AMP's ruler; evaluation queries are billed by QSP (query-processed samples). When an alert fires, it is sent to the workspace's built-in Alertmanager, which then, acting as the aps.amazonaws.com identity, calls SNS sns:Publish.

Why: why not use Slack/PagerDuty directly

The managed Alertmanager runs on the AWS side and is not allowed to send requests to arbitrary URLs (so these are blocked: api_url,http_config). SNS acts as the “exit”, and subscriptions fan out messages: email, SMS, Lambda (forwarding to Slack/Teams/PagerDuty), SQS, HTTPS endpoints, or Amazon Q Developer in chat applications (formerly AWS Chatbot). This way, exits are uniformly controlled by IAM, topic policies, and CloudTrail.

How: differences from a self-managed Alertmanager

ItemSelf-managed (Lesson 2)AMP
Rule filerule_files: + hot reloadcreate/put-rule-groups-namespace (CLI v2: after base64, use file://)
Alertmanager configurationalertmanager.ymlalertmanager_config: | Wrapper + create/put-alert-manager-definition
ReceiversAnySNS only, must sigv4: { region: … }
repeat_intervalAnyMax 5 days (anything longer is treated as 5 days)
Silencesamtool / UI/alertmanager/api/v2/silences (awscurl), or managed in the AMG alerting UI
TroubleshootingContainer logscreate-logging-configuration Send rule and Alertmanager errors to CloudWatch Logs
QuotasMachine resourcesConcurrent alerts 1000, routing tree nodes 100, inhibition rules 100, templates 100, aggregation group size 1000 (most are adjustable)

When: AMP rules vs Grafana Alerting

  • Metric-centric and must match the Prometheus ecosystem (portable, testable with promtool) → AMP rules (this lesson's main path).
  • Needs to span data sources (CloudWatch + AMP in the same rule), or needs non-SNS contact points → Grafana Alerting (AMG allows 100 rule instances per workspace, a smaller quota). AMG's alerting UI can also display and manage rules and Alertmanager in AMP.
Common misconceptions① “Just upload alertmanager.yml as-is”—it must be wrapped in alertmanager_config: | block. ② “The default SNS topic policy allows same-account service publishing”—the default policy uses AWS:SourceOwner to restrict principals to the account, and does not include aps.amazonaws.com the service principal, so an explicit statement must be added. ③ “FIFO topics work too”—the docs require Standard-type topics.

Diagram: from rule to email

rules.yamlNamespace myappbase64 → API AMP rulerEvaluated every 1m (≥30s)pending → firing AMP AlertmanagerGrouping / inhibition / silencesRouting → sns_configs SNS topicprom-lab-alertsTopic policy check Email Lambda→Slack Chat app Publish CloudWatch Logs (optional)Rule evaluation errors · Alertmanager delivery failures
Figure 5-1 SNS is the only alert exit; SNS then fans out to any channel you need

Diagram: confused deputy protection in the SNS topic policy

Principal: aps.amazonaws.comAction: sns:Publish,sns:GetTopicAttributes ConditionArnEquals aws:SourceArn = workspace ARNStringEquals AWS:SourceAccount = account Risk preventedSomeone else's AMP workspaceUses the AWS service identity to publish messages to your topic
Figure 5-2 Only “this workspace in my account” is allowed to publish messages on behalf of AMP

Simulator: MyappRedisDown from evaluation to email

Scaling Redis replicas to 0 makes myapp_redis_up become 0. Drag the time or step through to watch rule state, Alertmanager grouping, and SNS delivery; you can switch failure modes.

Fault:
t = 0: everything is normal.
$ # AMP ruler / Alertmanager / SNS events

Core commands

CommandPurposeNotes
aws amp create-rule-groups-namespace / put-rule-groups-namespaceUpload/replace rules--workspace-id --name --data file://rules.b64 (CLI v2 uses base64 + file://)
aws amp describe-rule-groups-namespaceCheck statusACTIVE means in effect
aws amp create-alert-manager-definition / put-alert-manager-definitionUpload/replace Alertmanager definitionDuring replacement, the old configuration stays in effect until the new one is ACTIVE
aws amp create-logging-configurationWrite rule/alert errors to CloudWatch Logs--log-group-arn
aws sns create-topic / subscribe / set-topic-attributesTopic, subscriptions and access policySetting the Policy replaces the whole policy, so keep the existing statements
awscurl … /api/v1/rules,/api/v1/alerts,/alertmanager/api/v2/alerts,/alertmanager/api/v2/silencesView rules, alerts and silencesData plane API, requires aps:ListRules and similar permissions
groups:
  - name: myapp-recording
    interval: 1m
    rules:
      - record: myapp:http_requests:rate5m
        expr: sum by (cluster, route, status) (rate(myapp_http_requests_total[5m]))
      - record: myapp:http_request_duration_seconds:p95_5m
        expr: histogram_quantile(0.95, sum by (cluster, le) (rate(myapp_http_request_duration_seconds_bucket[5m])))
  - name: myapp-alerts
    interval: 1m
    rules:
      - alert: MyappRedisDown
        expr: min by (cluster) (myapp_redis_up) == 0
        for: 2m
        labels: { severity: critical, team: myapp }
        annotations:
          summary: "myapp cannot connect to Redis (cluster {{ $labels.cluster }})"
          runbook: "https://wiki.example.com/runbooks/myapp-redis"
      - alert: MyappHighErrorRate
        expr: |
          sum by (cluster) (myapp:http_requests:rate5m{status=~"5.."})
            / sum by (cluster) (myapp:http_requests:rate5m) > 0.05
        for: 5m
        labels: { severity: warning, team: myapp }
        annotations: { summary: "myapp 5xx ratio {{ $value | humanizePercentage }}" }
      - alert: MyappHighLatencyP95
        expr: myapp:http_request_duration_seconds:p95_5m > 0.5
        for: 10m
        labels: { severity: warning, team: myapp }
        annotations: { summary: "myapp P95 latency {{ $value | humanizeDuration }}" }
      - alert: MyappTargetMissing
        expr: absent(up{job="myapp", cluster="prom-lab"} == 1)
        for: 5m
        labels: { severity: critical, team: myapp }
        annotations: { summary: "Managed collector has not scraped any healthy myapp targets" }
source ~/promlab/aws.env
# Check locally with promtool first (the Lesson 2 tool)
docker run --rm -v $PWD:/w --entrypoint promtool prom/prometheus check rules /w/rules.yaml
base64 -w0 rules.yaml > rules.b64
aws amp create-rule-groups-namespace --workspace-id $WS_ID --name myapp --data file://rules.b64
aws amp describe-rule-groups-namespace --workspace-id $WS_ID --name myapp --query 'ruleGroupsNamespace.status'
Checking /w/rules.yaml
  SUCCESS: 6 rules found
{ "statusCode": "ACTIVE" }
# SNS topic + email subscription + access policy (keep the default in-account statement, then add the AMP statement)
TOPIC_ARN=$(aws sns create-topic --name prom-lab-alerts --query TopicArn --output text)
echo "export TOPIC_ARN=$TOPIC_ARN" >> ~/promlab/aws.env
aws sns subscribe --topic-arn $TOPIC_ARN --protocol email --notification-endpoint you@example.com
cat > topic-policy.json <<EOF
{"Version":"2012-10-17","Statement":[
 {"Sid":"OwnerDefault","Effect":"Allow","Principal":{"AWS":"*"},"Action":["SNS:Publish","SNS:Subscribe","SNS:GetTopicAttributes","SNS:SetTopicAttributes","SNS:ListSubscriptionsByTopic"],
  "Resource":"$TOPIC_ARN","Condition":{"StringEquals":{"AWS:SourceOwner":"$ACCT"}}},
 {"Sid":"Allow_Publish_Alarms","Effect":"Allow","Principal":{"Service":"aps.amazonaws.com"},"Action":["sns:Publish","sns:GetTopicAttributes"],
  "Resource":"$TOPIC_ARN","Condition":{"ArnEquals":{"aws:SourceArn":"$WS_ARN"},"StringEquals":{"AWS:SourceAccount":"$ACCT"}}}]}
EOF
aws sns set-topic-attributes --topic-arn $TOPIC_ARN --attribute-name Policy --attribute-value file://topic-policy.json
template_files:
  default_template: |
    {{ define "sns.prom.subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }} ({{ .CommonLabels.cluster }}){{ end }}
alertmanager_config: |
  templates:
    - 'default_template'
  route:
    receiver: sns-warning
    group_by: [alertname, cluster]
    group_wait: 30s
    group_interval: 5m
    repeat_interval: 4h
    routes:
      - matchers: ['severity="critical"']
        receiver: sns-critical
        repeat_interval: 1h
  inhibit_rules:
    - source_matchers: ['alertname="MyappRedisDown"']
      target_matchers: ['alertname="MyappHighErrorRate"']
      equal: [cluster]
  receivers:
    - name: sns-warning
      sns_configs:
        - topic_arn: TOPIC_ARN
          sigv4:
            region: ca-central-1
          subject: '{{ template "sns.prom.subject" . }}'
          attributes:
            key: severity
            value: warning
    - name: sns-critical
      sns_configs:
        - topic_arn: TOPIC_ARN
          sigv4:
            region: ca-central-1
          subject: '{{ template "sns.prom.subject" . }}'
          attributes:
            key: severity
            value: critical
sed "s#TOPIC_ARN#$TOPIC_ARN#g" alertmanager.yaml | base64 -w0 > am.b64
aws amp create-alert-manager-definition --workspace-id $WS_ID --data file://am.b64
aws amp describe-alert-manager-definition --workspace-id $WS_ID --query 'alertManagerDefinition.status'
# Optional: send rule/Alertmanager errors to CloudWatch Logs
LG_ARN=$(aws logs create-log-group --log-group-name /aws/prometheus/prom-lab 2>/dev/null; \
  aws logs describe-log-groups --log-group-name-prefix /aws/prometheus/prom-lab --query 'logGroups[0].arn' --output text)
aws amp create-logging-configuration --workspace-id $WS_ID --log-group-arn "$LG_ARN"
{ "statusCode": "ACTIVE" }

How to verify:awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/rules" | jq '.data.groups[].name' Returns two groups. Common errors: describe returns CREATION_FAILED with statusReason (for example, an unsupported receiver is present); describe-log-groups the returned ARN ends with :*, remove it if the API reports a format error. Production use: Keep rules and the Alertmanager definition in Git; in CI, run promtool checks and then use put-* to publish (or manage them as CRs with the ACK controller).

Lab 5: deliver the MyappRedisDown alert to your inbox (about 8 minutes + waiting)

Upload the rules and Alertmanager definition: run the commands on the “Commands” tab in order; in your mailbox, click the SNS subscription confirmation link (no messages are delivered while the status is Pending confirmation).
aws sns list-subscriptions-by-topic --topic-arn $TOPIC_ARN --query 'Subscriptions[].SubscriptionArn'
[ "arn:aws:sns:ca-central-1:111122223333:prom-lab-alerts:4f1c…" ]
Create the failure:
kubectl -n myapp scale deploy/redis --replicas=0
sleep 60 && ampq 'min by (cluster) (myapp_redis_up)'
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"cluster":"prom-lab"},"value":[1763195000,"0"]}]}}
Observe the state changes (about 1–3 minutes pending, then 2 more minutes firing):
awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/alerts" | jq -r '.data.alerts[] | "\(.labels.alertname) \(.state)"'
awscurl --service aps --region $AWS_REGION "$AMP_EP/alertmanager/api/v2/alerts" | jq -r '.[].labels.alertname'
MyappRedisDown pending
...
MyappRedisDown firing
MyappRedisDown
Check the email: the subject looks like [FIRING:1] MyappRedisDown (prom-lab), and the body is the default SNS template (common annotations + alert list). Note that MyappHighErrorRate also fires, but it is suppressed by the inhibition rule.
Create a silence (rehearse a maintenance window):
cat > silence.json <<EOF
{"matchers":[{"name":"alertname","value":"MyappRedisDown","isRegex":false,"isEqual":true}],
 "startsAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)","endsAt":"$(date -u -d '+30 min' +%Y-%m-%dT%H:%M:%SZ)",
 "createdBy":"andy","comment":"lab maintenance"}
EOF
awscurl --service aps --region $AWS_REGION -X POST -H 'Content-Type: application/json' \
  -d @silence.json "$AMP_EP/alertmanager/api/v2/silences"
{"silenceID":"9f0c6a1e-…"}

awscurl's -d @file syntax for reading from a file depends on your installed version; you can also -d "$(cat silence.json)".

Restore and confirm resolved: kubectl -n myapp scale deploy/redis --replicas=1; after a few minutes, you should receive a [RESOLVED] email (you will not receive it if the silence is still active).

Case 1: SNS → Lambda → Slack / PagerDuty

Problem: On-call runs on PagerDuty and the team communicates in Slack, but AMP can only publish to SNS. Approach: Two SNS subscriptions: PagerDuty's HTTPS integration endpoint (a dedicated topic for the critical route) and a Lambda (formats the message and posts to a Slack webhook); use the attributes (severity) label with SNS subscription filter policies to route alerts. Limitation: The SNS message body is text rendered from an Alertmanager template; for structured processing, follow the official “send JSON to SNS” template format to output JSON.

Case 2: rules as code

Problem: Rules changed in the console; when something broke, nobody knew who had changed them. Approach: Keep rules in Git; CI runs promtool check rules and promtool test rules (the Lesson 2 unit tests); after merging, run put-rule-groups-namespace; CloudTrail records PutRuleGroupsNamespace 's caller. Configuration: On an EKS cluster, you can also use the ACK prometheusservice controller to manage them as RuleGroupsNamespace CRs.

Case 3: false positives caused by rule evaluation delay

Problem: The managed collector scrapes every 30 seconds + write latency, so absent() rules occasionally produce false positives at the boundary. Approach: Appropriately lengthen for; in the workspace, configure --rule-query-offset-in-seconds so evaluation queries shift slightly into the past, giving samples time to arrive. Limitation: The offset delays all alerts by the same amount.

Common errors and fixes

describe-alert-manager-definition: statusCode CREATION_FAILED, statusReason: … unsupported receiver / field api_url not allowed

Cause: the configuration includes non-SNS receivers (slack_configs, email_configs, ...), or includes api_url / http_config, or is missing sigv4.region, or forgot the alertmanager_config: | wrapper.

aws amp describe-alert-manager-definition --workspace-id $WS_ID --query 'alertManagerDefinition.status'

Fix: Keep only sns_configs; use put-alert-manager-definition to re-upload (the previous configuration stays in effect if the update fails).

The alert is visible at /alertmanager/api/v2/alerts, but the mailbox never receives it

Cause:① the subscription is still PendingConfirmation; ② the topic policy does not allow aps.amazonaws.com, or aws:SourceArn has the wrong workspace; ③ the topic has SSE-KMS enabled, but the key policy does not grant aps.amazonaws.com the kms:GenerateDataKey*,kms:Decrypt; ④ the alert is silenced or inhibited.

aws sns get-topic-attributes --topic-arn $TOPIC_ARN --query 'Attributes.Policy' --output text | jq .
aws sns list-subscriptions-by-topic --topic-arn $TOPIC_ARN
awscurl --service aps --region $AWS_REGION "$AMP_EP/alertmanager/api/v2/silences" | jq '.[] | {id,status:.status.state}'
aws logs tail /aws/prometheus/prom-lab --since 30m
The rule namespace is ACTIVE, but rule health in /api/v1/rules is err (for example, many-to-many matching not allowed / query processing would load too many samples)

Cause: A PromQL runtime error, or a single evaluation exceeds the query sample limit (50 million).

awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/rules" | jq '.data.groups[].rules[] | select(.health!="ok") | {name,lastError}'

Fix: Use recording rules to aggregate first, reducing by dimensions; fix vector matching (on() / group_left).

InvalidParameterException / after rule upload, statusReason shows a YAML parsing error

Cause: CLI v2 passes file://rules.yaml directly (not base64-encoded), causing a blob decoding error; or Windows line endings or tab indentation are used.

Fix: Follow the official steps base64 -w0 , then file://; check locally with promtool first.

CLI exercises
1. Edit rules.yaml and then replace the existing myapp namespace.
base64 -w0 rules.yaml > rules.b64
aws amp put-rule-groups-namespace --workspace-id $WS_ID --name myapp --data file://rules.b64
aws amp describe-rule-groups-namespace --workspace-id $WS_ID --name myapp --query ruleGroupsNamespace.status
2. List the names of all currently firing alerts.
awscurl --service aps --region ca-central-1 "$AMP_EP/api/v1/alerts" \
  | jq -r '.data.alerts[] | select(.state=="firing") | .labels.alertname'
Scenario analysis
The team wants to migrate the Slack, email, and PagerDuty receivers from the Lesson 2 Alertmanager to AMP, while keeping the routing “critical goes to PagerDuty, everything else goes to Slack”. Provide a plan.

AMP can only publish to SNS, so map each “receiver” to an SNS topic: prom-lab-critical (subscribed to the PagerDuty HTTPS endpoint) and prom-lab-warning (subscribed to a Lambda → Slack; email subscribed directly to email). The Alertmanager routing structure stays the same; only change each receiver to sns_configs (each with topic_arn + sigv4.region). Both topics need an access policy for aps.amazonaws.com (SourceArn = the workspace). Inhibition, grouping, and silence configurations can be migrated as-is; repeat_interval keep the 5-day maximum in mind.

Verified training videos

▶
Demo Video - Amazon Managed Service for Prometheus (AMP) & Amazon Managed Service for Grafana (AMG) — Amazon Web Services
English · covers rules and alerts (early UI)
▶
Leverage Service Level Objectives (SLOs) with Prometheus Metrics | Amazon Web Services — Amazon Web Services
English · SLOs and alerts with Prometheus metrics

No verified English video specifically covering “AMP Alertmanager + SNS topic policy” was found; a storyboard script is provided below.

Official documentation

Video storyboard script (about 90 seconds)

This courseware cannot directly generate video/MP3; the storyboard below can be given to a video tool.

Shot 1 · 0–25s
Visual: the Lesson 2 alertmanager.yml is placed in an envelope labeled alertmanager_config; the Slack and email icons are crossed out, leaving only SNS.
Narration: in AMP, the Alertmanager configuration must be wrapped in an alertmanager_config block, and the only allowed receiver is SNS.
Shot 2 · 25–60s
Visual: a guard stands at the SNS topic's door, checking visitors' badges “aps.amazonaws.com” and “from workspace ws-…”.
Narration: the SNS topic policy must allow the AMP service principal, and use source ARN and source account conditions to prevent the “confused deputy” problem.
Shot 3 · 60–90s
Visual: Redis goes dark → rule turns yellow (pending) → red (firing) → email pops up → Redis lights up → green resolved email.
Narration: scale Redis to zero replicas; two minutes later the alert fires and the email arrives; after recovery, a resolved notification is received.
or score ≥ 70% on the “Quiz”

Module 6 · Combining CloudWatch metrics with Prometheus

37:00 – 45:00 · AWS service metrics naturally live in CloudWatch and application metrics in AMP; if you can view them side by side in Grafana, don't copy them; import only when they must be calculated together
8 minutesAMP usage metrics are freeGetMetricData is billed per requested metric★★★★☆
Learning objectives
  • Add a CloudWatch data source in AMG and put AWS metrics such as ALB/EC2 on the same dashboard as myapp metrics from AMP.
  • Compare four ways to combine them: side-by-side queries in Grafana, importing into Prometheus via CloudWatch Exporter/YACE, Container Insights, and CloudWatch OTel metrics + PromQL (a 2026 capability), and estimate the cost.
  • Use the usage metrics that AMP provides for free in CloudWatch (AWS/Usage,AWS/Prometheus) to monitor AMP itself: active series, write rate, dropped samples, rule failures, and alert delivery failures.
Prerequisites: CloudWatch metrics, namespaces and dimensions; Module 4 AMG data sources. Importance:★★★★☆

What: two metric models

CloudWatch metricsPrometheus (AMP)
IdentityNamespace + metric name + dimensions (up to 30)Metric name + labels
DataPre-aggregated statistics per period (Sum/Average/p99…), standard resolution 1 minuteRaw samples (counter, gauge, histogram), computed at query time
SourcePublished automatically by 70+ AWS services (ALB, RDS, SQS, Lambda…)Your application /metrics, exporters
QueryGetMetricData, Metrics Insights (SQL); since 2026, OTel metrics can be queried with PromQLPromQL
BillingCustom metrics per metric/month; API per requested metricPer ingested sample, storage, and queried sample

Why: why not move everything into Prometheus

  • AWS service metrics already exist in CloudWatch for free (basic monitoring); pulling them with an exporter incurs GetMetricData charges + AMP write charges, and introduces delays of 1 to several minutes and time-alignment issues (CloudWatch values are per-period aggregates, which become gauges after import).
  • But some calculations must be done in one language, for example the ratio “ALB 5xx / myapp request count” or an SLO burn rate — in that case,a small number of CloudWatch metrics into AMP, or conversely send application metrics as OTel metrics to CloudWatch and query everything together with PromQL.

How: four ways to combine them

ApproachMechanismAdvantagesCosts
① Side-by-side in Grafana (recommended default)AMP data source + CloudWatch data source in AMG; the same panel can use the Mixed data sourceNo copying, no extra storageCannot be jointly calculated in a single PromQL; Grafana expressions (Math) can do simple calculations
② Import into PrometheusYACE (prometheus-community's yet-another-cloudwatch-exporter) or CloudWatch Exporter calls GetMetricData; after being scraped, the data is written to AMPUnified PromQL calculations and alertingGetMetricData charges, latency, extra components; import only necessary metrics
③ Container InsightsEKS add-on amazon-cloudwatch-observability (CloudWatch agent + Fluent Bit) sends container metrics/logs to CloudWatchOut-of-the-box container dashboards, integrated with Application SignalsDuplicates the cAdvisor metrics collected by AMP and is billed by observed volume; pick one as primary
④ CloudWatch OTel + PromQL2026-06-16 announcement: CloudWatch natively receives OTel metrics (OTLP), billed per GB, with 15 months of storage; metrics from 70+ AWS services and custom metrics can be queried together with PromQL, with a Prometheus-compatible query API; the AMG v13 CloudWatch data source adds a PromQL query typeAWS metrics and application metrics calculated jointly in one PromQLNew capability; regions and details follow the CloudWatch documentation; its pricing model differs from AMP, so evaluate it separately

When: selection rules

  • Checking AWS service health → ①; cross-source ratio/SLO alerts → ② (a small number) or ④; already using CloudWatch for container monitoring and don't want to maintain the Prometheus ecosystem → ③/④.
  • Monitoring the monitoring system itself: AMP usage metrics live in CloudWatch,free, and in CloudWatch alarms, set thresholds on ActiveSeries,DiscardedSamples, and AlertManagerNotificationsFailed . Do not rely solely on AMP to alert on itself.
Common misconceptions① “Once CloudWatch metrics are imported into Prometheus, they are real-time”—CloudWatch has publishing delay, and the importer also queries per period, so it is usually several minutes behind. ② “Querying CloudWatch from Grafana costs nothing”—every panel refresh calls GetMetricData; many users with short refresh intervals will generate charges. ③ “If AMP breaks, AMP's alerts will notify me”—if the alerting chain itself is broken, you will receive nothing; use a CloudWatch alarm as a “watchdog”.

Diagram: one dashboard, two data paths

ALB / RDS / EC2Automatically published to CloudWatch myapp Pod/metrics CloudWatchAWS/ApplicationELB … AMP prom-labmyapp_* · up Collector AMG dashboard “myapp + ALB”Panel 1: ALB RequestCount / HTTPCode_ELB_5XXPanel 2: rate(myapp_http_requests_total[5m])Panel 3: Mixed + Math expression GetMetricData QueryMetrics ② YACE import (optional)
Figure 6-1 Side-by-side querying is the default; use the dashed import path only when joint calculation is needed

Diagram: monitoring AMP with a CloudWatch watchdog

AMP workspacePublishes usage metrics for free CloudWatch metricsAWS/Usage: ActiveSeries, IngestionRateAWS/Prometheus: DiscardedSamplesRuleEvaluationFailuresAlertManagerNotificationsFailed CloudWatch alarm → a separate SNS topicIndependent of the AMP alerting chain
Figure 6-2 The monitoring system also needs monitoring, and it should use a separate path

Interactive: “Where should this metric go?” cost comparer

Choose a metric scenario and scale, and compare the typical approaches and monthly cost magnitude of three options: “Grafana side-by-side / import to AMP / CloudWatch PromQL” (estimated from AMP public rates and CloudWatch API rates verified in 2026-11; for comparison only, not a quote).

Scale:
$ # Recommended configuration snippets

Core commands

CommandPurposeNotes
aws cloudwatch list-metrics --namespace AWS/PrometheusList metrics published by AMPDimensions include workspace, etc.
aws cloudwatch get-metric-dataGet metric data (same API as Grafana)Billed per requested metric
aws cloudwatch put-metric-alarmWatchdog alarmAlarm notifies a separate SNS topic
aws eks create-addon --addon-name amazon-cloudwatch-observabilityContainer InsightsRequires IAM permissions for the CloudWatch agent
helm upgrade --install yace prometheus-community/yet-another-cloudwatch-exporterImport a small number of CloudWatch metricsGrant via Pod Identity cloudwatch:GetMetricData,tag:GetResources
source ~/promlab/aws.env
aws cloudwatch list-metrics --namespace AWS/Prometheus --query 'Metrics[].MetricName' --output text | tr '\t' '\n' | sort -u | head
aws cloudwatch list-metrics --namespace AWS/Usage --dimensions Name=Service,Value=Prometheus \
  --query 'Metrics[].Dimensions[?Name==`Resource`].Value[]' --output text | tr '\t' '\n' | sort -u | head
AlertManagerAlertsReceived
DiscardedSamples
QuerySamplesProcessed
RuleEvaluations
RuleGroupLastEvaluationDuration
ActiveSeries
IngestionRate
QueryMetricsTPS
RemoteWriteTPS
# Watchdog: Alertmanager delivery failures > 0 for 5 minutes → notify a separate topic (do not use prom-lab-alerts itself)
WD_TOPIC=$(aws sns create-topic --name prom-lab-watchdog --query TopicArn --output text)
aws sns subscribe --topic-arn $WD_TOPIC --protocol email --notification-endpoint you@example.com
aws cloudwatch put-metric-alarm --alarm-name prom-lab-am-notify-failed \
  --namespace AWS/Prometheus --metric-name AlertManagerNotificationsFailed \
  --dimensions Name=Workspace,Value=$WS_ID \
  --statistic Sum --period 300 --evaluation-periods 1 --threshold 0 \
  --comparison-operator GreaterThanThreshold --treat-missing-data notBreaching \
  --alarm-actions $WD_TOPIC
aws cloudwatch describe-alarms --alarm-names prom-lab-am-notify-failed --query 'MetricAlarms[].StateValue'
[ "OK" ]

Dimension name tip:AWS/Prometheus Confirm the metric's dimension names first with list-metrics (the example above uses Workspace); if dimensions are wrong, the alarm stays INSUFFICIENT_DATA (treating missing data as “not breaching” hides the problem, so always check the state and graph after creation).

# Fetch ALB metrics directly with the CLI (same API the Grafana CloudWatch data source calls)
cat > q.json <<'EOF'
[{"Id":"req","MetricStat":{"Metric":{"Namespace":"AWS/ApplicationELB","MetricName":"RequestCount",
  "Dimensions":[{"Name":"LoadBalancer","Value":"app/k8s-myapp-xxxx/0123456789abcdef"}]},"Period":60,"Stat":"Sum"}}]
EOF
aws cloudwatch get-metric-data --metric-data-queries file://q.json \
  --start-time $(date -u -d '-30 min' +%FT%TZ) --end-time $(date -u +%FT%TZ) --query 'MetricDataResults[0].Values[:5]'
[ 118.0, 121.0, 117.0, 119.0, 120.0 ]
apiVersion: v1alpha1
discovery:
  jobs:
    - type: AWS/ApplicationELB
      regions: [ca-central-1]
      period: 300
      length: 300
      metrics:
        - name: RequestCount
          statistics: [Sum]
        - name: HTTPCode_ELB_5XX_Count
          statistics: [Sum]

The YACE configuration structure and chart values key names change between versions; follow the current documentation for prometheus-community/yet-another-cloudwatch-exporter; the imported metric names look like aws_applicationelb_request_count_sum, and the managed collector (with an extra job) scrapes them.

Lab 6: Build a mixed “myapp + AWS” dashboard in AMG (about 7 minutes)

Add the CloudWatch data source: AMG → Connections → Add new connection → CloudWatch; Authentication Provider: Workspace IAM Role; Default Region: ca-central-1. Save & test should show success (the workspace role already has the CloudWatch read permissions from Module 4).
Panel 1: AMP usage: data source CloudWatch, Namespace AWS/Usage, Metric ResourceCount, dimension Service=Prometheus,Resource=ActiveSeries, statistic Maximum. Observe the active series for prom-lab (lab scale is usually a few thousand to tens of thousands).
Panel 2: AMP rule health: Namespace AWS/Prometheus, Metric RuleEvaluationFailures (Sum), and AlertManagerNotificationsFailed (Sum).
Panel 3: myapp: data source AMP prom-lab,sum(rate(myapp_http_requests_total[5m])).
Panel 4: Mixed + expression: set the data source to -- Mixed --; Query A (AMP) sum(rate(myapp_http_requests_total{status=~"5.."}[5m])), Query B (AMP) sum(rate(myapp_http_requests_total[5m])), Expression C: Math $A / $B. If you created an ALB for myapp with Helm in Lesson 4, you can add Query D (CloudWatch) HTTPCode_ELB_5XX_Count to compare side by side “5xx seen by the load balancer” with “5xx counted by the app itself”.
Create the watchdog alarm: run put-metric-alarm on the “Commands” tab; confirm the state is OK.
Cleanup (partial): the watchdog alarm and prom-lab-watchdog topic are deleted together in Module 8.

Case 1: unexpected GetMetricData bill

Problem: A Grafana used by 200 people, with CloudWatch panels auto-refreshing every 10 seconds and 50 metrics per panel; by month-end, CloudWatch API charges far exceeded AMP's. Approach: Set the minimum refresh interval for CloudWatch panels to 1 minute (AWS metrics themselves are 1-minute granularity); use Metrics Insights queries to aggregate instead of per-instance metrics; enable Grafana query caching for frequently used dashboards (if available). Limitation: Caching introduces data latency.

Case 2: joint SLO for ALB + application

Problem: The SLO requires the “success rate users see”, including 502/503 responses returned directly by the ALB (requests that never reach the application). Approach: Use YACE to import this ALB's RequestCount and HTTPCode_ELB_5XX_Count metrics into AMP every 60 seconds; the SLO recording rule = (ALB 5xx + application 5xx) / ALB request count; for burn-rate alerts, see Lesson 6. Limitation: Imported values are Sums over 60-second periods, so in PromQL use sum_over_time rather than rate.

Case 3: evaluating migration to CloudWatch PromQL

Problem: The team wants to query RDS and application metrics with a single PromQL, without maintaining an importer. Approach: Pilot CloudWatch OTel metrics in a non-production account (ADOT/OTel Collector sends application metrics via OTLP), using the PromQL query type of the AMG v13 CloudWatch data source; compare costs with AMP (per GB vs per sample), retention (15 months vs configurable 1–1095 days), and alerting capability. Limitation: For the new capability, quotas, regions, and PromQL compatibility follow the official documentation; perform full validation before migrating to production.

Common errors and fixes

CloudWatch data source test: AccessDenied: … is not authorized to perform: cloudwatch:ListMetrics

Cause: The workspace role lacks CloudWatch read permissions (customer-managed mode does not add them automatically).

aws iam get-role-policy --role-name prom-lab-grafana-role --policy-name read-amp-cw --query 'PolicyDocument.Statement[].Sid'

Fix: Attach CloudWatch read permissions (the CwRead statement from Module 4, or the AWS managed policy AmazonGrafanaCloudWatchAccess).

CloudWatch panel shows No data, but the metrics are visible in the console

Cause: the data source Default Region is us-east-1 (the AMG Region) while the metrics are in ca-central-1; or the dimension value does not match exactly (the ALB dimension is app/name/ID); or the statistic/period selection produces no points.

Fix: Explicitly select Region ca-central-1 in the panel; use the Metric search dropdown to choose dimension values instead of typing them.

Metrics imported by YACE always show up in AMP 5–10 minutes later than in the CloudWatch console, and occasionally have missing points

Cause: CloudWatch publishing delay + import period + 30-second managed collector scrape; period/length if the period is too short, the newest period has not finished aggregating.

Fix: Set a reasonable delay/length (for example, period 300 / length 600), and make sure alarms for cover at least two periods.

CloudWatch alarm stays INSUFFICIENT_DATA

Cause: Dimension name/value is wrong (for example, a wrong AMP metric dimension name), or the metric only publishes when events occur (it is not published when the failure count is 0).

aws cloudwatch list-metrics --namespace AWS/Prometheus --metric-name AlertManagerNotificationsFailed

Fix: Correct the dimensions per the list-metrics output; for metrics that publish “only on errors”, use --treat-missing-data notBreaching, and also set up a separate IngestionRate alarm with a deliberately low threshold as a heartbeat.

CLI exercises
1. Check the maximum ActiveSeries value for the prom-lab workspace over the past hour.
aws cloudwatch get-metric-statistics --namespace AWS/Usage --metric-name ResourceCount \
  --dimensions Name=Service,Value=Prometheus Name=Type,Value=Resource Name=Resource,Value=ActiveSeries Name=Class,Value=None \
  --statistics Maximum --period 300 --start-time $(date -u -d '-1 hour' +%FT%TZ) --end-time $(date -u +%FT%TZ)
# Use the actual list-metrics output for the dimension combination
2. Install the Container Insights add-on.
aws eks create-addon --cluster-name prom-lab --addon-name amazon-cloudwatch-observability
aws eks describe-addon --cluster-name prom-lab --addon-name amazon-cloudwatch-observability --query addon.status
Scenario analysis
The manager asks that “all monitoring data be put into Prometheus for consistency.” The team has 300 RDS instances, each with 8 metrics of interest at 60-second granularity. How would you respond?

Estimate: 300 × 8 = 2400 metrics; one GetMetricData request per minute is about 2400 × 60 × 24 × 30 ≈ 104 million “requested metrics” per month, which at 0.01 USD per 1000 is about 1000 USD/month (check the CloudWatch pricing page), plus AMP ingestion (about 104 million samples/month ≈ 9 USD). These metrics already exist in CloudWatch for free. Recommendation: query CloudWatch directly in dashboards (side-by-side in Grafana), and import only the few metrics used in SLOs or joint alerts (for example, primary database CPU and connection count) at a 300-second period; alternatively, evaluate whether CloudWatch PromQL can meet the unified query need.

Verified training videos

▶
Set Up an Amazon Managed Service for Grafana Dashboard with CloudWatch Integration — Amazon Web Services
English · Adding a CloudWatch data source in AMG
▶
Kubernetes Performance Monitoring using Amazon CloudWatch Container Insights for AWS EKS. — Cloud Quick Labs
English · Container Insights demo (community channel)
▶
Amazon CloudWatch OTel: Open Standards Observability, Managed by AWS - April 2026 — AWS-Joe Alioto
English · CloudWatch OTel metrics and PromQL (personal channel; follow the official documentation)

Official documentation

Video storyboard script (about 75 seconds)

This courseware cannot directly generate video/MP3; the storyboard below can be given to a video tool.

Shot 1 · 0–25s
Visual: on the left, a CloudWatch warehouse (ALB and RDS icons); on the right, an AMP warehouse (myapp); in the middle, a Grafana screen showing both at once.
Narration: AWS service metrics live in CloudWatch and application metrics in AMP; by default, view them side by side in Grafana rather than copying them.
Shot 2 · 25–50s
Visual: a thin pipe carries only two metrics from CloudWatch to AMP, with a meter ticking beside it.
Narration: import a small number of metrics only when they must be calculated together; every GetMetricData call is billed per metric.
Shot 3 · 50–75s
Visual: a CloudWatch alarm clock hangs over AMP's head, labeled “watchdog”.
Narration: AMP's usage metrics are free in CloudWatch; use them to set up an independent watchdog alarm for the monitoring system itself.
or score ≥ 70% on the “Quiz”

Module 7 · Cloud troubleshooting in practice

45:00 – 54:00 · Locate faults by segmenting the data flow: collection (discovery/scrape) → ingestion (signing/authorization/limits) → querying (Grafana identity/Region) → alerting (rules/routing/SNS)
9 minutes4 reproducible faultsCheck up and AWS/Prometheus metrics first★★★★★
Learning objectives
  • Use the “segmentation method” to locate faults in AWS managed monitoring: each segment has a defined checkpoint (up, HTTP status codes,DiscardedSamples, data source tests,/api/v1/alerts,AlertManagerNotificationsFailed).
  • Distinguish the two meanings of 403 (signature mismatch vs. unauthorized), distinguish “target not discovered” from “scrape failed”, and distinguish “Grafana cannot find it” from “AMP does not have it”.
  • Reproduce and fix 4 typical faults, and write down preventive measures.
Prerequisites: Modules 2–6. Importance:★★★★★

What: the four data-flow segments and the “evidence” for each

SegmentComponentPrimary evidenceTypical faults
① CollectionManaged collector / ADOTup whether it exists and whether it is 1; scrape_samples_scrapedrelabel drops targets, security groups, private endpoints, access entries, /metrics too large
② IngestionAMP data planeHTTP status in collector logs (403/400/429); CloudWatch DiscardedSamples (by reason)SigV4 Region/service name, IAM, stale samples, limits, invalid labels
③ QueryAMG data source / awscurlwhether awscurl can query it; data source Save & testworkspace role permissions, Default Region, URL path, cross-account Assume Role
④ AlertingAMP ruler + Alertmanager + SNS/api/v1/rules health in /api/v1/alerts; AlertManagerNotificationsFailed; CloudWatch LogsPromQL errors, routing/inhibition/silences, topic policy, KMS, unconfirmed subscriptions

Why: why segment

A managed service has no machine you can SSH into, and you cannot see process logs; what you can get is API responses, AMP's built-in up metrics, CloudWatch usage metrics, and (optional) CloudWatch Logs. Confirming segment by segment from upstream to downstream whether “the data got here” is far more effective than repeatedly refreshing Grafana.

How: telling the two 403s apart

Error keywordMeaningDirection
The request signature we calculated does not matchSignature computed differently: Region, service name (should be aps), a proxy rewrote the request, clock skewCheck the client configuration,not an IAM problem
is not authorized to perform: aps:RemoteWrite / aps:QueryMetricsSignature is correct and identity is recognized, but IAM deniesCheck whether the role ARN in the error is the identity you expect, and the policy Resource
security token included in the request is invalid / expiredCredentials expired or invalid (for example, manually exported SSO temporary credentials have expired)Refresh credentials; in production, use role credentials that rotate automatically

When: when to turn on logs

  • Alert/rule problems: create-logging-configuration turn on AMP's rule and Alertmanager logs (Module 5).
  • Query performance problems: newer CLI versions provide create-query-logging-configuration (query logs); the managed collector has update-scraper-logging-configuration. Parameters for these newer features follow the CLI help.
Common misconceptions① “No data in Grafana means no data in AMP”—first query directly with awscurl, bypassing Grafana. ② “For a 403, just add AdministratorAccess”—if it is a signature mismatch, adding permissions is useless; read the full error message first. ③ “If a managed service has a problem, you can only open a support ticket”—most problems are on the configuration side; the reason dimension of DiscardedSamples in the AWS/Prometheus namespace will tell you directly why samples were dropped.

Diagram: segment checklist

① Collectionup exists? = 1?describe-scraper statusAccess entry / private endpointSecurity group → :5000relabel matches? ② IngestionHTTP 403 / 400 / 429DiscardedSamples{reason}IngestionRate / ActiveSeriesLabel set limitssamples > 1 hour ③ Queryawscurl direct querydata source URL / Regionworkspace role aps:Query*query sample limitGrafana variables/time range ④ Alertingrules health / lastErroralerts pending/firingSilences / inhibitionNotificationsFailedTopic policy / KMS / subscriptions
Figure 7-1 From left to right, confirm “the data arrived” for each segment before moving to the next

Diagram: the three states of up

up absenttarget not discovered: relabel / SD permissions / DNSor the data was never written (see ②) up == 0discovered but scrape failed: network / port / pathTLS / authorization / response > 50 MB up == 1collection healthy: the problem is in the query or alerting segmentor the metric name/label is wrong
Figure 7-2 The managed collector automatically generates up for each discovered endpoint

Fault reproduction simulator

Choose a symptom and step through the checks with “Next diagnostic step”; each step shows the command and (example) output, and finally gives the root cause and fix.

Choose a fault symptom.
$ # Diagnostic output

A more complete interactive troubleshooting decision tree is inModule 8's “Troubleshooting” tab.

Diagnostic command quick reference

SegmentCommandWhat to check
①ampq 'up',ampq 'scrape_samples_scraped'Target exists / is 1; samples per scrape
①aws amp describe-scraper --scraper-id $SCRAPER_IDstatus, statusReason, roleArn, configuration
①aws eks list-access-entries,describe-clustercollector access entries, authentication mode, private endpoint
②aws cloudwatch get-metric-statistics --namespace AWS/Prometheus --metric-name DiscardedSamplesCheck discard reasons by the reason dimension
②kubectl -n adot logs deploy/amp-collectorADOT HTTP status and full error text
③awscurl … /api/v1/queryQuery directly, bypassing Grafana
③aws iam simulate-principal-policywhether the workspace role allows aps:QueryMetrics
④awscurl … /api/v1/rules | jq,/api/v1/alerts,/alertmanager/api/v2/silencesrule health, alert state, silences
④aws logs tail /aws/prometheus/prom-labrule / Alertmanager error logs
source ~/promlab/aws.env
# One-click health check script (read-only)
echo "== scraper";   aws amp describe-scraper --scraper-id $SCRAPER_ID --query 'scraper.status'
echo "== targets";   ampq 'count by (job) (up == 1)' | jq -r '.data.result[] | "\(.metric.job)=\(.value[1])"'
echo "== down";      ampq 'up == 0' | jq -r '.data.result[] | .metric.instance'
echo "== rules";     awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/rules" | jq -r '.data.groups[].rules[] | select(.health!="ok") | "\(.name): \(.lastError)"'
echo "== firing";    awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/alerts" | jq -r '.data.alerts[] | "\(.labels.alertname) \(.state)"'
echo "== discarded"; aws cloudwatch list-metrics --namespace AWS/Prometheus --metric-name DiscardedSamples --query 'Metrics[].Dimensions' --output json | head -20
== scraper
{ "statusCode": "ACTIVE" }
== targets
myapp=2
kubernetes-apiservers=2
cadvisor=2
== down
== rules
== firing
== discarded
[]

How to verify: When healthy, down, rules, firing and discarded are all empty. Common errors: Running in AWS_REGION a new terminal where the variables are not set, so awscurl signs with the default region → signature mismatch. Production use: Put the health check script in the on-call runbook, or make it a scheduled Lambda that writes its output to CloudWatch.

Lab 7: Reproduce and fix 4 faults (about 9 minutes)

Fault A: relabel drops all targets (collection segment)
cp scraper.yml scraper-bad.yml
sed -i 's/regex: myapp;myapp;http/regex: myapp;my-app;http/' scraper-bad.yml
aws amp update-scraper --scraper-id $SCRAPER_ID --scrape-configuration configurationBlob=$(base64 -w0 scraper-bad.yml)
aws amp wait scraper-active --scraper-id $SCRAPER_ID; sleep 120
ampq 'up{job="myapp"}' | jq '.data.result | length'
0

Diagnosis: up does not exist → discovery segment problem; compare kubectl get pods --show-labels. Fix: use the original scraper.yml then run update-scraper. About 5 minutes later MyappTargetMissing the alert will fire, which is a good way to verify the alert chain.

Fault B: wrong signing region (write segment, using the local agent from Module 2)
sed -i 's/region: ca-central-1/region: us-east-1/' ~/promlab/aws-agent.yml
eval "$(aws configure export-credentials --format env)"
docker run --rm -d --name aws-agent -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN \
  -v ~/promlab/aws-agent.yml:/etc/prometheus/prometheus.yml:ro prom/prometheus --config.file=/etc/prometheus/prometheus.yml --agent
sleep 45; docker logs aws-agent 2>&1 | grep -m1 -i 'status 403'
... msg="Failed to send batch, retrying" err="server returned HTTP status 403 Forbidden: {\"message\":\"The request signature we calculated does not match the signature you provided...\"}"

Fix: change back to ca-central-1; cleanup: docker rm -f aws-agent,unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN.

Fault C: wrong Grafana data source region (query segment): In AMG, duplicate the AMP data source, change Default Region to us-east-1, and click Save & test → fails (signing region does not match the endpoint). Meanwhile, a direct awscurl query still works → this proves the data is in AMP and the problem is in the Grafana configuration. Delete the duplicated data source.
Fault D: SNS topic policy overwritten (alert segment)
aws sns get-topic-attributes --topic-arn $TOPIC_ARN --query Attributes.Policy --output text > policy-backup.json
# Simulates a colleague "tidying up the policy" and deleting the AMP statement
jq '.Statement |= map(select(.Sid!="Allow_Publish_Alarms"))' policy-backup.json > policy-broken.json
aws sns set-topic-attributes --topic-arn $TOPIC_ARN --attribute-name Policy --attribute-value file://policy-broken.json
kubectl -n myapp scale deploy/redis --replicas=0     # triggers MyappRedisDown
sleep 300
aws cloudwatch get-metric-statistics --namespace AWS/Prometheus --metric-name AlertManagerNotificationsFailed \
  --dimensions Name=Workspace,Value=$WS_ID --statistics Sum --period 300 \
  --start-time $(date -u -d '-15 min' +%FT%TZ) --end-time $(date -u +%FT%TZ) --query 'Datapoints[].Sum'
[ 3.0 ]

Diagnosis: the alert is in /alertmanager/api/v2/alerts Alertmanager → routing is fine; NotificationsFailed > 0 → delivery was rejected; the watchdog alert (Module 6) should send an email to the watchdog topic. Fix: aws sns set-topic-attributes … file://policy-backup.json; restore the Redis replica to 1.

Postmortem: for each fault, write one sentence on prevention (for example: scrape configuration changes go through a PR plus a post-deployment check count(up{job="myapp"}); manage topic policies with IaC and enable drift detection).

Case 1: myapp up=0 after node group migration

Problem: A new node group with a custom security group was created, and after migration all myapp targets were up=0 (context deadline exceeded), while the apiserver targets were healthy. Root cause: The new node security group did not allow inbound port 5000 from the collector ENI (cluster security group). Fix: Add an inbound rule to the node security group (source = cluster security group); add "monitoring ENI reachability" to the node group template checklist.

Case 2: DiscardedSamples{reason="greater_than_max_sample_age"} shows up every early morning

Problem: An edge cluster that sends metrics back over a VPN has a 70-minute VPN maintenance window every morning; after it recovers, many samples are dropped. Root cause: AMP rejects samples older than 1 hour. Approach: Accept the gap and exclude the maintenance window from SLO calculations; or shorten the maintenance time; alert separately on "missing data".

Case 3: Grafana dashboard intermittently shows "query processing would load too many samples"

Problem: The "last 30 days" dashboard runs myapp_http_request_duration_seconds_bucket a query that directly computes quantiles. Root cause: A single query processes more than 50 million samples per 24-hour range. Fix: Use recording rules myapp:http_request_duration_seconds:p95_5m, so long-range panels query the recording rule results; set the maximum data points and minimum interval in Grafana.

Common errors and fixes (quick reference across segments)

server returned HTTP status 403 Forbidden: The security token included in the request is expired

Cause: Manually exported SSO/STS temporary credentials have expired (common in local labs); in production, the Pod did not receive automatically rotated role credentials.

aws sts get-caller-identity
kubectl -n adot exec deploy/amp-collector -- env | grep -E 'AWS_CONTAINER_CREDENTIALS_FULL_URI|AWS_ROLE_ARN'

Fix: On your machine, re-authenticate with aws sso login and export the credentials; for the Pod, check the Pod Identity association (SA name, namespace) and restart the Pod.

DiscardedSamples reason=per_user_series_limit / per_labelset_series_limit

Cause: Active series exceed the workspace or label set limit.

ampq 'topk(10, count by (__name__) ({__name__=~".+"}))'

Fix: In the collector configuration, use metric_relabel_configs to drop high-cardinality labels or metrics; request a quota increase if needed (Lesson 7 covers cardinality in detail).

DiscardedSamples reason=new-value-for-timestamp (duplicate samples with different values)

Cause: Two scrapers (for example, a managed collector plus ADOT, or two Prometheus replicas) write to the same series with identical labels.

Fix: Make sure there is only one scraper; for HA replicas, use cluster + __replica__ external labels to enable AMP deduplication.

scraper statusCode CREATION_FAILED; statusReason indicates the subnet has no available IPs or a resource does not exist

Cause: Each subnet needs at least 1 available IP (ENI); the security group, subnets and cluster must exist.

aws ec2 describe-subnets --subnet-ids $S1 $S2 --query 'Subnets[].{id:SubnetId,az:AvailabilityZone,free:AvailableIpAddressCount}'
Command-line exercises
1. List all targets with up = 0 and their job.
ampq 'up == 0' | jq -r '.data.result[] | "\(.metric.job) \(.metric.instance)"'
2. Verify whether the workspace role is allowed to run aps:QueryMetrics on prom-lab.
aws iam simulate-principal-policy --policy-source-arn arn:aws:iam::$ACCT:role/prom-lab-grafana-role \
  --action-names aps:QueryMetrics --resource-arns $WS_ARN --query 'EvaluationResults[].EvalDecision'
Scenario analysis
On Monday morning, all myapp dashboards in AMG show No data, but alerts such as MyappRedisDown kept firing over the weekend. How do you locate the problem within 5 minutes?

Alerts still fire → the collection and write segments are working and AMP holds data (the ruler is querying it). The problem is in the query segment: ① query directly with awscurl myapp_http_requests_total to confirm there is data; ② data source Save & test: if 403 not authorized → the workspace role policy was changed (check CloudTrail's PutRolePolicy/DetachRolePolicy); if signature mismatch → the data source region was changed; ③ if the data source is fine → check dashboard variables (for example cluster variable values changed) and the time range. Someone may have upgraded the workspace version over the weekend (v12 migrates the AMP data source to the new plugin); check whether the data source UID changed.

Verified teaching videos

▶
Kubernetes Observability Accelerated ft. Grafana, Prometheus, CloudWatch, CDK and Terraform — Containers from the Couch
English · EKS Observability Accelerator: AMP + AMG + CloudWatch in practice
▶
Kubernetes Monitoring Using AWS Managed Prometheus and Grafana on AWS EKS — Cloud Quick Labs
English · end-to-end setup from a community channel; useful for comparing against the troubleshooting steps

No verified English video specifically covering AMP managed collector troubleshooting was found, so a storyboard script is provided below.

Official documentation

Video storyboard script (about 90 seconds)

This courseware cannot generate video or MP3 directly; the storyboard below can be handed to a video tool.

Shot 1 · 0–25s
Visual: a pipe split into four sections (collection, write, query, alerting), with a pressure gauge on each section.
Narration: Managed monitoring troubleshooting follows the data flow in four segments, and each segment has one gauge to check: up, HTTP status code, awscurl, and alert delivery metrics.
Shot 2 · 25–60s
Visual: two 403 cards; one reads "signature mismatch" with an arrow pointing to "client configuration"; the other reads "not authorized" with an arrow pointing to "IAM".
Narration: Both are 403s, but a signature mismatch means checking the region and service name, while only "not authorized" means checking the IAM policy.
Shot 3 · 60–90s
Visual: a CloudWatch chart with DiscardedSamples stacked by reason, in different colors.
Narration: AMP tells you why samples were dropped, broken down by dimension: too old, over limit, duplicate, or invalid labels. It is all clear at a glance.
or score ≥ 70% on the quiz

Module 8 · Cost, Cleanup and Self-Check

54:00 – 60:00 · The managed monitoring bill has five parts: collector hours, collected samples, ingested samples, storage and queries, and Grafana active users. When cleaning up, delete first the resources that are billed hourly and do not disappear with the cluster.
6 minutesAMP free tier: 40 million ingested samples per monthCollectors are not deleted with the cluster★★★★☆
Learning objectives
  • Estimate the monthly cost of AMP + managed collector + AMG using public rates, and name 5 cost-reduction measures.
  • Clean up all resources from this lesson in the correct order (AMG, collector, workspace, SNS, CloudWatch alarms, IAM, EKS), and verify that zero resources remain.
  • Use the interactive troubleshooting decision tree to review the fault-diagnosis path for the whole lesson.
Prerequisites: Modules 1–7. Importance:★★★★☆

What: bill breakdown (public rates verified 2026-11; regional prices may differ)

ItemBilling unitRate (pricing page example)Main drivers
Managed collectorCollector hours + collected samples0.04 USD/hour; 0.03 USD per 10 million samplesNumber of collectors; targets × series per target ÷ scrape interval
AMP ingestionIngested samples0.90 USD per 10 million (first 2 billion; higher tiers are cheaper)Same as above (ADOT/agent samples count too)
AMP storageGB-month (after compression)0.03 USD / GBSample volume × retention period
AMP queriesQuery-processed samples (QSP)0.10 USD per 1 billionDashboard refreshes, long-range queries,rule evaluation (rules are also billed per query)
AMGActive users / workspace / monthEditor/Admin 9 USD, Viewer 5 USD; enterprise plugins +45 USDUsers who log in or call the API during the month
CloudWatchAPI request metrics, alarms, logsSee the CloudWatch pricing pageGrafana CloudWatch panel refreshes, YACE, log volume

Free tier (supported regions): 40 million ingested samples, 200 billion query-processed samples and 10 GB storage per month; AMG 90-day trial (up to 5 free users per account).

Why: where waste most often happens

  • Duplicate collection: a managed collector plus an in-cluster Prometheus or ADOT scraping the same targets doubles both collection and ingestion charges.
  • Unused metrics: default scrape configurations collect all cAdvisor and kube-proxy metrics, most of which are never queried.
  • Long-range dashboards computing raw histograms directly: QSP spikes, and it can hit the query limit.
  • Forgotten deletions: collectors (base fee of about 29 USD per month) keep billing after the cluster is deleted and keep retrying failed scrapes; the AMG workspace itself is not billed hourly, but any user login generates a license fee.

How: five cost-reduction measures

  1. metric_relabel_configs Keep only the metrics and namespaces you need (the cAdvisor keep rule from Module 3).
  2. Relax the scrape interval for non-critical jobs from 30 seconds to 60 seconds (halves the samples).
  3. Pre-aggregate with recording rules; dashboards query the recording rules instead of raw series.
  4. Shorten the retention period to meet compliance requirements (--retention-period-in-days).
  5. Assign Viewer to read-only users in AMG; grant access by group, so access expires automatically when someone leaves.

When: principles for cleanup order

First delete the resources that are billed independently, do not depend on the cluster, but reference it (AMG, collectors); then delete the workspace and its dependencies (rules, Alertmanager and logging configuration are deleted with the workspace); then delete SNS, CloudWatch and IAM; finally delete the EKS cluster (managed node groups and NAT gateways are removed with the CloudFormation stack).

Common misconceptions① "Deleting the EKS cluster removes the collector" — collectors must be deleted separately delete-scraper. ② "Deleting the AMP workspace also deletes the SNS topic" — the SNS topic is an independent resource. ③ "AMG is free if nobody logs in" — any single login or API call in the month (including by an automated service account) counts as one user.

Diagram: cost grows linearly with scrape volume

Series count Stargets × series per target ÷ scrape interval Tsamples/second = S / T Collected-sample fee0.03 per 10 million Ingested-sample fee0.90 per 10 million Storage fee× retention period Cost-reduction leversReduce S (relabel)Increase T (60s)
Figure 8-1: samples per month ≈ S / T × 2,592,000 (seconds in 30 days)

Diagram: cleanup order

① AMGus-east-1 ② Collectordelete-scraper ③ AMP workspaceIncludes rules/AM ④ SNS / CWTopic, alarms, logs ⑤ IAMRoles / associations ⑥ EKSeksctl delete
Figure 8-2: delete the independently billed resources that reference the cluster first, and delete the cluster last

Interactive 1: AMP + collector + AMG monthly cost calculator





$ # Calculation steps

Storage is roughly estimated at about 1–2 bytes per sample (after compression), for comparison only; use the AWS Pricing Calculator as the authoritative source.

Interactive 2: sort the cleanup order

Click the steps in the correct order (the first one you click goes first), then click "Check".

(nothing selected yet)

Cleanup commands (in order)

#CommandNotes
1aws grafana delete-workspace --region us-east-1Stops license billing; the dashboards are deleted along with it (export the JSON first if needed)
2aws amp delete-scraper + wait scraper-deletedMust be run separately both before and after deleting the cluster
3aws amp delete-workspace + wait workspace-deletedRules, Alertmanager definitions and data are all deleted
4aws cloudwatch delete-alarms,aws sns delete-topic,aws logs delete-log-groupwatchdog, both topics, AMP log group
5aws iam delete-role-policy / detach-role-policy / delete-roleprom-lab-grafana-role, prom-lab-adot
6eksctl delete cluster -f prom-lab.yamlNode groups, VPC and NAT are deleted with the stack
source ~/promlab/aws.env
# 1) AMG (export dashboard backups first)
aws grafana delete-workspace --region $AMG_REGION --workspace-id $GF_ID
# 2) Managed collector
aws amp delete-scraper --scraper-id $SCRAPER_ID
aws amp wait scraper-deleted --scraper-id $SCRAPER_ID
# 3) AMP workspace (including logging configuration, rules, Alertmanager definitions)
aws amp delete-logging-configuration --workspace-id $WS_ID 2>/dev/null
aws amp delete-workspace --workspace-id $WS_ID
aws amp wait workspace-deleted --workspace-id $WS_ID
# 4) CloudWatch / SNS / logs
aws cloudwatch delete-alarms --alarm-names prom-lab-am-notify-failed
for t in prom-lab-alerts prom-lab-watchdog; do aws sns delete-topic --topic-arn arn:aws:sns:$AWS_REGION:$ACCT:$t; done
aws logs delete-log-group --log-group-name /aws/prometheus/prom-lab 2>/dev/null
# 5) IAM and optional ADOT
aws eks delete-addon --cluster-name $CLUSTER --addon-name adot 2>/dev/null
aws iam delete-role-policy --role-name prom-lab-grafana-role --policy-name read-amp-cw
aws iam delete-role --role-name prom-lab-grafana-role
aws iam detach-role-policy --role-name prom-lab-adot --policy-arn arn:aws:iam::aws:policy/AmazonPrometheusRemoteWriteAccess 2>/dev/null
aws iam delete-role --role-name prom-lab-adot 2>/dev/null
# 6) EKS (about 10–15 minutes)
eksctl delete cluster -f prom-lab.yaml --wait
# Verify zero resources remain
aws amp list-scrapers --query 'scrapers[].scraperId'
aws amp list-workspaces --query 'workspaces[?alias==`prom-lab`].workspaceId'
aws grafana list-workspaces --region $AMG_REGION --query 'workspaces[?name==`prom-lab`].id'
aws sns list-topics --query 'Topics[?contains(TopicArn, `prom-lab`)]'
aws eks list-clusters --query 'clusters[?@==`prom-lab`]'
aws cloudwatch describe-alarms --alarm-name-prefix prom-lab --query 'MetricAlarms[].AlarmName'
[]
[]
[]
[]
[]
[]

How to verify: All six queries return []. Common errors: Deleting the cluster first leaves the collector in a failed state but still present (delete-scraper is still required); ECR repositories myapp are not in the table above; if you no longer need them, use aws ecr delete-repository --repository-name myapp --force; experiment users in Identity Center must be deleted manually. Service-linked roles AWSServiceRoleForAmazonPrometheusScraper* are not billed and can be kept.

Lab 8: estimate, reduce cost, clean up (about 6 minutes)

Measure the actual sample rate:
ampq 'sum(scrape_samples_scraped) / 30'          # samples per second (30-second interval)
ampq 'topk(5, sum by (job) (scrape_samples_scraped))'
... "value":[1763196000,"412.5"]
... cadvisor 9850 · kubernetes-apiservers 2210 · myapp 118 ...

412.5 samples/s × 2,592,000 s ≈ 1.07 billion samples/month: collection ≈ 3.2 USD, ingestion ≈ (1.07 billion − 40 million free) × 0.09 USD per million ≈ 93 USD. As shown, cAdvisor and apiserver metrics account for most of it.

Cost-reduction exercise: in the scraper.yml kubernetes-apiservers job, add metric_relabel_configs, keeping only apiserver_request_total and apiserver_request_duration_seconds_bucket; for cAdvisor, keep only container_cpu_usage_seconds_total,container_memory_working_set_bytes; update-scraper 10 minutes after the change, measure again and compare the sample rates.
Export dashboard backups: curl -s -H "Authorization: Bearer $TOKEN" "$GF_URL/api/dashboards/uid/myapp-amp" > myapp-amp-backup.json (requires recreating the service account token).
Cleanup: run them in the order on the “Commands” tab, and run the verification commands to confirm that all 6 [] items are gone.

Case 1: AMP monthly bill reduced from 4200 USD to 1300 USD

Problem: Default scrape configurations for 20 clusters wrote all cAdvisor, kube-proxy and apiserver metrics into AMP. Approach: Use count by (__name__) to find the top 50 metrics, compare them with the metrics actually referenced in dashboards and rules, and drop the unused ones in the collector metric_relabel_configs with drop rules; set non-critical jobs to 60 seconds. Limitation: Before deleting metrics, confirm that no temporary troubleshooting is using them, and keep a "full collection" switch so it can be turned on temporarily during incidents.

Case 2: AMG license governance

Problem: Everyone was an Editor, and the monthly license cost was 1800 USD. Approach: Grant access by Identity Center group; downgrade 90% of users to Viewer (5 USD), and give Editor only to the platform and SRE teams; use a single service account for automation. Limitation: Viewers cannot save queries in Explore, so common dashboards need to be provided.

Case 3: "zombie collectors" from decommissioned clusters

Problem: The bill showed 6 collectors whose clusters had been deleted long ago. Approach: Run weekly list-scrapers, compare the result with eks list-clusters, and alert on collectors whose source cluster no longer exists; keep collectors in the same IaC stack as their cluster. Limitation: Before deleting a collector, confirm that no new cluster with the same name depends on it.

Interactive troubleshooting decision tree: end-to-end AWS managed Prometheus

Start from the symptom and answer the questions step by step to get the diagnosis and the fix commands.

Common errors during cleanup

delete-workspace: ConflictException — workspace has active scrapers / resource in use

Cause: Collectors still target this workspace (the exact error wording may differ).

aws amp list-scrapers --query "scrapers[?destination.ampConfiguration.workspaceArn=='$WS_ARN'].scraperId"

Fix: delete these collectors first and wait for the deletion to finish scraper-deleted.

eksctl delete cluster hangs while deleting the VPC / subnets (DependencyViolation)

Cause: Subnets still have ENIs, for example the collector's ENI (the collector was not deleted) or a load balancer left over from another lab.

aws ec2 describe-network-interfaces --filters Name=subnet-id,Values=$S1 --query 'NetworkInterfaces[].{id:NetworkInterfaceId,desc:Description,status:Status}'

Fix: Delete the collector or load balancer and retry eksctl delete cluster.

DeleteConflict: Cannot delete entity, must detach all policies first

Cause: The role still has managed or inline policies attached.

aws iam list-attached-role-policies --role-name prom-lab-adot
aws iam list-role-policies --role-name prom-lab-grafana-role
Command-line exercises
1. Find all managed collectors whose source cluster no longer exists (output the collector ID and cluster ARN).
CLUSTERS=$(aws eks list-clusters --query clusters --output text)
aws amp list-scrapers --query 'scrapers[].[scraperId,source.eksConfiguration.clusterArn]' --output text |
while read id arn; do n=${arn##*/}; echo "$CLUSTERS" | grep -qw "$n" || echo "orphan: $id $arn"; done
2. Find the 5 metric names with the most series (and therefore the most ingested samples).
# Each series produces one sample per scrape interval, so sorting by series count ≈ sorting by sample volume
ampq 'topk(5, count by (__name__) ({__name__=~".+"}))'
Scenario analysis
Finance wants to halve the monitoring cost of 10 development clusters similar to prom-lab, without affecting alerting. Provide a plan and an estimation approach.

① Measure the sample rate and top metrics per cluster (scrape_samples_scraped,count by (__name__)); ② keep only the metrics used by rules and dashboards (drop the other cAdvisor/apiserver metrics), which typically cuts 50–80%; ③ set the development clusters' scrape interval to 60 seconds (halving again); ④ reduce retention from 150 days to 30 days (storage cost drops proportionally); ⑤ scaling development clusters down overnight does not reduce the collector hourly fee (a fixed 0.04 USD per collector-hour), so delete the collectors of clusters that stay idle for a long time; ⑥ developers use Viewer in AMG. Before dropping metrics, use promtool to list the metric names referenced by rules and use them as an allowlist.

Verified teaching videos

▶
Cost Observability using Amazon Managed Grafana | The Keys to AWS Optimization | S7 E11 — The Keys to AWS Optimization
English · using AMG to observe costs
▶
500 million active time series in Amazon Managed Service for Prometheus — Containers from the Couch
English · design discussion on scale and cost

Official documentation

Video storyboard script (about 70 seconds)

This courseware cannot generate video or MP3 directly; the storyboard below can be handed to a video tool.

Shot 1 · 0–25s
Visual: the bill is split into five colored blocks: collector hours, collected samples, ingested samples, storage and queries, and Grafana users.
Narration: The managed monitoring bill has five blocks; the largest is usually ingested samples, which equals the number of series divided by the scrape interval.
Shot 2 · 25–50s
Visual: a pair of scissors cuts away a pile of gray cAdvisor metrics, and the meter number goes down.
Narration: Keep only the metrics you use and change non-critical tasks to sixty seconds, and the cost drops immediately.
Shot 3 · 50–70s
Visual: six numbered blocks disappear one by one: AMG, collector, workspace, SNS, IAM, EKS.
Narration: When cleaning up, delete Grafana and the collector first, the cluster last, then use six queries to confirm nothing is left.
or score ≥ 70% on the quiz

Command cheat sheet

AMP · Managed collector · AMG · Rules/Alertmanager · SNS · CloudWatch · Cleanup
Post-lesson reviewca-central-1 / us-east-1

Variables and query helpers

export AWS_REGION=ca-central-1 CLUSTER=prom-lab AMG_REGION=us-east-1
export WS_ID=ws-... WS_ARN=arn:aws:aps:ca-central-1:ACCT:workspace/ws-...
export AMP_EP=https://aps-workspaces.$AWS_REGION.amazonaws.com/workspaces/$WS_ID
ampq(){ awscurl --service aps --region $AWS_REGION \
  "$AMP_EP/api/v1/query?query=$(python3 -c 'import sys,urllib.parse;print(urllib.parse.quote(sys.argv[1]))' "$1")"; }

AMP workspace

aws amp create-workspace --alias prom-lab
aws amp wait workspace-active --workspace-id $WS_ID
aws amp describe-workspace --workspace-id $WS_ID
aws amp describe-workspace-configuration --workspace-id $WS_ID
aws amp update-workspace-configuration --workspace-id $WS_ID --retention-period-in-days 30
aws amp update-workspace-configuration --workspace-id $WS_ID \
  --limits-per-label-set 'limits={maxSeries=200000},labelSet={namespace=myapp}'

Managed collector

aws amp get-default-scraper-configuration --query configuration --output text | base64 -d
aws amp create-scraper --alias prom-lab \
  --source eksConfiguration="{clusterArn='$CLUSTER_ARN',securityGroupIds=['$SG'],subnetIds=['$S1','$S2']}" \
  --scrape-configuration configurationBlob=$(base64 -w0 scraper.yml) \
  --destination ampConfiguration="{workspaceArn='$WS_ARN'}"
aws amp update-scraper --scraper-id $SCRAPER_ID --scrape-configuration configurationBlob=$(base64 -w0 scraper.yml)
aws amp list-scrapers; aws amp describe-scraper --scraper-id $SCRAPER_ID
aws eks list-access-entries --cluster-name $CLUSTER

Rules and Alertmanager

base64 -w0 rules.yaml > rules.b64
aws amp create-rule-groups-namespace --workspace-id $WS_ID --name myapp --data file://rules.b64
aws amp put-rule-groups-namespace    --workspace-id $WS_ID --name myapp --data file://rules.b64
base64 -w0 alertmanager.yaml > am.b64
aws amp create-alert-manager-definition --workspace-id $WS_ID --data file://am.b64
aws amp put-alert-manager-definition    --workspace-id $WS_ID --data file://am.b64
awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/rules"
awscurl --service aps --region $AWS_REGION "$AMP_EP/api/v1/alerts"
awscurl --service aps --region $AWS_REGION "$AMP_EP/alertmanager/api/v2/silences"

AMG

aws grafana list-versions --region us-east-1
aws grafana create-workspace --region us-east-1 --workspace-name prom-lab \
  --account-access-type CURRENT_ACCOUNT --authentication-providers AWS_SSO \
  --permission-type CUSTOMER_MANAGED --workspace-role-arn $GF_ROLE_ARN --grafana-version 12.4
aws grafana update-permissions --region us-east-1 --workspace-id $GF_ID \
  --update-instruction-batch "action=ADD,role=VIEWER,users=[{id=$GID,type=SSO_GROUP}]"
aws grafana create-workspace-service-account --region us-east-1 --workspace-id $GF_ID --grafana-role ADMIN --name ci
aws grafana create-workspace-service-account-token --region us-east-1 --workspace-id $GF_ID \
  --service-account-id $SA_ID --name ci --seconds-to-live 3600

SNS and CloudWatch

aws sns create-topic --name prom-lab-alerts
aws sns subscribe --topic-arn $TOPIC_ARN --protocol email --notification-endpoint you@example.com
aws sns set-topic-attributes --topic-arn $TOPIC_ARN --attribute-name Policy --attribute-value file://topic-policy.json
aws cloudwatch list-metrics --namespace AWS/Prometheus
aws cloudwatch put-metric-alarm --alarm-name prom-lab-am-notify-failed --namespace AWS/Prometheus \
  --metric-name AlertManagerNotificationsFailed --dimensions Name=Workspace,Value=$WS_ID \
  --statistic Sum --period 300 --evaluation-periods 1 --threshold 0 \
  --comparison-operator GreaterThanThreshold --alarm-actions $WD_TOPIC

ADOT (optional)

aws eks create-addon --cluster-name $CLUSTER --addon-name adot      # install cert-manager first
aws eks create-pod-identity-association --cluster-name $CLUSTER --namespace adot \
  --service-account adot-collector --role-arn arn:aws:iam::$ACCT:role/prom-lab-adot
# OpenTelemetryCollector: extensions.sigv4auth{region,service: aps}
#   exporters.prometheusremotewrite{endpoint, auth.authenticator: sigv4auth}

Cleanup

aws grafana delete-workspace --region us-east-1 --workspace-id $GF_ID
aws amp delete-scraper --scraper-id $SCRAPER_ID && aws amp wait scraper-deleted --scraper-id $SCRAPER_ID
aws amp delete-workspace --workspace-id $WS_ID && aws amp wait workspace-deleted --workspace-id $WS_ID
aws sns delete-topic --topic-arn $TOPIC_ARN
eksctl delete cluster -f prom-lab.yaml --wait

Quick troubleshooting table

SymptomMost likely causeFirst command
up does not existrelabel mismatch / SD permissions / VPC DNSkubectl get pods --show-labels compare the scraper configuration
up == 0Security group blocks the port, wrong port or path, response > 50 MBampq 'up == 0'
403 signature does not matchsigv4 region / service ≠ aps / clock skewgrep -A2 sigv4 configuration
403 not authorized aps:RemoteWriteRole missing permissions or wrong Resourceaws iam simulate-principal-policy
400 / DiscardedSamplessamples > 1 hour old, out of order, invalid labels, over limitaws cloudwatch list-metrics --namespace AWS/Prometheus --metric-name DiscardedSamples
Grafana No data, awscurl returns datadata source region / URL / role, variablesdata source Save & test
Alert firing but no emailsubscription not confirmed, topic policy, KMS, silencesaws sns get-topic-attributes
Alertmanager definition CREATION_FAILEDnon-SNS receiver, missing sigv4.region, missing wrapperaws amp describe-alert-manager-definition

Recommended configuration snippets

Prometheus agent → AMP

remote_write:
  - url: https://aps-workspaces.ca-central-1.amazonaws.com/workspaces/ws-.../api/v1/remote_write
    sigv4:
      region: ca-central-1
    queue_config:
      max_samples_per_send: 1000
      max_shards: 200
      capacity: 2500

Minimal AMP Alertmanager definition

alertmanager_config: |
  route:
    receiver: default
  receivers:
    - name: default
      sns_configs:
        - topic_arn: arn:aws:sns:ca-central-1:ACCT:prom-lab-alerts
          sigv4:
            region: ca-central-1

Capstone lab + final quiz

End-to-end managed monitoring for myapp: EKS → managed collector → AMP → rules/Alertmanager → SNS → AMG (Identity Center) → CloudWatch watchdog → cost reduction → cleanup
About 75–100 minutes (including waiting time)Cost about 1–2 USD
Scenario

You are a platform engineer who must set up "zero-agent" managed monitoring for myapp running on the EKS cluster prom-lab (ca-central-1). Metric data must stay in ca-central-1; on-call staff sign in to Grafana with their company identity and have view-only access; Redis failures and a high 5xx rate must notify an email address within 3 minutes; the monitoring system must have an independent alarm if it fails; monthly cost must be explainable; and zero resources remain after the lab ends.

Cluster and application: use prom-lab.yaml to create the cluster (private endpoint, API_AND_CONFIG_MAP) and deploy myapp ×2 + redis.
Acceptance: /metrics shows myapp_http_requests_total,myapp_http_request_duration_seconds_bucket, and myapp_redis_up.
AMP: create the workspace prom-lab, set retention to 30 days, and for namespace=myapp set a 200,000-series label set limit.
Acceptance: describe-workspace-configuration shows 30 days and the label set.
Managed collector: custom scrape configuration (myapp + trimmed apiserver + trimmed cAdvisor, 30 seconds), private subnets in two Availability Zones + cluster security group.
Acceptance: count by (job) (up == 1) shows myapp=2; the access entries include the collector role.
Rules and alerts: upload rules.yaml (2 recording rules + 4 alerting rules); the Alertmanager definition routes by severity to different message attributes of the same SNS topic, inhibits RedisDown → HighErrorRate; the topic policy includes SourceArn/SourceAccount conditions.
Acceptance: within 5 minutes after scaling Redis to 0, receive the [FIRING:1] MyappRedisDown email, and after recovery, a RESOLVED message.
AMG: in us-east-1, create a workspace (CUSTOMER_MANAGED role with query permissions only), make yourself ADMIN and another Identity Center user VIEWER; add AMP (region ca-central-1) and CloudWatch data sources; import the myapp dashboard via the service account API.
Acceptance: the VIEWER user can view the dashboards but cannot save them; the three dashboard panels have data.
Watchdog and hybrid dashboard: CloudWatch alarm AlertManagerNotificationsFailed > 0 → watchdog topic; add AMP's ActiveSeries and RuleEvaluationFailures panels to the dashboard.
Acceptance: simulate deletion of the topic policy (Module 7, Fault D); the watchdog email is delivered.
Cost report: measure sum(scrape_samples_scraped)/30, estimate the monthly cost with the Module 8 calculator; add drop rules for cAdvisor/apiserver, measure again, and write out the percentage reduction.
Acceptance: the report includes sample rates before and after cost reduction and the five-part cost breakdown.
Cleanup: clean up in the Module 8 order.
Acceptance: all six verification commands return [].
Acceptance checklist

Open-ended self-check (6 questions)

1. In one paragraph, explain to a new colleague all the components and identities involved in the path of managed-collector data from the Pod to a Grafana panel.

The collector creates ENIs in the two subnets you specified; using the service-linked role AWSServiceRoleForAmazonPrometheusScraper_* identity, it uses the EKS access entry that AMP creates automatically (read-only RBAC) to reach the cluster's private endpoint for kubernetes_sd discovery; relabel rules select the myapp Pod IP:5000, and /metrics is scraped directly over the ENI (the security group must allow it); samples get up and similar synthetic metrics attached, then remote_write is called with SigV4 using the same role credentials (region ca-central-1, service aps), and AMP verifies aps:RemoteWrite and checks the quotas before storing the data. Users sign in to AMG in us-east-1 through Identity Center and are mapped to Viewer; panel queries are signed by the AMP data source plugin using the workspace role (trusting grafana.amazonaws.com) and called /api/v1/query_range, and AMP validates aps:QueryMetrics the request before running the PromQL and returning the result.

2. When would you give up the managed collector and use ADOT instead? List at least 4 reasons.

You need a scrape interval shorter than 30 seconds; you need to scrape targets outside the cluster that are identified by DNS names, or use service discovery other than kubernetes_sd; you need OTLP metrics or traces; you need processors (filtering, transformation, attribute rewriting, sampling); you need an AMP workspace in a different region from the cluster (the collector requires the same region); or you need to send the same data to multiple backends at once.

3. Compare AMP rules + SNS with Grafana Alerting, and give your reasons for choosing between them in this lesson's scenario.

AMP rules: consistent with the Prometheus ecosystem (promtool testing, portable to kps in Lesson 5), large quota (2,000 rules), output unified to SNS and controlled by IAM, but only supports SNS and can only query AMP. Grafana Alerting: can span data sources (CloudWatch + AMP), rich contact points, but AMG allows 100 rule instances per workspace and alerts depend on AMG availability. This lesson is mainly metric alerting and requires portability, so choose AMP rules; for joint "ALB 5xx + application metrics" alerts, choose Grafana Alerting or import the ALB metrics into AMP.

4. Compliance requires that "monitoring data and access interfaces must not leave Canada". How would you adjust this lesson's architecture?

AMP, the collector, rules and Alertmanager are all in ca-central-1, which meets the requirement. AMG is not in ca-central-1, so instead self-host Grafana OSS in EKS (or a separate cluster): deploy with Helm, use the AMP data source plugin with a Pod Identity role (containing only aps:Query*), and use SSO through an Identity Center SAML application or an enterprise IdP's OIDC. Grafana's database uses RDS (ca-central-1), and you are responsible for upgrades and backups. Put the SNS topic in ca-central-1 too, and keep sensitive data out of email content.

5. After an incident, you find that Redis was down for 40 minutes, but the alert email arrived 25 minutes late. List the possible causes and the troubleshooting order.

Troubleshoot by segment: ① Rules: check whether for the duration is too long? Is the evaluation interval rule-query-offset? RuleGroupIterationsMissed② Data: has the collector scraping been interrupted (up Missing data makes min(myapp_redis_up)==0 does not hold! You should also have absent -type alert); ③ Alertmanager: group_wait/group_interval settings, whether it is suppressed or silenced,AlertManagerNotificationsThrottled; ④ SNS: AlertManagerNotificationsFailed, topic delivery failures, email provider delays. Improvement: for critical alerts, add absent(), shorten group_wait, and enable delivery status logging for SNS subscriptions.

6. Provide a layered plan for managing all of this lesson's resources with IaC.

Layer 1 (account level, changes rarely): Identity Center groups, the AMG workspace and workspace role, the SNS topic and policy, and the CloudWatch watchdog (Terraform/CloudFormation). Layer 2 (per cluster): the EKS cluster, the AMP workspace (or a shared one), the collector,AWS::APS::Scraper Pod Identity associations. Layer 3 (content, changes frequently): rule group namespaces and Alertmanager definitions (Git + CI promtool + put-*, or ACK CRs), and Grafana dashboards and data sources (Terraform Grafana provider using a service account token, or v13 Git Sync). Delete in the reverse order of creation, and make sure the collector is in the same stack as its cluster.

Sources and version notes

All AWS-related facts were verified on 2026-11-15 against docs.aws.amazon.com and the official pricing pages; parts that could not be tested are marked.
Verification date: 2026-11-15

Source table

TopicVerified findingSource (verification date)
AMP regions and endpointsca-central-1 available: control plane aps.ca-central-1.amazonaws.com, data plane aps-workspaces.ca-central-1.amazonaws.com (also FIPS and dual-stack .api.aws endpoints)AMP endpoints and quotas(2026-11-15)
AMP quotasActive series 50 million per workspace (adjustable, up to 1.5 billion); ingestion 1,666,666 samples/s; 150 labels per series, total label size 7 KB; samples >1 hour old rejected; out-of-order window default 60 seconds, max 600 seconds; queries 50 million samples / 12 million series / 5 GB per 24-hour range, time range 95 days; QueryMetrics 300 TPS; 2,000 rules, minimum evaluation interval 30 seconds; 25 workspaces per region; Alertmanager: 1,000 concurrent alerts, 100 inhibition rules, 100 route nodes, 100 templatesSame as above
AMP retention and workspace configurationDefault 150 days, configurable up to 1095 days; update-workspace-configuration supports --retention-period-in-days,--limits-per-label-set,--out-of-order-time-window-in-seconds,--rule-query-offset-in-secondsConfigure your workspace · CLI(2026-11-15)
AMP CLIsubcommands include create-scraper, update-scraper, get-default-scraper-configuration, create/put-rule-groups-namespace, create/put-alert-manager-definition, create-logging-configuration, create-query-logging-configuration, update-scraper-logging-configuration, anomaly-detector series; wait: workspace-active/deleted, scraper-active/deletedAWS CLI: amp(2026-11-15)
Managed collectorPrerequisites: the EKS cluster endpoint includes private access, and DNS is enabled in the VPC; at least 2 subnets in 2 Availability Zones; with the API/API_AND_CONFIG_MAP authentication mode, access entries are created automatically (RBAC rules in Module 3); manual mode uses aps-collector-role + eksctl create iamidentitymapping (the ARN with the service-role path removed); configuration allows only global/scrape_config/static_config/relabel_config/metric_relabel_configs/kubernetes_sd_config; interval ≥30 seconds; static targets must be IPs; authorization is Bearer + SA token file only; same region; 10 per region per account (adjustable); single response ≤50 MB; ≤30,000 endpoints per collector; deleting the cluster does not delete the collector, and a cluster with the same ARN reuses it; cross-account uses --role-configurationSet up managed collectors for Amazon EKS(2026-11-15)
remote write and SigV4URL https://aps-workspaces.REGION.amazonaws.com/workspaces/WS_ID/api/v1/remote_write; sigv4.region; official Helm example queue_config: max_samples_per_send 1000, max_shards 200, capacity 2500; managed policy AmazonPrometheusRemoteWriteAccessSet up ingestion from a new Prometheus server using Helm(2026-11-15)
AMP rulesCLI v2: after base64 encoding --data file://; once describe shows status ACTIVE, it is in effectUpload a rules configuration file(2026-11-15)
AMP AlertmanagerRoot level template_files + alertmanager_config; the only receiver is SNS (Standard topic); prohibited api_url,http_config; sigv4 must include region; repeat_interval maximum 5 days; the previous configuration stays in effect during putAlert manager configuration · SNS receiver · Upload(2026-11-15)
SNS topic policyPrincipal aps.amazonaws.com, actions sns:Publish,sns:GetTopicAttributes, conditions aws:SourceArn (workspace ARN) + AWS:SourceAccount; SSE topics must allow it in the KMS key policy kms:GenerateDataKey*,kms:Decrypt; opt-in regions use the regional service principalGive AMP permission to send to SNS(2026-11-15)
AMP usage metricsAWS/Usage (ResourceCount: ActiveSeries, IngestionRate, QueryMetricsTPS…) and AWS/Prometheus (DiscardedSamples by reason, RuleEvaluationFailures, AlertManagerNotificationsFailed…), free of chargeAMP CloudWatch usage metrics(2026-11-15)
AMP pricingIngestion 0.90 USD per 10 million samples (first 2 billion); storage 0.03 USD/GB; queries 0.10 USD per 1 billion samples; collector 0.04 USD per collector-hour + 0.03 USD per 10 million collected samples; rules billed per query; free tier 40 million ingested, 200 billion queried, 10 GB storage. The page does not list Canada region prices separately.AMP Pricing(2026-11-15)
AMG regionsService endpoints: us-east-1, us-east-2, us-west-2, ap-northeast-1/2, ap-southeast-1/2, eu-central-1, eu-west-1/2, GovCloud; does not include ca-central-1; 5 workspaces per region; 2,000 dashboards, 100 alert rule instances and 100 service accounts per workspaceAMG endpoints and quotas(2026-11-15)
AMG versionsOptions: 9, 10, 12, 13; v12 includes open-source 11.0–12.4 features, removes the legacy alerting, Angular and API keys, and migrates the AMP data source to the Amazon Managed Service for Prometheus plugin (the core plugin removes SigV4); v13 includes 13.0–13.2, Git Sync, and the CloudWatch PromQL query typeDifferences between Grafana versions(2026-11-15)
AMG creation and identityRequires AWSGrafanaAccountAdministrator; the first use of Identity Center also requires AWSSSOMemberAccountAdministrator + AWSSSODirectoryAdministrator; Identity Center requires Organizations (AMG can enable it on your behalf); IAM users and roles cannot be used for authorization inside the workspace; CLI/API only use CUSTOMER_MANAGED + workspace-role-arn; update-permissions roles ADMIN/EDITOR/VIEWER, types SSO_USER/SSO_GROUP; service account tokens last up to 30 daysCreate workspace · Identity Center · CLI create-workspace · update-permissions(2026-11-15)
AMG data source permissionsService-managed: AmazonGrafanaServiceRole-*, AMP policy (aps:ListWorkspaces/DescribeWorkspace/QueryMetrics/GetLabels/GetSeries/GetMetricMetadata), CloudWatch uses AmazonGrafanaCloudWatchAccess; customer-managed roles trust grafana.amazonaws.comAMG permissions and policies(2026-11-15)
AMG pricingEditor/Admin 9 USD, Viewer 5 USD per active user per workspace per month; enterprise plugins +45 USD; 90-day trial (up to 5 free users)AMG Pricing(2026-11-15)
ADOTCollector v0.51.0 (2026-10-29), v0.50.0 (2026-08-31, based on upstream v0.158.0); the EKS add-on installs the ADOT Operator, with the CR OpenTelemetryCollector (AWS example apiVersion v1alpha1); AMP pipeline: sigv4auth (region, service aps) + prometheusremotewrite; for CloudWatch metrics and logs, the CloudWatch Observability add-on is recommendedADOT Collector releases · ADOT EKS add-on(2026-11-15)
CloudWatch OTel + PromQL2026-06-16 announcement: native OTel metrics, PromQL queries, GB-based billing including 15-month storage, Prometheus-compatible query API, joint queries with metrics from 70+ services; commercial regions except me-central-1, me-south-1 and il-central-1What's New 2026-06(2026-11-15)
EKSThis series uses EKS 1.37 throughout, with a control plane of 0.10 USD/hour (standard support)Source page for Helm Lesson 4 · K8s course

Video verification notes

The videos below were verified for title and channel via YouTube oEmbed (https://www.youtube.com/oembed?url=…&format=json, 2026-11-15) verified the titles and channels: AWS Events “AWS re:Invent 2022 - Observability the open-source way (COP301-R)” (2IJPpdp9xU0), “AWS re:Invent 2025 - Scaling open source observability stack feat. Warner Bros Discovery (COP333)” (zZXeASq9Trs), “Agent-less Observability with Amazon Managed service for Prometheus - AWS OnAir S05” (1_SAP7QkRlU), “AWS re:Invent 2023 - Seamless observability with AWS Distro for OpenTelemetry (COM307)” (S4GfA2R0N_A); Containers from the Couch “Monitoring container workloads with Amazon Managed Service for Prometheus and Grafana” (Bh71xBQe92I), “Prometheus at Scale : Deep Dive Into The Engineering of Amazon Prometheus | Ep24” (2yaRBxi_shs), “500 million active time series in Amazon Managed Service for Prometheus” (GC-dQ_VZnPY), “Kubernetes Observability Accelerated ft. Grafana, Prometheus, CloudWatch, CDK and Terraform” (F6V4vscvOeY); Amazon Web Services “Introduction to Amazon Managed Service for Prometheus” (lcLZlQpISaw), “Run Queries Across Amazon Managed Service for Prometheus Workspaces” (BmmIOts-_vA), “AWS Supports You | Getting Started with OpenTelemetry and ADOT” (WZKvXaoo7QU), “Introduction to Amazon Managed Grafana” (ZdWm5CqOcm4), “Integrating Amazon Managed Service for Prometheus with Amazon Managed Grafana” (mRVEu8wwfnY), “Demo Video - Amazon Managed Service for Prometheus (AMP) & Amazon Managed Service for Grafana (AMG)” (fW2LOqHDUNM), “Leverage Service Level Objectives (SLOs) with Prometheus Metrics” (D0cdS4hmuhA), “Set Up an Amazon Managed Service for Grafana Dashboard with CloudWatch Integration” (y80Vn-FkBMc); Cloud Quick Labs “Kubernetes Performance Monitoring using Amazon CloudWatch Container Insights for AWS EKS.” (-8kFawk-EFs), “Kubernetes Monitoring Using AWS Managed Prometheus and Grafana on AWS EKS” (2qGDV0N14aY); AWS-Joe Alioto “Amazon CloudWatch OTel: Open Standards Observability, Managed by AWS - April 2026” (of6cXos-C0c); The Keys to AWS Optimization “Cost Observability using Amazon Managed Grafana | The Keys to AWS Optimization | S7 E11” (4cmY564DO2Q). No specific, verified videos were found for Module 5 (AMP Alertmanager + SNS topic policy) or Module 7 (managed collector troubleshooting), so storyboard scripts are provided instead. Some videos were recorded earlier, so the interface and features follow this lesson and the official documentation.

Narration notes

The “Narration” tab uses the browser's Web Speech API (en-US) to read the narration script aloud; English terms are pronounced with en-US. Results depend on the speech packs installed in the operating system. This courseware does not embed MP3 files; the narration script can be passed directly to a TTS tool such as Amazon Polly to generate audio.

Known limitations

  • All commands in this lesson are written from the official documentation,and have not actually been run in a real AWS account; in the expected output, account IDs, ARNs, workspace/collector/Grafana IDs, IPs, values, log formats and durations are examples. Error messages marked as "subject to the actual output" (for example collector private endpoint validation, Alertmanager definition failure reasons, the AMG unauthorized page, workspace deletion conflicts) may be worded differently.
  • AMG is not in ca-central-1, so this lesson conservatively chooses us-east-1. The behavior when the Identity Center instance and the AMG workspace are in different regions, and the traffic charges for cross-region data source queries, have not been tested; refer to the official documentation.
  • aws grafana list-versions The exact return value of 12.4 (the documentation says v12 covers up to 12.4); use the output of list-versions as the reference.
  • In the AMP Alertmanager definition, the matchers / source_matchers syntax follows the current open-source Alertmanager syntax; if it is rejected, you can switch to the older match / source_match syntax.
  • AWS/Prometheus The dimension name for namespace metrics (written in the example as Workspace) and the dimension combination of AWS/Usage should first be confirmed with list-metrics .
  • UI field names of the AMP data source plugin (Amazon Managed Service for Prometheus), YACE configuration key names, ADOT plugin version requirements for cert-manager, managed collector creation time, and the description field of collector ENIs may all change with versions.
  • Costs are order-of-magnitude estimates from public rates; the pricing pages do not list Canada region prices separately; for CloudWatch API rates, use the CloudWatch pricing page. CloudWatch OTel/PromQL is a new capability in 2026; for details, refer to the CloudWatch documentation.
  • The myapp image tag (this lesson assumes the tag /metrics maps to version myapp:1.1) and the source directory should follow what you actually built in Lesson 1.
  • The step order, timing and values in the animations and simulators are illustrative and used to explain the mechanism.