0Pricing
Serverless AWS Lambda Development · บทเรียน

ฟังก์ชัน Lambda แรกของคุณ

เขียน กำหนดค่า และนำฟังก์ชัน Lambda แบบง่ายที่แสดงข้อความ "Hello World" ไปใช้งานโดยใช้คอนโซล AWS พร้อมฝึกปฏิบัติจริงบนแพลตฟอร์ม

ฟังก์ชัน Lambda แรกของคุณ เป็นบทเรียน Serverless AWS Lambda Development ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Serverless AWS Lambda Development และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Serverless AWS Lambda Development มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Your First Lambda Function

Time to build! You will create and deploy your first Hello World Lambda right in the AWS console — your practical step into serverless.

Find Lambda in AWS Console

Log into the AWS console, search "Lambda" in the top bar, and select it to open the Lambda dashboard where all your functions live.

Start a New Lambda Function

On the dashboard, click Create function and choose "Author from scratch" to define a brand-new serverless function.

Name Your Function & Runtime

Set the basics: a unique Function name and a Runtime — the language your code runs in. We will use Python 3.9 here.

Lambda's Permissions: Execution Role

Your function needs an execution role (an IAM role) for permissions. Pick "Create a new role with basic Lambda permissions" to allow CloudWatch logs.

Code Your 'Hello World'

The console opens a code editor — replace the default with this simple Python Hello World handler.

import json

def lambda_handler(event, context):
    # Log the event for debugging purposes
    print(f"Received event: {event}")

    # Return a simple greeting
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from your first Lambda!')
    }

Save & Deploy Your Function

After editing, click Deploy to save your changes and make the new version live. Skip this and the Lambda service keeps the old code.

Test Your Lambda Function

Open the Test tab and configure a test event — the hello-world template works — name it, then click Test to invoke your function and see results.

Check Logs for Output

After a test, results appear inline. For full output, including your print() statements, open CloudWatch Logs where Lambda sends its runtime logs.

Quick Check: Lambda Deployment

You've just deployed your first Lambda! Let's check your understanding of the essential steps.

Recap: Your First Lambda

Congrats! You created, configured, coded, deployed, and tested your first Lambda function — the foundational skill for serverless apps.

คำถามที่พบบ่อย

บทเรียน “ฟังก์ชัน Lambda แรกของคุณ” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “ฟังก์ชัน Lambda แรกของคุณ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Serverless AWS Lambda Development ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Serverless AWS Lambda Development มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “ฟังก์ชัน Lambda แรกของคุณ”

เขียน กำหนดค่า และนำฟังก์ชัน Lambda แบบง่ายที่แสดงข้อความ "Hello World" ไปใช้งานโดยใช้คอนโซล AWS พร้อมฝึกปฏิบัติจริงบนแพลตฟอร์ม คุณปฏิบัติ Serverless AWS Lambda Development ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Serverless AWS Lambda Development หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Serverless AWS Lambda Development บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน

บทเรียน “ฟังก์ชัน Lambda แรกของคุณ” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Serverless AWS Lambda Development นี้ได้ไหม

ได้ บทเรียน Serverless AWS Lambda Development ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. การประมวลผลแบบไร้เซิร์ฟเวอร์คืออะไร
  2. เริ่มต้นใช้งาน AWS Lambda
  3. ฟังก์ชัน Lambda แรกของคุณ
  4. ราคาบริการแบบไร้เซิร์ฟเวอร์และระดับใช้งานฟรี
← กลับไปที่ Serverless AWS Lambda Development