惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
T
ThreatConnect
SecWiki News
SecWiki News
F
Future of Privacy Forum
AWS News Blog
AWS News Blog
C
Cisco Blogs
A
Arctic Wolf
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
V2EX
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
K
Kaspersky official blog
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
NISL@THU
NISL@THU
Microsoft Azure Blog
Microsoft Azure Blog
量子位
The Hacker News
The Hacker News
Stack Overflow Blog
Stack Overflow Blog
Security Latest
Security Latest
M
Microsoft Research Blog - Microsoft Research
Google Online Security Blog
Google Online Security Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
InfoQ
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
The Cloudflare Blog
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Troy Hunt's Blog
F
Fox-IT International blog
S
Security @ Cisco Blogs
博客园 - 司徒正美
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Comments on: Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LINUX DO - 最新话题
GbyAI
GbyAI
Project Zero
Project Zero
腾讯CDC
T
Tailwind CSS Blog

DEV Community

How the Events Table That Looked Right Killed Our Queue Three Failures My AI Memory System Caught — And the Flaw It Revealed in Itself dotnet Framework life cycle tool LangGraph 워크플로우 템플릿 (v41) I built a free image compression API — no signup, just curl Designing TikTok from Scratch — A System Design Deep Dive PREDICTION-20260525-0007: boredom-with-asymmetric-leverage [2026-Q3 through 2027-Q3] [Boost] How to integrate the QuickBooks Invoice API in 2026 How I Cut My Anthropic API Bill by 50% With a Local Python Tool Vibe Coding Problems: 7 Visual Bugs AI Code Generators Always Ship Chinese AI Models 2026: The Agentic Revolution, Hardware Independence, and What It Means for Global Developers The Quiet AI War Inside Your Browser The 12-Line Anti-Bot Trick That Saved Our Airdrop Snapshot From Sybil Farms Building a production-ready SaaS dashboard in Next.js 16 — Recharts, TanStack Table, dark mode, and collapsible sidebar Why 2026 Belongs to Agentic AI (And How to Build Your First Local Agent) It Was 2024 When We Tried to Outsmart the Treasure Hunt Engine RAG 시스템 실전 구축 (v40) I Found a Tool That Generates a Complete .NET 8 or Java Spring Boot API From SQL Schema in 30 Seconds I Added a 4th Agent That Audits My Other Agents. It Caught My Strategist Procrastinating for 3 Weeks. Streaming LLM responses to the browser in Go (Server-Sent Events) How We Publish and Manage Educational Admission Updates at Scale on DailyAxom A prompt is not a conversation. It's a component contract. How to Pass the EAA 2025 Accessibility Audit — A Step-by-Step WCAG Checklist Building an Autonomous MCP Lead Generation System with Hermes Agent LangGraph 워크플로우 템플릿 (v40) How I Built 100 Browser-Based Image Tools With No Server (FFmpeg WASM, PDF-lib, AI Background Removal) Nginx CVE-2026-9256, AI Prompt Injection Defenses, and Claude AI Data Leak Demo Scaling RAG for 10M+ Docs, .md Agent Memory, & Claude Code for Motion Graphics Diagram as Code with draw.io DuckDB Delta, PostgreSQL 17 Migration, & SQLite Optimization Deep Dives Windows 11 Microsoft Account Login Recovery During Internet Restrictions The Linux Commands You Forgot Exist (And Why AI Workflows Make Them Relevant Again) Spec-Driven Development Without an IDE: I Generated NestJS, Go, Spring Boot, Laravel, and Rust Apps From a Single PRD File Components are states Edge SEO y Middleware: Cómo Interceptar a Googlebot y LLMs antes de llegar a tu Servidor Context window exceeded at turn 23. Here's how I track token usage without a tokenizer. My Hermes agent spent $3 before I noticed. Now it can't. My Hermes agent's stop condition was a 40-line if/elif chain. I replaced it with 3 lines. My agent kept hitting context limits. This one function fixed it. Create and configure Azure Firewall Your Hermes agent's audit log is leaking customer emails. Here's a 100-line lib that fixes that. My agent kept forgetting what it was doing. A scratchpad fixed it. I replaced 200 lines of ad-hoc state management in my Hermes agent with one object. Per-Key Rate Limiting for Agent Tool Calls: Stop One User From Breaking Everything Composable Output Guardrails: Filter Agent Responses Before They Reach Users Sanitize Your LLM Message Lists Before Every API Call Thread a Run ID Through Every Agent Call So You Can Debug Anything Normalize Provider Error JSON So Your Agent Can Actually Handle Failures Priority Queue for Agent Sub-Tasks: Stop Processing Low-Priority Work First Static Lint Rules for Your LLM Prompts (Before They Hit Production) tool-call-budgets: Stop Runaway Agent Loops Before They Hit Your Invoice Step Through Your Agent's Failures Like a Debugger The Simplest Stop Condition: A Hard Cap on Agent Loop Iterations Score Your Agent's Responses With a 0.0-1.0 Rubric (No LLM Judge Required) Fix Bad Structured Output by Feeding the Error Back to the Model Building an effective Storyblok Tool Plugin with SvelteKit How to Get Your Renault / Dacia Radio Code for Free RAG 시스템 실전 구축 (v39) Retraction — scrml’s Living Compiler I built a fitness app where the AI roasts you for eating pizza (and hypes you when you PR) The Top SaaS Founder Communities on Discord (Beyond the AI Hype) I Built a Production-Grade Async Job Queue from Scratch — Here's Everything That Actually Happened How to watch SMS from multiple Android phones in one iOS app We Didn’t Want Another AI Wrapper — So We Explored a High-Speed Hermes Orchestrator for Engineering Crews Multi-tenant além do TenantId: problemas reais e aprendizados em sistemas .NET After failing 23 times, I am sharing How I Actually Prepare for a Tech Interview Every Single Time Now. I built an app that works like a nutritionist for your brain. Here's what happened in 7 days. GoBadge Dynamic: From Module Stats to Universal Badges LangGraph 워크플로우 템플릿 (v39) The git Commands You Forgot Exist (And Why AI Workflows Make Them Relevant Again) Six Levels of MCP Servers One container to replace Grafana + Loki + Tempo + Prometheus The Request/Response Cycle, HTTP, Auth, JWT, OAuth & Sessions — Explained Properly Python Week 3: We Stopped Repeating Ourselves (Loops!) Creating a Custom Grid Editor tool in Unreal Engine 我做了个付费 Telegram bot。Telegram Stars 实际给开发者多少钱,我算了一笔账。 I Got 96% Recall on LLM Hallucination Detection With No ML Model – Just 50 Lines of Python A practitioner's guide to getting more value out of AI coding: agent quality & token optimization How to Handle Telegram Albums in Telegraf I Built a Multilingual Spam Detection Dataset with 149K+ Messages Across 23 Languages How to Handle Telegram Albums in grammY RAG 시스템 실전 구축 (v38) Beyond Pip Install: Why Your AI Agent Needs a "Hermetic" Life-Support System to Survive Resume Building using HTML & CSS SpecFlow: Multi-Agent SDD in Cursor (4 phases, /approve, single code writer) Running ASR for smart homes in the NPU of Intel processors "Building a CI/CD Pipeline From Scratch: A Practical Guide for Developers (with GitHub Actions)" SpecFlow: SDD multi-agente en Cursor (4 fases, /approve, un solo escritor de código) How to Extract Your Full Team Hierarchy from HubSpot (the API doesn't expose it) Adobe Commerce Cloud now costs $40k/year. We migrated from Adobe Commerce to Magento Open Source — here's the honest breakdown .klickd v4.0.0 — Portable AI memory with constraints, strict schemas, and test vectors We Trust Third Party Code, It’s Time to Trust AI Generated Code LangGraph 워크플로우 템플릿 (v38) Sustainable AI Starts with Efficient AI Find Remove duplicated files in Google Drive How to Detect GPU Waste in a Kubernetes Cluster The Privacy Bug in My First Chrome Extension (And How to Avoid It) Serverless Mental Models: What They Don't Tell You Before You Build Preventing GPT hallucination in automated content pipelines: how I structure Make.com flows with data injection
SCS-Lab1 — CloudTrail: Trail + S3 + KMS + Log Validation
Luis Eduardo · 2026-05-26 · via DEV Community

Región: us-east-1

Duración estimada: 35–55 minutos

Costo-riesgo: Medio

Certificación: AWS Certified Security - Specialty (SCS-C03)

Dominio: Detection

Tarea 1.2: Design and implement logging solutions

Caso de uso

Digital Cafe Luna ya superó sus primeros tropiezos operativos. La aplicación que apoya facturación e inventario funciona mejor, el negocio va creciendo y ahora más personas interactúan en la plataforma. Robert, compañero de estudio de Camilo, también está colaborando con algunos ajustes técnicos.

Un día, la Sra. Blanca nota un comportamiento extraño en el aplicativo y hace la pregunta incómoda:

“¿Quién cambió qué y cuándo?”

Camilo duda. No sabe si el cambio lo hizo él, Robert o algún proceso de la cuenta. Ahí entiende algo clave: no basta con tener recursos funcionando, se necesita trazabilidad para investigar cambios, responder con evidencia y proteger los registros que cuentan la historia de lo ocurrido.

Sin auditoría, investigar se vuelve opinión.

En este laboratorio vamos a construir un baseline de auditoría en una sola cuenta AWS usando AWS CloudTrail, Amazon S3, AWS KMS y log file validation. No es una estrategia multi-account todavía; es la base para registrar actividad, almacenar logs, cifrarlos y validar su integridad.

¿Qué vamos a construir?

En este laboratorio vas a crear:

  • Un CloudTrail Trail multi-region.
  • Un bucket S3 dedicado para logs.
  • Bloqueo de acceso público y versioning en S3.
  • Una KMS key administrada por el cliente.
  • Una key policy para permitir uso desde CloudTrail.
  • Log file validation.
  • Una prueba controlada para buscar evidencia en CloudTrail.
  • Cleanup completo.

Diagrama SCS-Lab1 — CloudTrail: Trail + S3 + KMS + Log Validation

Figura 1 — CloudTrail registra actividad, entrega logs en S3, los protege con KMS y habilita validación de integridad.

Nota de alcance

Este laboratorio se ejecuta en una sola cuenta AWS. Más adelante puede evolucionar hacia un Organization Trail, pero aquí nos enfocamos en el fundamento: crear el trail, enviar logs a S3, cifrarlos y validar integridad.

Convención de nombres

Recurso Nombre
CloudTrail Trail scs-lab1-trail
S3 Bucket scs-lab1-cloudtrail-logs-<tu-alias>-<4digitos>
KMS Key Alias alias/scs-lab1-cloudtrail
S3 Prefix cloudtrail/

Nota práctica: el bucket de S3 debe tener un nombre único globalmente, por eso usamos <tu-alias>-<4digitos>.

Requisitos previos

  • Cuenta AWS con permisos para CloudTrail, S3 y KMS.
  • Región us-east-1.
  • Acceso a AWS Console y CloudShell o AWS CLI local.
  • Un sufijo único para el bucket. Ejemplo: camilo-4721.
  • Entender que este lab es single account.

Ojo: este laboratorio toca KMS. Si tu cuenta tiene políticas restrictivas, lo más común es fallar por permisos en la key policy.


Paso 1 — Crear el bucket S3 para los logs

CloudTrail necesita un destino para entregar logs. Usaremos un bucket dedicado, con acceso público bloqueado y versioning habilitado.

Crear el bucket desde la consola

En AWS Console:

  • Ve a S3 → Buckets.
  • Selecciona Create bucket.
  • Usa el nombre scs-lab1-cloudtrail-logs-<tu-alias>-<4digitos>.
  • Región: us-east-1.
  • Deja Block Public Access habilitado.
  • En Bucket Versioning, selecciona Enable.
  • Crea el bucket.

CLI opcional

REGION="us-east-1"
LAB_ID="scs-lab1"
ALIAS="camilo"
SUFFIX="4721"

BUCKET="${LAB_ID}-cloudtrail-logs-${ALIAS}-${SUFFIX}"

aws s3api create-bucket \
  --region "$REGION" \
  --bucket "$BUCKET"

aws s3api put-public-access-block \
  --region "$REGION" \
  --bucket "$BUCKET" \
  --public-access-block-configuration \
  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

aws s3api put-bucket-versioning \
  --region "$REGION" \
  --bucket "$BUCKET" \
  --versioning-configuration Status=Enabled

aws s3api put-bucket-tagging \
  --region "$REGION" \
  --bucket "$BUCKET" \
  --tagging "TagSet=[{Key=Name,Value=${LAB_ID}-cloudtrail-logs},{Key=Lab,Value=${LAB_ID}}]"

aws s3api get-bucket-versioning \
  --region "$REGION" \
  --bucket "$BUCKET"

aws s3api get-public-access-block \
  --region "$REGION" \
  --bucket "$BUCKET"

Enter fullscreen mode Exit fullscreen mode

Checkpoint

Valida que:

  • El bucket existe en us-east-1.
  • Block Public Access está activo.
  • Bucket Versioning está en Enabled.
  • El bucket tiene el tag Lab=scs-lab1.

Paso 2 — Crear la KMS key

Ahora crearemos una KMS key administrada por el cliente para cifrar los logs de CloudTrail con SSE-KMS.

Crear la KMS key desde la consola

En AWS Console:

  • Ve a KMS → Customer managed keys.
  • Selecciona Create key.
  • Tipo: Symmetric.
  • Uso: Encrypt and decrypt.
  • Alias: alias/scs-lab1-cloudtrail.
  • En Key administrators, selecciona tu usuario o rol administrador.
  • En Key users, agrega también tu usuario o rol administrador.
  • Crea la key.

Agregar permiso para CloudTrail

En la key:

  • Entra a Key policy.
  • Selecciona Edit.
  • Agrega este statement sin eliminar los permisos administrativos existentes.
{
  "Sid": "AllowCloudTrailToUseTheKey",
  "Effect": "Allow",
  "Principal": {
    "Service": "cloudtrail.amazonaws.com"
  },
  "Action": [
    "kms:GenerateDataKey*",
    "kms:Encrypt",
    "kms:Decrypt",
    "kms:DescribeKey"
  ],
  "Resource": "*"
}

Enter fullscreen mode Exit fullscreen mode

Ojo: el principal debe ser cloudtrail.amazonaws.com como Service principal.

CLI opcional para validar

REGION="us-east-1"

aws kms describe-key \
  --region "$REGION" \
  --key-id "alias/scs-lab1-cloudtrail" \
  --query "{KeyId:KeyMetadata.KeyId,Arn:KeyMetadata.Arn,State:KeyMetadata.KeyState,Usage:KeyMetadata.KeyUsage}" \
  --output table

aws kms list-aliases \
  --region "$REGION" \
  --query "Aliases[?AliasName=='alias/scs-lab1-cloudtrail'].[AliasName,TargetKeyId]" \
  --output table

Enter fullscreen mode Exit fullscreen mode

Checkpoint

Valida que:

  • La key está en estado Enabled.
  • El alias existe.
  • Tu usuario o rol conserva permisos.
  • La key policy permite uso desde CloudTrail.

Paso 3 — Crear el CloudTrail Trail multi-region

Ahora vamos a crear el trail para registrar actividad de la cuenta y conservar evidencia en S3.

Crear el trail desde la consola

En AWS Console:

  • Ve a CloudTrail → Trails.
  • Selecciona Create trail.
  • Nombre: scs-lab1-trail.
  • En Storage location, selecciona Use existing S3 bucket.
  • Elige el bucket del lab.
  • Si usas prefijo, coloca cloudtrail.
  • Habilita Log file SSE-KMS encryption.
  • Selecciona alias/scs-lab1-cloudtrail.
  • Habilita Log file validation.
  • Asegúrate de que sea multi-region.

En eventos:

  • Management events: habilitado.
  • Read: habilitado.
  • Write: habilitado.
  • Data events: deshabilitado.
  • Insights events: deshabilitado.
  • Network activity events: deshabilitado.

CLI opcional para validar

REGION="us-east-1"

aws cloudtrail describe-trails --region "$REGION" \
  --query "trailList[?Name=='scs-lab1-trail'].[Name,S3BucketName,IsMultiRegionTrail,KmsKeyId,LogFileValidationEnabled]" \
  --output table

aws cloudtrail get-trail-status --region "$REGION" \
  --name "scs-lab1-trail" \
  --query "{IsLogging:IsLogging,LatestDeliveryTime:LatestDeliveryTime,LatestDigestDeliveryTime:LatestDigestDeliveryTime,LatestDeliveryError:LatestDeliveryError}" \
  --output table

Enter fullscreen mode Exit fullscreen mode

Checkpoint

Valida que:

  • IsMultiRegionTrail aparece como true.
  • LogFileValidationEnabled aparece como true.
  • IsLogging aparece como true.
  • LatestDeliveryError está vacío o sin errores relevantes.

Paso 4 — Generar un evento y confirmar entrega

Crear CloudTrail no basta. Hay que validar que registra eventos y entrega logs en S3.

Acción en AWS → CloudTrail → S3 bucket → Evidencia disponible

Enter fullscreen mode Exit fullscreen mode

Generar un evento desde la consola

Puedes crear una access key temporal solo como evento de prueba:

  • Ve a IAM → Users.
  • Selecciona tu usuario.
  • Entra a Security credentials.
  • En Access keys, selecciona Create access key.
  • Crea la key solo para generar el evento.
  • No la uses para nada productivo.

Ojo: elimina esta access key en el cleanup.

También puedes usar un cambio menor, como agregar un tag no crítico.

Validar entrega por CLI

REGION="us-east-1"

aws cloudtrail get-trail-status --region "$REGION" \
  --name "scs-lab1-trail" \
  --query "{IsLogging:IsLogging,LatestDeliveryTime:LatestDeliveryTime,LatestDeliveryError:LatestDeliveryError}" \
  --output table

Enter fullscreen mode Exit fullscreen mode

Ajusta BUCKET con tu bucket real:

REGION="us-east-1"
BUCKET="scs-lab1-cloudtrail-logs-camilo-4721"
ACCOUNT_ID="$(aws sts get-caller-identity --query Account --output text)"

aws s3 ls "s3://$BUCKET/cloudtrail/AWSLogs/$ACCOUNT_ID/" \
  --recursive \
  --human-readable \
  --summarize | tail -n 20

Enter fullscreen mode Exit fullscreen mode

Si no usaste prefijo:

aws s3 ls "s3://$BUCKET/AWSLogs/$ACCOUNT_ID/" \
  --recursive \
  --human-readable \
  --summarize | tail -n 20

Enter fullscreen mode Exit fullscreen mode


Paso 5 — Verificar cifrado y log file validation

Ahora validamos que los logs estén cifrados con SSE-KMS y que CloudTrail genere archivos digest para integridad.

Validar desde la consola

En AWS Console:

  • Ve a CloudTrail → Trails.
  • Abre scs-lab1-trail.
  • Valida:
    • Log file SSE-KMS encryption: Enabled.
    • AWS KMS key: alias/scs-lab1-cloudtrail.
    • Log file validation: Enabled.

Confirmar por CLI

REGION="us-east-1"

aws cloudtrail describe-trails --region "$REGION" \
  --query "trailList[?Name=='scs-lab1-trail'].[Name,IsMultiRegionTrail,LogFileValidationEnabled,KmsKeyId,S3BucketName,S3KeyPrefix]" \
  --output table

Enter fullscreen mode Exit fullscreen mode

Verifica objetos digest:

BUCKET="scs-lab1-cloudtrail-logs-camilo-4721"
ACCOUNT_ID="$(aws sts get-caller-identity --query Account --output text)"

aws s3 ls "s3://$BUCKET/cloudtrail/AWSLogs/$ACCOUNT_ID/CloudTrail-Digest/" \
  --recursive | tail -n 10

Enter fullscreen mode Exit fullscreen mode

Verifica cifrado en un objeto real:

BUCKET="scs-lab1-cloudtrail-logs-camilo-4721"
ACCOUNT_ID="$(aws sts get-caller-identity --query Account --output text)"

OBJ_KEY=$(aws s3api list-objects-v2 \
  --bucket "$BUCKET" \
  --prefix "cloudtrail/AWSLogs/$ACCOUNT_ID/CloudTrail/" \
  --query "reverse(sort_by(Contents,&LastModified))[0].Key" \
  --output text)

echo "$OBJ_KEY"

aws s3api head-object \
  --bucket "$BUCKET" \
  --key "$OBJ_KEY" \
  --query "{SSE:ServerSideEncryption,KMSKey:SSEKMSKeyId}" \
  --output table

Enter fullscreen mode Exit fullscreen mode

Salida esperada:

SSE     aws:kms
KMSKey  arn:aws:kms:...

Enter fullscreen mode Exit fullscreen mode


Paso 6 — Buscar el cambio en CloudTrail

Ahora usamos CloudTrail para responder con evidencia:

“¿Quién cambió qué y cuándo?”

Buscar desde la consola

En AWS Console:

  • Ve a CloudTrail → Event history.
  • En Lookup attributes, filtra según la acción.
  • Si creaste una access key, busca:
    • Event name: CreateAccessKey.
    • Event name: DeleteAccessKey, si ya la eliminaste.
  • Abre el evento y revisa:
    • Event name
    • Event time
    • User name / ARN
    • Source IP address
    • AWS Region
    • User agent

Buscar por CLI

REGION="us-east-1"

START_TIME=$(date -u -d '60 minutes ago' +"%Y-%m-%dT%H:%M:%SZ")

aws cloudtrail lookup-events --region "$REGION" \
  --start-time "$START_TIME" \
  --max-results 10 \
  --query "Events[].{Time:EventTime,Name:EventName,User:Username,EventId:EventId}" \
  --output table

Enter fullscreen mode Exit fullscreen mode

Por evento específico:

REGION="us-east-1"

aws cloudtrail lookup-events --region "$REGION" \
  --lookup-attributes AttributeKey=EventName,AttributeValue=CreateAccessKey \
  --max-results 5 \
  --query "Events[].{Time:EventTime,Name:EventName,User:Username,EventId:EventId}" \
  --output table

Enter fullscreen mode Exit fullscreen mode

Detalle del evento:

REGION="us-east-1"

aws cloudtrail lookup-events --region "$REGION" \
  --lookup-attributes AttributeKey=EventName,AttributeValue=CreateAccessKey \
  --max-results 1 \
  --query "Events[0].CloudTrailEvent" \
  --output text

Enter fullscreen mode Exit fullscreen mode

Ojo: si estás en Mac y date -d no funciona, ejecuta esa parte desde CloudShell o ajusta el cálculo de tiempo.


Clean up completo — SCS-Lab1

Elimina los recursos para evitar costos y mantener la cuenta limpia.

Recursos a eliminar

  • CloudTrail Trail: scs-lab1-trail
  • S3 Bucket: scs-lab1-cloudtrail-logs-<tu-alias>-<4digitos>
  • KMS Key: alias/scs-lab1-cloudtrail
  • Access key temporal: si la creaste

Orden recomendado

  • Elimina la access key temporal.
  • Elimina el CloudTrail Trail.
  • Vacía y elimina el S3 Bucket.
  • Agenda la eliminación de la KMS Key.

Desde la consola

  • En CloudTrail → Trails, elimina scs-lab1-trail.
  • En S3 → Buckets, vacía y elimina el bucket del lab.
  • En KMS → Customer managed keys, selecciona la key y usa Schedule key deletion.

Ojo: si versioning está habilitado, revisa versiones y delete markers antes de eliminar el bucket.

CLI opcional para validar cleanup

REGION="us-east-1"

aws cloudtrail describe-trails --region "$REGION" \
  --query "trailList[?Name=='scs-lab1-trail'].[Name]" \
  --output table

Enter fullscreen mode Exit fullscreen mode

BUCKET="scs-lab1-cloudtrail-logs-camilo-4721"

if aws s3api head-bucket --bucket "$BUCKET" 2>/dev/null; then
  echo "Bucket aún existe: $BUCKET"
else
  echo "Bucket eliminado o no accesible: $BUCKET"
fi

Enter fullscreen mode Exit fullscreen mode

REGION="us-east-1"

aws kms describe-key \
  --region "$REGION" \
  --key-id "alias/scs-lab1-cloudtrail" \
  --query "{KeyId:KeyMetadata.KeyId,State:KeyMetadata.KeyState,DeletionDate:KeyMetadata.DeletionDate}" \
  --output table

Enter fullscreen mode Exit fullscreen mode


Troubleshooting rápido

  • CloudTrail no entrega logs en S3: revisa LatestDeliveryError, bucket policy, prefijo y KMS.
  • KMS policy falla: valida Principal.Service = cloudtrail.amazonaws.com.
  • No aparecen objetos digest: espera unos minutos y confirma que ya llegan logs normales.
  • OBJ_KEY sale como None: revisa si usaste prefijo cloudtrail.
  • El bucket no se deja borrar: elimina contenido, versiones y delete markers.
  • No puedes agendar eliminación de la KMS key: valida que sigues siendo administrador de la key.

Well-Architected lens: ¿Qué aplicamos aquí?

  • Security: pasamos de sospechas a evidencia verificable.
  • Operational Excellence: dejamos un flujo repetible de investigación.
  • Reliability: reducimos cambios silenciosos sin trazabilidad.
  • Cost Optimization: mantenemos el lab autocontenido y con cleanup completo.
  • Performance Efficiency: evitamos data events e Insights para no recolectar señales innecesarias.

Resultado esperado

Al finalizar deberías poder crear un baseline de auditoría en una cuenta AWS: trail multi-region, logs en S3, cifrado con KMS, validación de integridad, búsqueda de eventos y cleanup completo.

La idea no era solo “prender CloudTrail”, sino dejar evidencia auditable, protegida y verificable.

Al final, Camilo puede responder con más claridad:

“¿Quién cambió qué y cuándo?”


Referencias oficiales


¿Qué viene en el próximo lab?

Digital Cafe Luna ya tiene una base de auditoría en una sola cuenta. El siguiente paso es prepararse para un reto real: escalar

SAA-Lab1 — Scaling en AWS (baseline): ALB + Auto Scaling + CloudFront

Montaremos un baseline de escalamiento con balanceo, escalado automático y caché en el borde, usando el dominio por defecto de CloudFront.

Nos vemos en el próximo laboratorio de Digital Cafe Luna.