> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sifi.life/llms.txt
> Use this file to discover all available pages before exploring further.

# 플랫폼 설계 — 심화

## 3. Account Console 설정 가이드

### 3.1 핵심 설정 체크리스트

| 설정 영역         | 항목              | 권장 설정                      | 위치                           |
| ------------- | --------------- | -------------------------- | ---------------------------- |
| **계정 보안**     | 2FA/MFA 강제      | 전체 사용자 필수                  | Settings → Authentication    |
| **SSO**       | SAML 2.0 / OIDC | 사내 IdP 연동 (Okta, Azure AD) | Settings → Single sign-on    |
| **사용자 프로비저닝** | SCIM            | IdP에서 자동 동기화               | Settings → User provisioning |
| **감사 로그**     | 활성화             | 전체 Workspace 대상            | Settings → Audit logs        |
| **IP 접근 제한**  | IP Access List  | 사무실 + VPN IP만 허용           | Settings → IP access lists   |

### 3.2 IP Access List 설정

```json theme={null}
{
  "label": "corporate-office-and-vpn",
  "list_type": "ALLOW",
  "ip_addresses": [
    "203.0.113.0/24",
    "198.51.100.0/24",
    "10.0.0.0/8"
  ]
}
```

| IP Access List 유형 | 동작            | 용도                |
| ----------------- | ------------- | ----------------- |
| **ALLOW**         | 목록의 IP만 접근 허용 | 사무실/VPN IP 화이트리스트 |
| **BLOCK**         | 목록의 IP 접근 차단  | 특정 IP 블랙리스트       |

> **참고**
> **Account 수준 vs Workspace 수준**: Account Console에서 설정한 IP Access List는 모든 Workspace에 적용됩니다. Workspace 수준에서 추가 제한을 설정할 수 있지만, Account 수준 제한을 완화할 수는 없습니다.

***

## 4. CMK (Customer Managed Key) 설정

### 4.1 CMK 적용 대상

| 암호화 대상                         | 설명                 | CMK 적용 방법                              |
| ------------------------------ | ------------------ | -------------------------------------- |
| **관리형 서비스 (Managed Services)** | 노트북 소스, 시크릿, 쿼리 결과 | Account Console → Encryption keys      |
| **Workspace 스토리지**             | DBFS Root, 시스템 데이터 | Workspace 생성 시 CMK 지정                  |
| **Unity Catalog 데이터**          | 관리형 테이블, 볼륨        | External Location에 CMK가 적용된 S3/ADLS 사용 |

### 4.2 AWS KMS 설정 예시

```json theme={null}
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowDatabricksUsage",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::414351767826:root"
      },
      "Action": [
        "kms:Encrypt",
        "kms:Decrypt",
        "kms:ReEncrypt*",
        "kms:GenerateDataKey*",
        "kms:DescribeKey"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowDatabricksGrant",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::414351767826:root"
      },
      "Action": [
        "kms:CreateGrant",
        "kms:ListGrants",
        "kms:RevokeGrant"
      ],
      "Resource": "*",
      "Condition": {
        "Bool": {
          "kms:GrantIsForAWSResource": "true"
        }
      }
    }
  ]
}
```

> **주의**
> **CMK 삭제 주의**: CMK를 삭제하면 해당 키로 암호화된 모든 데이터에 접근할 수 없습니다. KMS 키 삭제 대기 기간(7\~30일)을 반드시 설정하고, 키 순환(rotation) 정책을 사용하세요.

***

## 5. 네트워크 보안

### 5.1 VPC Peering vs PrivateLink

| 항목            | VPC Peering   | PrivateLink                 |
| ------------- | ------------- | --------------------------- |
| **트래픽 경로**    | VPC 간 직접 통신   | AWS 백본 네트워크                 |
| **보안 수준**     | 중 (VPC 간 라우팅) | 높음 (엔드포인트 기반)               |
| **IP 충돌 가능성** | CIDR 겹침 시 불가  | 없음                          |
| **양방향 통신**    | 양방향           | 단방향 (소비자 → 제공자)             |
| **적합한 시나리오**  | 온프레미스 DB 접근   | Databricks Control Plane 접근 |

### 5.2 PrivateLink 구성 (AWS)

| PrivateLink 유형               | 용도                            | VPC Endpoint Service |
| ---------------------------- | ----------------------------- | -------------------- |
| **Front-end (Workspace)**    | 사용자 → Workspace UI/API        | Workspace 접근         |
| **Back-end (Compute Plane)** | Compute Plane → Control Plane | 클러스터 ↔ 관리 서비스 통신     |
| **SCC Relay**                | Secure Cluster Connectivity   | NAT 없이 아웃바운드 통신      |

```text theme={null}
[PrivateLink 아키텍처]

사용자 VPC                           Databricks Control Plane
┌──────────────────┐                ┌─────────────────────┐
│                  │                │                     │
│  사용자 브라우저 ──┼── Front-end ──→│  Workspace UI/API   │
│                  │  PrivateLink   │                     │
│                  │                │                     │
│  Compute Plane VPC ─┼── Back-end ───→│  Control Plane      │
│  (클러스터)       │  PrivateLink   │  Services           │
│                  │                │                     │
│  Compute Plane VPC ─┼── SCC Relay ──→│  SCC Relay          │
│                  │  PrivateLink   │  Endpoint           │
└──────────────────┘                └─────────────────────┘
```

> **참고**
> **PrivateLink 비용**: VPC Endpoint당 월 $7.30 + 데이터 처리 비용($0.01/GB)이 발생합니다. 보안 요구사항이 높은 Prod Workspace에만 적용하고, Dev에는 공용 네트워크를 사용하는 하이브리드 전략도 고려하세요.

### 5.3 Azure VNet Injection + Private Endpoint

| 구성 요소                | 설명           | 서브넷 요구사항          |
| -------------------- | ------------ | ----------------- |
| **Container 서브넷**    | 클러스터 노드 배치   | /26 이상 (최소 64 IP) |
| **Host 서브넷**         | 관리 인터페이스     | /26 이상            |
| **Private Endpoint** | Workspace 접근 | 별도 서브넷 권장         |

***

## 6. IaC (Infrastructure as Code) 패턴

### 6.1 Terraform 기반 플랫폼 관리

```hcl theme={null}
# Workspace 생성 (AWS)
resource "databricks_mws_workspaces" "prod" {
  account_id     = var.databricks_account_id
  workspace_name = "prod-analytics"
  aws_region     = "ap-northeast-2"

  credentials_id           = databricks_mws_credentials.prod.credentials_id
  storage_configuration_id = databricks_mws_storage_configurations.prod.storage_configuration_id
  network_id               = databricks_mws_networks.prod.network_id

  # CMK 설정
  managed_services_customer_managed_key_id = databricks_mws_customer_managed_keys.managed.customer_managed_key_id
  storage_customer_managed_key_id          = databricks_mws_customer_managed_keys.storage.customer_managed_key_id

  custom_tags = {
    Environment = "production"
    CostCenter  = "platform-team"
    ManagedBy   = "terraform"
  }
}

# Unity Catalog 카탈로그 생성
resource "databricks_catalog" "prod_sales" {
  provider = databricks.workspace
  name     = "prod_sales"
  comment  = "프로덕션 영업 데이터 카탈로그"

  properties = {
    "owner_team" = "data-engineering"
    "environment" = "production"
  }
}

# Compute Policy 설정
resource "databricks_cluster_policy" "dev_policy" {
  provider = databricks.workspace
  name     = "dev-standard-policy"

  definition = jsonencode({
    "autotermination_minutes" : {
      "type" : "range",
      "maxValue" : 30,
      "defaultValue" : 10
    },
    "num_workers" : {
      "type" : "range",
      "maxValue" : 8,
      "defaultValue" : 2
    },
    "node_type_id" : {
      "type" : "allowlist",
      "values" : ["i3.xlarge", "i3.2xlarge", "m5.xlarge"]
    },
    "spark_version" : {
      "type" : "regex",
      "pattern" : "15\\.[0-9]+\\.x-scala.*"
    }
  })
}
```

### 6.2 DAB (Databricks Asset Bundles) 패턴

```yaml theme={null}
# databricks.yml — 멀티 환경 번들 설정
bundle:
  name: sales-pipeline

workspace:
  host: https://prod.cloud.databricks.com

targets:
  dev:
    workspace:
      host: https://dev.cloud.databricks.com
    default: true
    resources:
      jobs:
        daily_etl:
          job_clusters:
            - job_cluster_key: etl_cluster
              new_cluster:
                num_workers: 2
                node_type_id: i3.xlarge
                spark_version: 15.4.x-scala2.12

  staging:
    workspace:
      host: https://staging.cloud.databricks.com
    resources:
      jobs:
        daily_etl:
          job_clusters:
            - job_cluster_key: etl_cluster
              new_cluster:
                num_workers: 4
                node_type_id: i3.2xlarge

  prod:
    workspace:
      host: https://prod.cloud.databricks.com
    run_as:
      service_principal_name: svc-prod-etl
    resources:
      jobs:
        daily_etl:
          job_clusters:
            - job_cluster_key: etl_cluster
              new_cluster:
                num_workers: 8
                node_type_id: i3.4xlarge
                autoscale:
                  min_workers: 4
                  max_workers: 16
```

> **참고**
> **IaC 권장 조합**: Workspace 인프라(VPC, IAM, Workspace 생성)는 **Terraform** 으로, 데이터 파이프라인과 Job 정의는 **DAB** 로 관리하는 이중 구조가 가장 효과적입니다. Terraform은 플랫폼 팀이, DAB는 각 데이터 팀이 관리합니다.

***

## 참고 링크

* [Databricks: Workspace Administration](https://docs.databricks.com/aws/en/admin/)
* [Databricks: PrivateLink](https://docs.databricks.com/aws/en/security/network/classic/privatelink)
* [Databricks: Customer Managed Keys](https://docs.databricks.com/aws/en/security/keys/customer-managed-keys)
* [Databricks: Terraform Provider](https://registry.terraform.io/providers/databricks/databricks/latest/docs)
* [Databricks: Asset Bundles](https://docs.databricks.com/aws/en/dev-tools/bundles/)

***
