AWS Temelleri: Web Geliştiriciler İçin Cloud Rehberi
zafer ak
Yazar
AWS Nedir?
Amazon Web Services, dünyanın en büyük cloud computing platformudur. 200'den fazla servis sunar ve web uygulamaları için kapsamlı altyapı sağlar.
Web Developer İçin Temel Servisler
EC2 (Elastic Compute Cloud)
Virtual server'lar. Laravel uygulamanızı çalıştırın.
Instance türleri:
- t3.micro: Development, test (1 vCPU, 1GB RAM)
- t3.small: Küçük production (2 vCPU, 2GB RAM)
- t3.medium: Orta ölçekli (2 vCPU, 4GB RAM)
# SSH bağlantısı
ssh -i mykey.pem [email protected]
S3 (Simple Storage Service)
Object storage. Dosya, resim, backup depolama.
// Laravel Filesystem config
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
],
// Kullanım
Storage::disk('s3')->put('file.jpg', $contents);
$url = Storage::disk('s3')->url('file.jpg');
RDS (Relational Database Service)
Managed database. MySQL, PostgreSQL, MariaDB.
# .env
DB_CONNECTION=mysql
DB_HOST=mydb.xxx.rds.amazonaws.com
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=admin
DB_PASSWORD=secret
Özellikler:
- Otomatik backup
- Multi-AZ (high availability)
- Read replicas
- Auto scaling
CloudFront (CDN)
Content Delivery Network. S3 ve EC2 önünde cache.
Kullanım alanları:
- Static asset delivery (JS, CSS, images)
- S3 origin
- SSL/TLS termination
- DDoS protection
ElastiCache
Managed Redis/Memcached.
// Laravel Redis config
REDIS_HOST=mycluster.xxx.cache.amazonaws.com
REDIS_PORT=6379
Lambda (Serverless)
Function as a Service. Event-driven computing.
// Image processing örneği
exports.handler = async (event) => {
const bucket = event.Records[0].s3.bucket.name;
const key = event.Records[0].s3.object.key;
// Resize image...
return { statusCode: 200 };
};
Laravel AWS Deployment
# EC2 Setup
sudo apt update
sudo apt install nginx php8.3-fpm php8.3-mysql php8.3-redis
sudo apt install composer
# Clone ve setup
git clone repo /var/www/myapp
cd /var/www/myapp
composer install --no-dev
cp .env.example .env
php artisan key:generate
php artisan migrate --force
# Nginx config
server {
listen 80;
server_name myapp.com;
root /var/www/myapp/public;
...
}
AWS Maliyet Optimizasyonu
- Reserved Instances: 1-3 yıl taahhüt, %40-60 indirim
- Spot Instances: %90'a kadar indirim (kesinti riski)
- Auto Scaling: Trafik azaldığında instance azalt
- S3 Lifecycle: Eski dosyaları Glacier'a taşı
- Cost Explorer: Harcama analizi
Güvenlik Best Practices
- IAM roles ve policies (least privilege)
- Security Groups (firewall)
- VPC (private network)
- Secrets Manager (credentials)
- CloudTrail (audit logging)
Sonuç
AWS, web uygulamaları için kapsamlı ve güvenilir altyapı sunar. Free tier ile başlayın, ihtiyaçlarınıza göre büyütün.