Skip to content

Latest commit

Β 

History

History
53 lines (40 loc) Β· 3.21 KB

File metadata and controls

53 lines (40 loc) Β· 3.21 KB

Serverless Canary Deployment & Release Engineering Pipeline

πŸš€ Architecture Overview

This repository contains the Infrastructure as Code (IaC) and automation scripts for an advanced, risk-mitigated Canary Deployment pipeline. Built for high-frequency, zero-downtime production environments, this project demonstrates how to deploy code updates to a serverless Python API while mitigating deployment risk by mathematically shifting live user traffic.

πŸ› οΈ Tech Stack

  • Infrastructure as Code (IaC): Terraform
  • Compute Engine: AWS Lambda (Serverless)
  • Release Automation: AWS CodeDeploy
  • Language: Python 3.10
  • CLI Engine: AWS CLI v2 (AppSpec Injections)

πŸ—οΈ Core Engineering Mechanics

  1. Immutable Serverless Versioning: The Terraform configuration enforces strict Lambda compilation and publishing rules (publish = true). This prevents version drifting by generating permanent, unmodifiable software versions (e.g., V1, V2) rather than mutating code in place.
  2. Decoupled Alias Routing: Traffic hits an abstract AWS Lambda Alias pointer (live). Terraform is configured via lifecycle hooks to ignore active routing changes, handing absolute control over the production traffic split to AWS CodeDeploy.
  3. Linear/Canary Shifting Configuration: The architecture implements the CodeDeployDefault.LambdaCanary10Percent5Minutes engine. When an upgrade occurs, exactly 10% of global API requests are routed to the new code while 90% remain on the legacy system, establishing a 5-minute telemetry observation window before promoting the version to 100%.

πŸ“‚ Repository Structure

  • /src: Contains the Python application code for the Market Pricing API (Simulating V1 baseline and V2 feature enhancement).
  • /infrastructure: Contains the Terraform configuration mapping out IAM execution roles, the CodeDeploy deployment group, and the Lambda alias controls.

πŸš€ Deployment & Release Runbook

1. Deploy the Baseline Infrastructure (V1.0):

cd infrastructure
terraform init
terraform apply

2. Push the V2.0 App Bundle to the Cloud Data Center: Update the src/api.py payload with your new feature metrics and run an upgrade compilation:

terraform apply

3. Execute the Live Canary Traffic Shift: Inject an AppSpec configuration directly into CodeDeploy via the AWS CLI to trigger the 10/90 mathematical split:

aws deploy create-deployment \
  --application-name market-pricing-api-deployment \
  --deployment-group-name market-pricing-api-dg \
  --description "Canary shift from V1.0 to V2.0" \
  --revision '{"revisionType": "AppSpecContent", "appSpecContent": {"content": "{\"version\": 0.0, \"Resources\": [{\"myLambdaFunction\": {\"Type\": \"AWS::Lambda::Function\", \"Properties\": {\"Name\": \"market-pricing-api\", \"Alias\": \"live\", \"CurrentVersion\": \"1\", \"TargetVersion\": \"2\"}}}]}"}}'

πŸ“Έ Deployment Evidence

Screenshot 2026-06-14 at 00 05 42 Screenshot 2026-06-14 at 00 06 19