การนำส่งที่ปลอดภัยด้วย Canary และการย้อนกลับ
นำการเปลี่ยนแปลงของระบบ Serverless ไปใช้งานโดยไม่หยุดให้บริการ เรียนรู้แอลิอัสของ Lambda การปรับสัดส่วนทราฟฟิกแบบกำหนดน้ำหนัก การนำส่งแบบ Canary ด้วย CodeDeploy และการย้อนกลับอัตโนมัติเมื่อมีการแจ้งเตือน
การนำส่งที่ปลอดภัยด้วย Canary และการย้อนกลับ เป็นบทเรียน Serverless Backend with AWS Lambda & API Gateway ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Serverless Backend with AWS Lambda & API Gateway และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Serverless Backend with AWS Lambda & API Gateway มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
The Risk of Big-Bang Deploys
Switching all traffic to new code at once means a bug hits every user instantly. Progressive deployments shift traffic gradually so problems surface on a small slice first.
Lambda Versions and Aliases
Publishing a Lambda creates an immutable version. An alias is a pointer (like live) you can move between versions, enabling controlled cutovers.
Weighted Aliases
An alias can split traffic between two versions by weight, sending, say, 10% to the new version and 90% to the old.
aws lambda update-alias \
--function-name api --name live \
--function-version 12 \
--routing-config '{"AdditionalVersionWeights":{"11":0.9}}'Canary Deployments
A canary sends a small percentage of traffic to the new version, waits, then promotes the rest if healthy. CodeDeploy automates this for Lambda.
Deployment Preferences in SAM
SAM exposes this via DeploymentPreference, choosing a canary or linear pattern.
AutoPublishAlias: live
DeploymentPreference:
Type: Canary10Percent5Minutes
Alarms:
- !Ref ErrorAlarmLinear Deployments
A linear pattern shifts traffic in equal increments over time (e.g. 10% every minute), giving a slower, steadier rollout than a single canary step.
CloudWatch Alarms as Gates
Attach alarms (error rate, latency) to the deployment. If an alarm fires during the shift, the deployment is considered failed.
Automatic Rollback
When an alarm trips, CodeDeploy automatically moves the alias back to the previous version, restoring known-good code with no manual action.
Pre and Post Traffic Hooks
Lifecycle hook Lambdas run before and after traffic shifts, letting you run smoke tests and abort the deploy if they fail.
Blue/Green vs Canary
Blue/green stands up a full second environment and switches over; canary shifts a percentage within one environment. For Lambda, weighted aliases make canary the simpler, cheaper default.
Best Practices
Deploy safely:
- Always deploy behind an alias
- Start with a small canary percentage
- Gate on meaningful alarms
- Run smoke tests in pre-traffic hooks
Quick Check
Test your safe-deployment knowledge.
Recap
You learned progressive delivery:
- Versions are immutable; aliases point to them
- Weighted aliases and canaries shift traffic gradually
- SAM DeploymentPreference automates canary/linear patterns
- Alarms gate the rollout and trigger automatic rollback
คำถามที่พบบ่อย
บทเรียน “การนำส่งที่ปลอดภัยด้วย Canary และการย้อนกลับ” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “การนำส่งที่ปลอดภัยด้วย Canary และการย้อนกลับ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Serverless Backend with AWS Lambda & API Gateway ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Serverless Backend with AWS Lambda & API Gateway มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “การนำส่งที่ปลอดภัยด้วย Canary และการย้อนกลับ”
นำการเปลี่ยนแปลงของระบบ Serverless ไปใช้งานโดยไม่หยุดให้บริการ เรียนรู้แอลิอัสของ Lambda การปรับสัดส่วนทราฟฟิกแบบกำหนดน้ำหนัก การนำส่งแบบ Canary ด้วย CodeDeploy และการย้อนกลับอัตโนมัติเมื่อมีการแจ้งเ… คุณปฏิบัติ Serverless Backend with AWS Lambda & API Gateway ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Serverless Backend with AWS Lambda & API Gateway หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Serverless Backend with AWS Lambda & API Gateway บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “การนำส่งที่ปลอดภัยด้วย Canary และการย้อนกลับ” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Serverless Backend with AWS Lambda & API Gateway นี้ได้ไหม
ได้ บทเรียน Serverless Backend with AWS Lambda & API Gateway ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- CodeCommit และ CodeBuild
- CodePipeline สำหรับการนำไปใช้งาน
- การทำให้การนำแอปพลิเคชันไร้เซิร์ฟเวอร์ไปใช้งานเป็นอัตโนมัติ
- การนำส่งที่ปลอดภัยด้วย Canary และการย้อนกลับ