عمليات النشر الآمنة باستخدام Canary والتراجع
انشر تغييرات Serverless من دون توقف. تعلّم أسماء Lambda المستعارة، وتحويل حركة المرور الموزونة، وعمليات نشر Canary في CodeDeploy، والتراجع التلقائي عند إطلاق التنبيهات.
عمليات النشر الآمنة باستخدام Canary والتراجع درس مجاني في Serverless Backend with AWS Lambda & API Gateway على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 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
تعلم Serverless Backend with AWS Lambda & API Gateway مع معلم ذكاء اصطناعي — مجانًا
اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.
- الدورات
- 12
- الدروس
- 48
الأسئلة الشائعة
هل درس «عمليات النشر الآمنة باستخدام Canary والتراجع» مجاني؟
نعم — نص درس «عمليات النشر الآمنة باستخدام Canary والتراجع» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 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 مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 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 يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- CodeCommit وCodeBuild
- CodePipeline لعمليات النشر
- أتمتة عمليات نشر التطبيقات عديمة الخوادم
- عمليات النشر الآمنة باستخدام Canary والتراجع