# EBS CloudWatch Metrics MCP
AWS EBS CloudWatch 지표 계산 MCP 서버입니다. Kiro에서 EBS 볼륨의 성능 지표를 조회하고 분석할 수 있습니다.
## 기능
- **IOPS 계산**: 읽기/쓰기 IOPS 평균, 최대, 최소 값 계산
- **처리량 계산**: 읽기/쓰기 처리량 (MB/s) 계산
- **스냅샷 조회**: 스냅샷 크기 및 목록 조회
- **CloudWatch 지표 조회**: 모든 EBS CloudWatch 지표 직접 조회
- **고급 지표 계산**: I/O 사용률, 지연 시간, 버스팅 IOPS/처리량 등
## 설치
### uvx 사용 (권장)
```bash
uvx ebs-cloudwatch-metrics-mcp
```
### pip 사용
```bash
pip install ebs-cloudwatch-metrics-mcp
```
### 소스에서 설치
```bash
git clone https://github.com/your-repo/ebs-cloudwatch-metrics-mcp.git
cd ebs-cloudwatch-metrics-mcp
pip install -e .
```
## Kiro MCP 설정
`.kiro/settings/mcp.json` 파일에 다음 설정을 추가하세요:
```json
{
"mcpServers": {
"ebs-cloudwatch-metrics": {
"command": "uvx",
"args": ["ebs-cloudwatch-metrics-mcp"],
"env": {
"AWS_PROFILE": "default",
"AWS_REGION": "ap-northeast-2"
}
}
}
}
```
### 환경 변수
| 변수 | 설명 | 기본값 |
|------|------|--------|
| `AWS_PROFILE` | AWS 프로파일 이름 | `default` |
| `AWS_REGION` | AWS 리전 | 프로파일 설정 |
| `AWS_ACCESS_KEY_ID` | AWS 액세스 키 ID | - |
| `AWS_SECRET_ACCESS_KEY` | AWS 시크릿 액세스 키 | - |
## 사용 가능한 도구
### 1. calculate_iops
EBS 볼륨의 IOPS를 계산합니다.
**파라미터:**
- `volume_id` (필수): EBS 볼륨 ID
- `start_time` (필수): 조회 시작 시간 (ISO 8601)
- `end_time` (필수): 조회 종료 시간 (ISO 8601)
- `period`: 지표 수집 간격 (초, 기본값: 300)
- `region`: AWS 리전
**예시:**
```
calculate_iops(
volume_id="vol-1234567890abcdef0",
start_time="2024-01-01T00:00:00Z",
end_time="2024-01-02T00:00:00Z"
)
```
### 2. calculate_throughput
EBS 볼륨의 처리량을 계산합니다.
**파라미터:**
- `volume_id` (필수): EBS 볼륨 ID
- `start_time` (필수): 조회 시작 시간 (ISO 8601)
- `end_time` (필수): 조회 종료 시간 (ISO 8601)
- `period`: 지표 수집 간격 (초, 기본값: 300)
- `region`: AWS 리전
### 3. get_snapshot_size
EBS 스냅샷의 크기를 조회합니다.
**파라미터:**
- `snapshot_id` (필수): EBS 스냅샷 ID
- `region`: AWS 리전
### 4. list_volume_snapshots
EBS 볼륨의 모든 스냅샷 목록을 조회합니다.
**파라미터:**
- `volume_id` (필수): EBS 볼륨 ID
- `max_results`: 최대 결과 수 (기본값: 100)
- `region`: AWS 리전
### 5. get_ebs_metric
특정 EBS CloudWatch 지표를 조회합니다.
**파라미터:**
- `volume_id` (필수): EBS 볼륨 ID
- `metric_name` (필수): CloudWatch 지표 이름
- `start_time` (필수): 조회 시작 시간 (ISO 8601)
- `end_time` (필수): 조회 종료 시간 (ISO 8601)
- `period`: 지표 수집 간격 (초, 기본값: 300)
- `statistics`: 통계 유형 배열 (기본값: ["Average"])
- `region`: AWS 리전
**지원되는 지표:**
- `VolumeReadOps` - 읽기 작업 수
- `VolumeWriteOps` - 쓰기 작업 수
- `VolumeReadBytes` - 읽기 바이트 수
- `VolumeWriteBytes` - 쓰기 바이트 수
- `VolumeTotalReadTime` - 총 읽기 시간
- `VolumeTotalWriteTime` - 총 쓰기 시간
- `VolumeIdleTime` - 유휴 시간
- `VolumeQueueLength` - 큐 길이
- `VolumeThroughputPercentage` - 처리량 백분율
- `VolumeConsumedReadWriteOps` - 소비된 읽기/쓰기 작업
- `BurstBalance` - 버스트 잔액 (gp2)
### 6. list_ebs_metrics
사용 가능한 EBS CloudWatch 지표 목록을 반환합니다.
**파라미터:** 없음
### 7. get_advanced_metrics
EBS 볼륨의 고급 성능 지표를 계산합니다.
**파라미터:**
- `volume_id` (필수): EBS 볼륨 ID
- `start_time` (필수): 조회 시작 시간 (ISO 8601)
- `end_time` (필수): 조회 종료 시간 (ISO 8601)
- `period`: 지표 수집 간격 (초, 기본값: 300)
- `region`: AWS 리전
**반환되는 고급 지표:**
- `io_use_percent` - I/O 사용률 (%)
- `avg_read_latency_ms` - 평균 읽기 지연 시간 (ms)
- `avg_write_latency_ms` - 평균 쓰기 지연 시간 (ms)
- `read_io_size_kib` - 읽기 I/O 크기 (KiB)
- `write_io_size_kib` - 쓰기 I/O 크기 (KiB)
- `avg_read_iops` - 평균 읽기 IOPS
- `avg_write_iops` - 평균 쓰기 IOPS
- `avg_total_iops` - 평균 총 IOPS
- `avg_read_throughput_mib_s` - 평균 읽기 처리량 (MiB/s)
- `avg_write_throughput_mib_s` - 평균 쓰기 처리량 (MiB/s)
- `avg_total_throughput_mib_s` - 평균 총 처리량 (MiB/s)
- `bursting_read_iops` - 버스팅 읽기 IOPS
- `bursting_write_iops` - 버스팅 쓰기 IOPS
- `bursting_total_iops` - 버스팅 총 IOPS
- `bursting_read_throughput_mib_s` - 버스팅 읽기 처리량 (MiB/s)
- `bursting_write_throughput_mib_s` - 버스팅 쓰기 처리량 (MiB/s)
- `bursting_total_throughput_mib_s` - 버스팅 총 처리량 (MiB/s)
- `burst_balance` - BurstBalance (gp2 볼륨만)
## 필요한 IAM 권한
MCP 서버를 사용하려면 다음 IAM 권한이 필요합니다:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudwatch:GetMetricStatistics",
"cloudwatch:ListMetrics"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ec2:DescribeSnapshots",
"ec2:DescribeVolumes"
],
"Resource": "*"
}
]
}
```
### 최소 권한 정책
특정 볼륨만 조회하려면 리소스를 제한할 수 있습니다:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudwatch:GetMetricStatistics"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"cloudwatch:namespace": "AWS/EBS"
}
}
},
{
"Effect": "Allow",
"Action": [
"ec2:DescribeSnapshots"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:VolumeId": "vol-1234567890abcdef0"
}
}
}
]
}
```
## 라이선스
MIT License