0Pricing
Serverless AWS Lambda Development · Ders

SAM CLI ile Yerel Test

Buluta dağıtmadan önce sunucusuz uygulamanızı AWS SAM CLI ile yerel olarak çağırmayı, öykünmeyi ve hata ayıklamayı öğrenin.

SAM CLI ile Yerel Test, CoddyKit'te ücretsiz bir Serverless AWS Lambda Development dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Serverless AWS Lambda Development öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Serverless AWS Lambda Development kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Why Test Locally?

Deploying to test every change is slow. The SAM CLI emulates Lambda and API Gateway on your machine for a fast feedback loop.

What You Need

Local emulation runs functions inside Docker containers that mirror the Lambda runtime, so you need Docker installed alongside the SAM CLI.

Invoking a Single Function

Use sam local invoke to run one function once with a test event, just like a single Lambda execution.

sam local invoke OrdersFunction \
  --event events/order.json

A Test Event File

The event file is the JSON payload your handler receives. Keep a folder of sample events for different scenarios.

{
  "body": "{\"item\":\"book\",\"qty\":2}",
  "httpMethod": "POST"
}

Generating Sample Events

SAM can scaffold realistic events for common sources so you do not handcraft them.

sam local generate-event s3 put > events/s3.json
sam local generate-event apigateway aws-proxy > events/api.json

Running a Local API

sam local start-api stands up a local HTTP server that routes requests to your functions, mimicking API Gateway.

sam local start-api --port 3000

Calling the Local API

Once running, hit it with any HTTP client. The response comes from your real handler code.

curl -X POST http://localhost:3000/orders \
  -d '{"item":"book","qty":2}'

Environment Variables Locally

Pass a JSON file of environment variable overrides so local runs point at test resources instead of production.

sam local invoke OrdersFunction \
  --env-vars env.json

Step-Through Debugging

Start with -d to pause for a debugger to attach on a port, letting you set breakpoints in your function code.

sam local invoke OrdersFunction -d 5858

Limits of Local Emulation

Local mode cannot perfectly reproduce IAM, networking, or cold starts. Treat it as a fast first check, not a replacement for a cloud staging test.

Validate the Template

Before deploying, run sam validate to catch template errors early.

sam validate --lint

Quick Check

Test your local-testing knowledge.

Recap

You learned to invoke functions, generate events, run a local API, inject env vars, and attach a debugger with the SAM CLI, plus its emulation limits.

Sıkça Sorulan Sorular

“SAM CLI ile Yerel Test” dersi ücretsiz mi?

Evet — “SAM CLI ile Yerel Test” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Serverless AWS Lambda Development kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Serverless AWS Lambda Development kursu toplamda 4 dersten oluşur.

“SAM CLI ile Yerel Test” dersinde ne öğreneceğim?

Buluta dağıtmadan önce sunucusuz uygulamanızı AWS SAM CLI ile yerel olarak çağırmayı, öykünmeyi ve hata ayıklamayı öğrenin. Serverless AWS Lambda Development ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Serverless AWS Lambda Development öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Serverless AWS Lambda Development, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“SAM CLI ile Yerel Test” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Serverless AWS Lambda Development dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Serverless AWS Lambda Development dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. AWS Sunucusuz Uygulama Modeli (SAM)
  2. Sunucusuz Framework’e Giriş
  3. Sunucusuz Uygulamalar İçin CI/CD
  4. SAM CLI ile Yerel Test
← Serverless AWS Lambda Development Sayfasına Dön