사용률이 낮은 예약 추천 보기 및 적용

이 페이지에서는 예약 추천을 사용하여 사용률이 낮은 주문형 예약을 식별 및 삭제하여 사용하지 않는 리소스에 대한 요금이 청구되지 않도록 하는 방법을 설명합니다.

  • 예약 추천자를 구성해서 수신되는 추천을 늘리거나 줄이는 방법에 대한 자세한 내용은 사용률이 저조한 예약 추천 구성 또는 유휴 상태 예약 추천 구성을 참조하세요.

    시작하기 전에

    • 제한사항을 검토하여 예약에서 사용률이 저조한 예약 추천을 지원하는지 확인합니다.
    • 아직 인증을 설정하지 않았다면 설정합니다. 인증은 Google Cloud 서비스 및 API에 액세스하기 위해 ID를 확인합니다. 로컬 개발 환경에서 코드 또는 샘플을 실행하려면 다음 옵션 중 하나를 선택하여 Compute Engine에 인증하면 됩니다.

    사용률이 저조한 예약 추천 보기

    사용률이 저조한 예약에 대한 추천을 보려면 다음 옵션 중 하나를 사용하세요.

    다음 방법 중 하나를 사용하여 이 작업을 완료합니다.

    콘솔

    1. Google Cloud 콘솔에서 FinOps 허브로 이동합니다.

      FinOps 허브로 이동

      상위 추천 섹션에서 사용률이 저조한 예약 추천을 확인할 수 있습니다.

      상위 추천 목록 보기

    2. 상위 추천 섹션에서 사용률이 저조한 예약과 연결된 추천을 클릭합니다.

      추천을 클릭하면 통계 섹션에 사용률 저하 정도가 표시됩니다.

      추천 세부정보가 포함된 페이지가 열립니다. 통계 섹션에서 사용률 저하 정도를 확인할 수 있습니다.

    3. 예약 세부정보를 보려면 예약 보기를 클릭합니다.

      예약 세부정보 보기를 클릭하면 예약 크기와 실제 사용률을 보여주는 사용률 섹션이 표시됩니다.

      수정을 클릭하면 구성 섹션이 사용 설정되며 여기에서 의도한 용도에 더 적합한 VM 수의 새 값을 설정할 수 있습니다.

      더 이상 예약이 필요하지 않으면 예약을 삭제하세요.

    gcloud

    사용률이 저조한 예약에 관한 추천을 보려면 --recommender=google.compute.RightSizeResourceRecommender 플래그와 함께 gcloud recommender recommendations list 명령어를 사용합니다.

    gcloud recommender recommendations list \
      --location=ZONE \
      --recommender=google.compute.RightSizeResourceRecommender \
      --format=yaml \
      --project=PROJECT_ID
    

    다음을 바꿉니다.

    • ZONE을 추천을 나열할 예약이 포함된 영역으로 바꿉니다.
    • PROJECT_ID를 프로젝트 ID로 바꿉니다.

    예를 들면 다음과 같습니다.

    gcloud recommender recommendations list \
      --location=us-central1-c \
      --recommender=google.compute.RightSizeResourceRecommender \
      --format=yaml \
      --project=my-project
    

    해당 위치에 사용률이 저조한 예약이 없으면 응답은 비어 있습니다. 그렇지 않으면 응답에는 각 추천에 대한 다음 필드가 포함됩니다.

    
    ---
    associatedInsights:
    - insight: projects/953727763714/locations/us-central1-f/insightTypes/google.compute.RightSizeResourceRecommender/insights/ecf77776-4a2a-4e6e-aad2-b7f9c632e5f9
    content:
    operationGroups:
    - operations:
      - action: remove
        path: /
        resource: //compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation
        resourceType: compute.googleapis.com/Reservation
    overview:
      currentReservation:
        machineType: n1-standard-1
        reservationName: test-reservation
        reservedMachineCount: '1'
        zone: us-central1-f
    description: Save cost by deleting the underutilized reservation test-reservation
    etag: '"aff724ab8e40e1ef"'
    lastRefreshTime: '2024-06-10T07:00:00Z'
    name: projects/953727763714/locations/us-central1-f/recommenders/google.compute.RightSizeResourceRecommender/recommendations/56f8ac5d-8380-4cb8-a76f-bbc270fb4b8e
    primaryImpact:
    category: COST
    costProjection:
      cost:
        currencyCode: USD
        nanos: -199820000
        units: '-1072'
      costInLocalCurrency:
        currencyCode: USD
        nanos: -199820000
        units: '-1072'
      duration: 2592000s
    priority: P2
    recommenderSubtype: DELETE_RESERVATION
    stateInfo:
    state: ACTIVE
    targetResources:
    - //compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation
    

    gcloud 예시에서 Google Cloud CLI를 사용하여 추천을 사용하는 방법을 자세히 알아보세요.

    REST

    사용률이 저조한 예약에 관한 추천을 보려면 recommendations.list 메서드에 대해 GET 요청을 실행하고 다음 추천 유형을 사용합니다.

    • google.compute.RightSizeResourceRecommender

    API 호출은 다음과 같습니다.

    GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/ZONE/recommenders/google.compute.RightSizeResourceRecommender/recommendations
    

    다음을 바꿉니다. - PROJECT_ID: 프로젝트의 ID. ZONE: 추천을 나열할 인스턴스가 포함된 영역.

    다음 예시에서는 curl 및 관련 샘플 응답을 사용하여 요청을 보내는 방법을 보여줍니다.

    PROJECT_ID=my-project
    ZONE=us-central1-c
    RECOMMENDER_ID=google.compute.RightSizeResourceRecommender
    
    curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "x-goog-user-project: $PROJECT_ID" \
      https://recommender.googleapis.com/v1/projects/$PROJECT_ID/locations/$ZONE/recommenders/$RECOMMENDER_ID/recommendations
    

    사용률이 저조한 예약 추천에 대한 JSON 응답의 예시:

    {
      "associatedInsights": [
        {
          "insight": "projects/9531234763714/locations/us-central1-f/insightTypes/google.compute.RightSizeResourceRecommender/insights/ecf77776-4a2a-4e6e-aad2-b7f9c632e5f9"
        }
      ],
      "content": {
        "operationGroups": [
          {
            "operations": [
              {
                "action": "remove",
                "path": "/",
                "resource": "//compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation",
                "resourceType": "compute.googleapis.com/Reservation"
              }
            ]
          }
        ],
        "overview": {
          "currentReservation": {
            "machineType": "n1-standard-1",
            "reservationName": "test-reservation",
            "reservedMachineCount": "1",
            "zone": "us-central1-f"
          }
        }
      },
      "description": "Save cost by deleting the underutilized reservation test-reservation",
      "etag": "\"8d5603cac8fa9342\"",
      "lastRefreshTime": "2024-06-11T07:00:00Z",
      "name": "projects/9531234763714/locations/us-central1-f/recommenders/google.compute.RightSizeResourceRecommender/recommendations/56f8ac5d-8380-4cb8-a76f-bbc270fb4b8e",
      "primaryImpact": {
        "category": "COST",
        "costProjection": {
          "cost": {
            "currencyCode": "USD",
            "nanos": -199820000,
            "units": "-1072"
          },
          "costInLocalCurrency": {
            "currencyCode": "USD",
            "nanos": -199820000,
            "units": "-1072"
          },
          "duration": "2592000s"
        }
      },
      "priority": "P2",
      "recommenderSubtype": "DELETE_RESERVATION",
      "stateInfo": {
        "state": "ACTIVE"
      },
      "targetResources": [
        "//compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation"
      ]
    }
    

    각 필드에 대한 자세한 내용은 Recommender API 참고 리소스를 참조하세요.

    권장사항 응답 해석

    gcloud CLI 또는 REST를 통해 수신하는 각 권장사항에는 순차적으로 수행하여 권장사항을 적용할 수 있는 작업으로 구성된 작업 그룹이 포함됩니다. 사용률이 저조한 예약의 경우 작업 그룹에 예약을 삭제하는 remove 작업이 포함됩니다.

    {
      "action": "remove",
      "path": "/",
      "resource": "//compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation",
      "resourceType": "compute.googleapis.com/Reservation"
    }
    

    사용률이 저조한 예약 추천 적용

    사용률이 저조한 예약 추천에 따라 예약 크기를 조정하거나 더 이상 필요하지 않은 경우 예약을 삭제합니다.

    다음 단계