Day 25. EC2 인스턴스와 CloudWatch 알람 설정
발행: (2025년 12월 24일 오전 07:21 GMT+9)
2 분 소요
원문: Dev.to
Source: Dev.to
Lab Information
Nautilus DevOps 팀은 애플리케이션을 위한 EC2 인스턴스를 설정하고 CPU 사용량을 모니터링하기 위한 CloudWatch 알람을 생성해야 합니다. 알람은 CPU 사용량이 90 % 를 연속 5분 동안 초과하면 트리거되어야 합니다. 알림은 기존 SNS 토픽 datacenter-sns-topic 으로 전송됩니다.
Step 1: Launch the EC2 Instance
- AWS Console → EC2 → Launch instance
- Configure instance
- Name:
datacenter-ec2 - AMI: Ubuntu Server (20.04 LTS 또는 22.04 LTS)
- Instance type:
t2.micro(또는 허용되는 다른 유형) - Key pair: 선택하거나 생성 (랩용)
- Network: Default VPC, default subnet
- Security group: SSH (포트 22) 허용
- Name:
- Launch
- Launch instance 클릭
- 인스턴스 상태가 Running 이 되고 상태 검사가 2/2 passed 가 될 때까지 기다림
Step 2: Create the CloudWatch Alarm
- AWS Console → CloudWatch → Alarms → Create alarm
- Select the Metric
- Select metric → EC2 → Per-Instance Metrics → CPUUtilization 클릭
datacenter-ec2에 대한 메트릭을 선택하고 Select metric 클릭
- Configure Alarm Conditions
- Alarm state trigger: In alarm
- Threshold type: Static
- Whenever CPUUtilization is ≥ 90 % for 5 minutes (period)
- Send notification to: 기존 SNS 토픽 선택 → datacenter-sns-topic
- Name the Alarm
- Alarm name:
datacenter-alarm - Description (optional): CPU가 5분 동안 90 %를 초과할 때 알림
- Create alarm 클릭
- Alarm name:
Step 3: Verify Configuration
- Initial state:
OK(정상) - Metric:
CPUUtilization - Threshold: ≥ 90 %
- Period: 5 minutes
- SNS Action: Alarm action에
datacenter-sns-topic표시