CLAUDE.md
CLAUDE.md
목차
- Repository Overview
- Repository Structure
- Naming Conventions
- Container Images
- ECS Network Modes
- Common Troubleshooting
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Overview
This is an AWS infrastructure documentation and learning repository organized by training days (day2-0113 through day11-0127). It contains step-by-step guides for setting up AWS services including VPC, EC2, ECR, ECS, and related networking components.
Repository Structure
dayN-MMDD/- Daily learning content with AWS configuration guides in KoreanTEMPLATE/- Reusable configuration templates (VPC, NAT)ECR/images/- Container images for deployment (FastAPI, Nginx)AWS_CLI/,ec2/,s3/- Service-specific configurations
Naming Conventions
Resources follow the pattern pista-<resource-type>-<purpose>:
- VPC:
pista-vpc,pista-ecs-vpc - Subnets:
pista-subnet-public1-1a,pista-subnet-private1-1a - Security Groups:
pista-sg-web,pista-sg-alb,pista-sg-api - ECS:
pista-cluster-*,pista-task-*,pista-service-*
Container Images
FastAPI Image
cd ECR/images/fastapi
docker build -t pista-fastapi:1.0 .
docker run -d -p 3000:3000 --name pista-fastapi-container pista-fastapi:1.0
ECR Push Flow
# Login to ECR
aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin <ACCOUNT_ID>.dkr.ecr.ap-southeast-1.amazonaws.com
# Build, tag, push
docker build -t pista/web .
docker tag pista/web:latest <ACCOUNT_ID>.dkr.ecr.ap-southeast-1.amazonaws.com/pista/web:latest
docker push <ACCOUNT_ID>.dkr.ecr.ap-southeast-1.amazonaws.com/pista/web:latest
ECS Network Modes
| Mode | Fargate Support | Use Case |
|---|---|---|
| awsvpc | Required | Recommended - separate IP per task, best security |
| bridge | No | EC2 only - dynamic port mapping, shared EC2 IP |
| host | No | EC2 only - simple but port conflict risk |
Common Troubleshooting
- Private subnets require NAT Gateway with proper routing table configuration
- Public subnets require Internet Gateway and auto-assign public IP enabled
- ECS clusters need
ecsInstanceRolefor EC2 instances to register - For bridge mode ECS tasks, create ALB and target groups separately before service creation
- Minimum EC2 instance: t3.medium (2 vCPU, 4GB RAM) for ECS clusters