Ich habe eine Cloud-Vorlage, die API-Gateway mit Titel Employee Management API
definiert hat. Ich möchte auf diesen Titel verweisen, wenn ich ein Cloudwatch-Dashboard für das API-Gateway definiere. Im Moment habe ich den Titel des API-Gateways fest in die Dashboard-Messwerte eingeordnet. Stattdessen, wenn ich in der Lage bin, die Titeleigenschaft des API-Gateways zu referenzieren, ist es besser.AWS Cloudbildung Cloudwatch Dashboard: Ref ApiGateway Titel
Im Folgenden sind Teile der Cloudformationsvorlage eingefügt, die das API-Gateway und das Dashboard definiert.
Cloudformation-Vorlage für die API-Gateway:
EmployeeApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
DefinitionBody:
swagger: "2.0"
info:
description: "This API allows clients to query and manage employees"
version: "1.0.0"
title: "Employee Management API"
contact:
email: "[email protected]"
basePath: "/v1"
tags:
- name: "employee"
description: "Operations related to a employee"
schemes:
- "https"
paths:
/brands:
.
.
.
Cloudformation-Vorlage für Armaturenbrett für API-Gateway
EmployeeAPIDashboard:
Type: AWS::CloudWatch::Dashboard
Properties:
DashboardName: "EmployeeAPIDashboard"
DashboardBody:
Fn::Sub: '{
"widgets": [
{
"type": "metric",
"x": 0,
"y": 0,
"width": 6,
"height": 6,
"properties": {
"view": "timeSeries",
"stacked": false,
"metrics": [
[ "AWS/ApiGateway", "IntegrationLatency", "ApiName", "Employee Management API", "Stage", "Prod", { "period": 86400, "yAxis": "right", "stat": "Sum" } ],
[ ".", "Count", ".", ".", ".", ".", { "period": 86400, "stat": "Sum"} ],
[ ".", "Latency", ".", ".", ".", ".", { "period": 86400, "yAxis": "right", "stat": "Sum"} ],
[ ".", "5XXError", ".", ".", ".", ".", { "period": 86400, "stat": "Sum", "color": "#FF0000" } ],
[ ".", "4XXError", ".", ".", ".", ".", { "period": 86400, "stat": "Sum", "color": "#FFA500" } ]
],
"region": "us-west-2",
"period": 300,
"title": "API Gateway"
}
}
]
}'