Skip to content
gcp-vm-ssh logo

GCP VM SSH

gcp-vm-ssh

GCP VM SSH 접속 및 터널링 설정

SKILL.md

Full skill instructions

GCP VM SSH

VM에 SSH 접속하거나 포트 포워딩/터널을 설정합니다.

사용법

/​gcp-vm-ssh                        # VM 목록 → 선택
/​gcp-vm-ssh my-vm                  # SSH 명령어 출력
/​gcp-vm-ssh my-vm --tunnel 8080    # 로컬 8080 → VM 8080 터널
/​gcp-vm-ssh my-vm --tunnel 3000:80 # 로컬 3000 → VM 80 터널

Workflow

1. VM 정보 조회

PROJECT_ID=$(gcloud config get-value project)
gcloud compute instances list --project=$PROJECT_ID \
  --format="table(name,zone,status,networkInterfaces[0].networkIP,networkInterfaces[0].accessConfigs[0].natIP)"

2. SSH 명령어 생성

기본 SSH 접속
# gcloud SSH (권장 - 키 자동 관리)
gcloud compute ssh VM_NAME --zone=ZONE --project=PROJECT_ID

# 또는 직접 SSH (외부 IP 있는 경우)
ssh -i ~/​.ssh/​google_compute_engine USER@EXTERNAL_IP
IAP 터널 (외부 IP 없는 경우)
gcloud compute ssh VM_NAME --zone=ZONE --tunnel-through-iap

3. 포트 포워딩/터널

# 로컬 포트 → VM 포트 (예: 로컬 8080 → VM 8080)
gcloud compute ssh VM_NAME --zone=ZONE -- -L 8080:localhost:8080

# IAP 터널 + 포트 포워딩
gcloud compute ssh VM_NAME --zone=ZONE --tunnel-through-iap -- -L 8080:localhost:8080

# 백그라운드 터널 (포트만 열기)
gcloud compute start-iap-tunnel VM_NAME 22 --local-host-port=localhost:2222 --zone=ZONE &

4. SCP 파일 전송

# 로컬 → VM
gcloud compute scp LOCAL_FILE VM_NAME:~/​REMOTE_PATH --zone=ZONE

# VM → 로컬
gcloud compute scp VM_NAME:~/​REMOTE_FILE LOCAL_PATH --zone=ZONE

# 디렉토리
gcloud compute scp --recurse LOCAL_DIR VM_NAME:~/​REMOTE_DIR --zone=ZONE

출력 형식

## SSH 접속 정보

| 항목 | 값 |
|------|-----|
| VM | my-instance |
| Zone | asia-northeast3-a |
| 내부 IP | 10.178.0.2 |
| 외부 IP | 34.64.xxx.xxx |
| 상태 | RUNNING |

### 접속 명령어

\`\`\`bash
# 기본 SSH
gcloud compute ssh my-instance --zone=asia-northeast3-a

# 포트 포워딩 (예: Jupyter)
gcloud compute ssh my-instance --zone=asia-northeast3-a -- -L 8888:localhost:8888
\`\`\`

### 파일 전송

\`\`\`bash
# 업로드
gcloud compute scp ./​file.txt my-instance:~/ --zone=asia-northeast3-a

# 다운로드
gcloud compute scp my-instance:~/​file.txt ./ --zone=asia-northeast3-a
\`\`\`

자주 쓰는 터널 패턴

용도명령어
Jupyter Notebook-L 8888:localhost:8888
Web Server-L 8080:localhost:80
PostgreSQL-L 5432:localhost:5432
MySQL-L 3306:localhost:3306
Redis-L 6379:localhost:6379

트러블슈팅

문제해결
Permission deniedgcloud compute config-ssh로 키 재생성
Connection timeout방화벽에서 22번 포트 확인
IAP 터널 실패IAP API 활성화 + IAM 권한 확인

More Productivity & Planning skills

brainstorming logo
Productivity & Planning

brainstorming

Structured design dialogue that validates ideas before implementation begins.

295.4K 385.7K
View
ui-ux-pro-max logo
Productivity & Planning

ui-ux-pro-max

Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.

133.1K 383.9K
View
writing-plans logo
Productivity & Planning

writing-plans

Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.

295.4K 268K
View
using-superpowers logo
Productivity & Planning

using-superpowers

Introduction to the obra skills system with mandatory skill invocation rules and best practices.

295.4K 259.8K
View
executing-plans logo
Productivity & Planning

executing-plans

Execute a written implementation plan with critical review and task checkpoints.

295.4K 229.1K
View
dispatching-parallel-agents logo
Productivity & Planning

dispatching-parallel-agents

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

295.4K 206.3K
View
using-git-worktrees logo
Productivity & Planning

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

295.4K 205.2K
View
webapp-testing logo
Productivity & Planning

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

179.7K 170.6K
View
content-strategy logo
Productivity & Planning

content-strategy

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View
repo-intake-and-plan logo
Productivity & Planning

repo-intake-and-plan

README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.

497 139.6K
View
marketing-ideas logo
Productivity & Planning

marketing-ideas

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
site-architecture logo
Productivity & Planning

site-architecture

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View

Productivity AI tools

Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View
SaveDay logo
Productivity

SaveDay

Capture, organize, and utilize your knowledge effortlessly.

Free
View
A
Productivity

Any Summary

Instant Summaries of Audio & Video Interviews with AnySummary

Freemium
View
M
Productivity

Map This

Transform PDFs into engaging mind maps.

Freemium
View
ChatPDF logo
Productivity

ChatPDF

Chat with any PDF instantly

Free
View
I
Productivity

intellisay

Create an optimal daily plan using your voice

Paid
View
A
Productivity

Aurora AI

A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.

Paid
View
AskYourPDF logo
Productivity

AskYourPDF

AskYourPDF Pricing Plans: Tailored to Your Needs

Free
View