Skip to content
gcp-cleanup logo

GCP 리소스 정리 (Read-Only 스캔)

gcp-cleanup

GCP 리소스 정리 (Read-Only 스캔)

SKILL.md

Full skill instructions

GCP 리소스 정리 (Read-Only 스캔)

사용하지 않는 GCP 리소스를 탐지만 수행. 삭제는 사용자가 직접 실행.

안전 원칙

  1. 읽기 전용 - 이 스킬은 조회만 수행, 삭제 명령 실행 안 함
  2. 명령어 제공 - 삭제가 필요하면 명령어를 출력하고 사용자가 직접 실행
  3. 보호 규칙 - prod/​production 포함 프로젝트는 경고 표시
  4. 복구 안내 - 프로젝트 삭제는 30일 내 복구 가능함을 안내

수행 작업

1. 프로젝트 목록 조회

gcloud projects list --format="table(projectId,name,lifecycleState)"

2. 각 프로젝트별 리소스 스캔

for PROJECT in $(gcloud projects list --format="value(projectId)" --filter="lifecycleState:ACTIVE"); do
  echo "=== $PROJECT ==="

  # TERMINATED VM (중지된 상태로 방치)
  echo "TERMINATED VMs:"
  gcloud compute instances list --project=$PROJECT \
    --filter="status:TERMINATED" \
    --format="table(name,zone,status)" 2>/​dev/​null || echo "  (접근 권한 없음)"

  # 연결되지 않은 디스크 (orphaned)
  echo "Orphaned Disks:"
  gcloud compute disks list --project=$PROJECT \
    --filter="-users:*" \
    --format="table(name,zone,sizeGb,type)" 2>/​dev/​null || echo "  (접근 권한 없음)"

  # 예약된 외부 IP (사용 안 함)
  echo "Unused Static IPs:"
  gcloud compute addresses list --project=$PROJECT \
    --filter="status:RESERVED" \
    --format="table(name,region,status)" 2>/​dev/​null || echo "  (접근 권한 없음)"

  # 리소스 카운트 (빈 프로젝트 판단)
  VM_COUNT=$(gcloud compute instances list --project=$PROJECT --format="value(name)" 2>/​dev/​null | wc -l)
  DISK_COUNT=$(gcloud compute disks list --project=$PROJECT --format="value(name)" 2>/​dev/​null | wc -l)

  if [ "$VM_COUNT" -eq 0 ] && [ "$DISK_COUNT" -eq 0 ]; then
    echo "  빈 프로젝트 (리소스 0개)"
  fi
  echo ""
done

출력 형식

## GCP 리소스 스캔 결과

### 정리 검토 대상

| 프로젝트 | 리소스 타입 | 이름 | 위치 | 비고 |
|----------|-------------|------|------|------|
| test-old | 빈 프로젝트 | - | - | 리소스 0개 |
| main-project | Orphaned 디스크 | disk-backup | asia-northeast3-a | 50GB, 미연결 |
| dev-project | TERMINATED VM | vm-test | us-central1-a | 중지 상태 |

---

## 직접 실행 필요

아래 명령어는 **복사하여 직접 실행**하세요. 이 스킬은 삭제를 수행하지 않습니다.

### 빈 프로젝트 삭제
\`\`\`bash
# test-old 프로젝트 삭제 (30일 내 복구 가능: gcloud projects undelete test-old)
gcloud projects delete test-old
\`\`\`

### Orphaned 디스크 삭제
\`\`\`bash
# 삭제 전 확인: 정말 사용하지 않는 디스크인가?
gcloud compute disks describe disk-backup --zone=asia-northeast3-a --project=main-project

# 삭제 실행
gcloud compute disks delete disk-backup --zone=asia-northeast3-a --project=main-project
\`\`\`

### TERMINATED VM 삭제
\`\`\`bash
# VM 삭제 (연결된 디스크도 함께 삭제됨)
gcloud compute instances delete vm-test --zone=us-central1-a --project=dev-project
\`\`\`

---

## 주의사항

- **prod/​production** 포함 프로젝트는 신중히 검토
- 프로젝트 삭제는 30일 내 `gcloud projects undelete PROJECT_ID`로 복구 가능
- 디스크/​VM 삭제는 **복구 불가** - 스냅샷 백업 권장

보호 규칙

다음 패턴의 프로젝트는 자동으로 경고 표시:

  • 이름에 prod, production, live, main 포함
  • 최근 7일 내 생성된 리소스
  • 결제 계정이 연결된 활성 프로젝트

사용 시나리오

사용자: /​gcp-cleanup

Claude: [스캔 결과 출력]
        삭제가 필요하면 위의 명령어를 복사하여 직접 실행하세요.

사용자: (명령어 복사 후 터미널에서 직접 실행)

참고

  • 이 스킬은 조회 전용입니다
  • 삭제 명령은 사용자가 검토 후 직접 실행해야 합니다
  • 비용 추정은 대략적인 참고값입니다 (실제 비용은 GCP 콘솔에서 확인)

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View