CloudFront: CDN Global de AWS
Amazon CloudFront es la red de distribucion de contenido (CDN) de AWS con 450+ puntos de presencia globales, incluyendo multiples en Latinoamerica. Reduce la latencia sirviendo contenido desde el edge location mas cercano al usuario.
| Edge en LATAM | Ubicacion | Beneficio |
|---|---|---|
| Sao Paulo (4) | Brasil | Latencia < 20ms para Brasil |
| Buenos Aires (2) | Argentina | Latencia < 30ms para AR/UY |
| Bogota (2) | Colombia | Latencia < 25ms para CO/EC |
| Santiago (1) | Chile | Latencia < 30ms para CL/PE |
| Lima (1) | Peru | Cobertura Peru directo |
| Ciudad de Mexico (2) | Mexico | Latencia < 20ms para MX |
# Terraform: CloudFront + S3 para sitio estatico
resource "aws_cloudfront_distribution" "website" {
origin {
domain_name = aws_s3_bucket.website.bucket_regional_domain_name
origin_id = "S3-website"
origin_access_control_id = aws_cloudfront_origin_access_control.oac.id
}
enabled = true
default_root_object = "index.html"
price_class = "PriceClass_All" # Incluye LATAM
default_cache_behavior {
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "S3-website"
viewer_protocol_policy = "redirect-to-https"
compress = true
cache_policy_id = "658327ea-f89d-4fab-a63d-7e88639e58f6" # CachingOptimized
}
viewer_certificate {
acm_certificate_arn = aws_acm_certificate.cert.arn
ssl_support_method = "sni-only"
}
}API Gateway: APIs REST y WebSocket
Amazon API Gateway permite crear, publicar y gestionar APIs a cualquier escala. Integra con Lambda para APIs completamente serverless.
# serverless.yml (Serverless Framework)
service: mi-api
provider:
name: aws
runtime: python3.11
region: sa-east-1
stage: production
functions:
getUsers:
handler: handlers.get_users
events:
- httpApi:
path: /users
method: GET
createUser:
handler: handlers.create_user
events:
- httpApi:
path: /users
method: POST🚀 Dato Clave
Arquitectura serverless completa para LATAM: CloudFront (CDN) + API Gateway (routing) + Lambda (compute) + DynamoDB (data) + S3 (storage). Costo para 100K usuarios/mes: ~USD 20-50. Escala a millones sin cambiar nada.
Con CloudFront y API Gateway, tus apps tienen performance global desde el dia uno.