0

API 게이트웨이에 제목이 Employee Management API 인 Cloudform 템플릿이 있습니다. API 게이트웨이 용 Cloudwatch 대시 보드를 정의 할 때이 제목을 참조하고 싶습니다. 바로 지금 API 게이트웨이의 제목을 대시 보드 메트릭에 하드 코딩했습니다. 대신 API 게이트웨이의 제목 속성을 참조 할 수 있다면 더 좋습니다.AWS Cloudformation Cloudwatch 대시 보드 : Ref ApiGateway 제목

아래에 붙여 넣은 부분은 API 게이트웨이 및 대시 보드를 정의하는 Cloudformation 템플릿의 일부입니다.

Cloudformation 템플릿 API에 대한 게이트웨이 :위한 대시 보드

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 템플릿 API 게이트웨이 난 당신과 같이 여러 스택을 통해 스택 Output을 참조 할 수 있다고 생각

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" 
        } 
        } 
       ] 
      }' 

답변