IT Knowledge/Cloud/images/클라우드-서비스-venn.svg
클라우드 서비스 비교 (AWS/Azure/GCP)
📌 핵심 서비스 비교
| 카테고리 | AWS | Azure | GCP |
|---|---|---|---|
| 컴퓨팅 | EC2 | Virtual Machines | Compute Engine |
| 컨테이너 | ECS/EKS | AKS | GKE |
| 서버리스 | Lambda | Functions | Cloud Functions |
| 스토리지 | S3 | Blob Storage | Cloud Storage |
| 데이터베이스 | RDS | SQL Database | Cloud SQL |
| NoSQL | DynamoDB | Cosmos DB | Firestore |
| CDN | CloudFront | CDN | Cloud CDN |
🎯 실전 사례
사례 1: 정적 웹사이트 호스팅
AWS S3 + CloudFront
# 1. S3 버킷 생성 및 정적 웹사이트 설정
aws s3 mb s3://my-website-bucket
aws s3 website s3://my-website-bucket \\
--index-document index.html \\
--error-document error.html
# 2. 파일 업로드
aws s3 sync ./dist s3://my-website-bucket
# 3. CloudFront 배포
aws cloudfront create-distribution \\
--origin-domain-name my-website-bucket.s3.amazonaws.com결과:
- 비용: 월 $1-5 (트래픽에 따라)
- 전 세계 CDN
- HTTPS 자동
사례 2: 서버리스 API
AWS Lambda + API Gateway
// lambda/handler.js
exports.handler = async (event) => {
const userId = event.pathParameters.id;
// DB 조회
const user = await dynamodb.get({
TableName: 'Users',
Key: { id: userId }
}).promise();
return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
},
body: JSON.stringify(user.Item)
};
};# serverless.yml (Serverless Framework)
service: my-api
provider:
name: aws
runtime: nodejs18.x
region: ap-northeast-2
functions:
getUser:
handler: handler.handler
events:
- http:
path: users/{id}
method: get
cors: true
resources:
Resources:
UsersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: Users
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH# 배포
serverless deploy
# 결과
# Endpoint: https://abc123.execute-api.ap-northeast-2.amazonaws.com/users/{id}장점:
- 서버 관리 불필요
- 사용한 만큼만 과금
- 자동 스케일링
사례 3: 컨테이너 오케스트레이션
GCP GKE (Google Kubernetes Engine)
# 1. 클러스터 생성
gcloud container clusters create my-cluster \\
--num-nodes=3 \\
--machine-type=e2-medium \\
--region=asia-northeast3
# 2. 인증 설정
gcloud container clusters get-credentials my-cluster \\
--region=asia-northeast3
# 3. 애플리케이션 배포
kubectl apply -f deployment.yaml
# 4. 로드밸런서 노출
kubectl expose deployment myapp \\
--type=LoadBalancer \\
--port 80 \\
--target-port 3000사례 4: 빅데이터 파이프라인
GCP BigQuery + Dataflow
-- BigQuery: 페타바이트급 데이터 분석
SELECT
DATE(event_timestamp) as date,
COUNT(DISTINCT user_id) as daily_active_users,
SUM(revenue) as total_revenue
FROM `project.dataset.events`
WHERE event_timestamp >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY date
ORDER BY date DESC# Dataflow: 실시간 데이터 처리
import apache_beam as beam
def process_log(element):
# 로그 파싱 및 변환
return {
'user_id': element['user'],
'event': element['action'],
'timestamp': element['time']
}
with beam.Pipeline() as pipeline:
(pipeline
| 'Read from Pub/Sub' >> beam.io.ReadFromPubSub(topic='projects/my-project/topics/logs')
| 'Process' >> beam.Map(process_log)
| 'Write to BigQuery' >> beam.io.WriteToBigQuery(
'my-project:dataset.events',
schema='user_id:STRING,event:STRING,timestamp:TIMESTAMP'
)
)💰 비용 최적화
AWS 비용 절감 전략
# 1. Reserved Instances (1-3년 약정)
# 최대 72% 할인
# 2. Spot Instances (여유 용량 활용)
aws ec2 run-instances \\
--instance-type t3.medium \\
--spot-price "0.05" # 최대 90% 할인
# 3. Auto Scaling (필요한 만큼만)
aws autoscaling create-auto-scaling-group \\
--min-size 2 \\
--max-size 10 \\
--desired-capacity 3Azure 비용 모니터링
# Cost Management API 사용
$costs = Get-AzConsumptionUsageDetail \\
-StartDate "2024-01-01" \\
-EndDate "2024-01-31"
# 리소스별 비용 분석
$costs | Group-Object ResourceGroup |
Select Name, @{N='Cost';E={($_.Group | Measure-Object Cost -Sum).Sum}}