BrainyBeeBrainyBee
ExploreBlogStart Studying
HomeAWS Certified DevOps Engineer - Professional (DOP-C02)AWS Deployment Methodologies: EC2, Containers, and Serverless
Study Guide925 words

AWS Deployment Methodologies: EC2, Containers, and Serverless

Deployment methodologies for various platforms (for example, Amazon EC2, Amazon Elastic Container Service [Amazon ECS], Amazon Elastic Kubernetes Service [Amazon EKS], Lambda)

AWS Deployment Methodologies: EC2, Containers, and Serverless

Learning Objectives

After studying this guide, you should be able to:

  • Differentiate between mutable and immutable deployment patterns across various compute platforms.
  • Select the appropriate deployment strategy (Blue/Green, Canary, Rolling) based on business resiliency requirements.
  • Configure CodeDeploy components, including Deployment Groups and AppSpec files, for EC2, ECS, and Lambda.
  • Analyze deployment lifecycle events to troubleshoot failed updates.
  • Implement cross-Region and Multi-AZ deployment patterns to minimize downtime.

Key Terms & Glossary

  • Mutable Infrastructure: Infrastructure that is updated in place. For example, SSH-ing into an EC2 instance to update software versions.
  • Immutable Infrastructure: Infrastructure that is never modified after deployment. Instead, new instances or containers are launched from a fresh image (AMI or Docker image) to replace the old ones.
  • Canary Deployment: A strategy where a small percentage of traffic is shifted to the new version to test stability before a full rollout.
  • Blue/Green Deployment: A strategy that involves two identical environments. "Blue" is the current production, and "Green" is the new version. Traffic is toggled once Green is validated.
  • AppSpec File: A YAML or JSON formatted file used by CodeDeploy to manage the deployment hooks and permissions.
  • Deployment Group: A set of individual instances or a service (like ECS) targeted for a deployment.

The "Big Idea"

In the AWS DevOps Professional domain, deployment is not just about moving code; it is about orchestrating risk. By moving from mutable, manual updates to automated, immutable pipelines, teams can achieve high availability and rapid recovery. Whether you are managing long-running EC2 instances, elastic container clusters (ECS/EKS), or event-driven Lambda functions, the goal remains the same: Zero-downtime updates with automated rollbacks.

Formula / Concept Box

Deployment TypePrimary CharacteristicBest For...
In-PlaceUpdates existing instances (Mutable)Non-critical apps, small fleets
RollingUpdates instances in batchesBalancing cost and availability
Blue/GreenProvisions new fleet, swaps traffic (Immutable)High availability, fast rollbacks
CanaryIncremental traffic shifting (e.g., 10% then 100%)Testing new features with real users

Hierarchical Outline

  1. Deployment Foundations
    • Mutable vs. Immutable: Risks of "configuration drift" in mutable setups.
    • Artifact Management: Using S3, ECR, and CodeArtifact for versioned source control.
  2. Platform-Specific Methodologies
    • Amazon EC2: Uses CodeDeploy Agent; supports In-place and Blue/Green.
    • Amazon ECS: Managed via Task Sets; primary strategy is Blue/Green via CodeDeploy.
    • AWS Lambda: Uses Traffic Shifting (Aliases); Linear vs. Canary updates.
    • Amazon EKS: Utilizes Kubernetes-native strategies (RollingUpdate) or external tools like Flux/ArgoCD.
  3. The Deployment Lifecycle (CodeDeploy Hooks)
    • BeforeInstall / AfterInstall: Pre/Post scripts for dependencies.
    • ApplicationStart / ValidateService: Checking health before routing traffic.

Visual Anchors

Deployment Strategy Selection

Loading Diagram...
Figure 1 — Mermaid diagram

Blue/Green Traffic Shifting Concept

Compiling TikZ diagram…
⏳
Running TeX engine…
This may take a few seconds
Figure 2 — TikZ diagram

Definition-Example Pairs

  • Immutable Pattern
    • Definition: A deployment approach where you never patch a server, but replace it entirely.
    • Example: Using EC2 Image Builder to create a new AMI for every software update, ensuring every instance in a cluster is bit-for-bit identical.
  • Traffic Shifting
    • Definition: The process of incrementally moving user requests from an old version of a Lambda function to a new version.
    • Example: Updating a Lambda function alias to point 10% of traffic to version 2 (Canary) for 10 minutes before shifting the remaining 90%.

Worked Examples

Scenario: Configuring a Lambda Canary Deployment

Goal: Deploy a new Lambda function version where 10% of traffic is sent to the new version for a 5-minute bake period.

  1. Version the Function: Publish a new version of the Lambda code.
  2. Create an Alias: Point an alias (e.g., prod) to the old version.
  3. Define AppSpec:
    yaml
    version: 0.0 Resources: - myLambdaFunction: Type: AWS::Lambda::Function Properties: Name: "MyProcessor" Alias: "prod" CurrentVersion: "1" TargetVersion: "2" Hooks: - PreTraffic: "BeforeAllowTrafficLambdaFunction" - PostTraffic: "AfterAllowTrafficLambdaFunction"
  4. Deployment Configuration: Select LambdaCanary10Percent5Minutes in CodeDeploy.

Checkpoint Questions

  1. Which CodeDeploy lifecycle hook is used to verify that a service is running correctly before it starts receiving production traffic?
  2. What is the main advantage of an Immutable deployment over a Mutable one regarding "configuration drift"?
  3. In an ECS Blue/Green deployment, what AWS service handles the actual rerouting of traffic?

[!TIP] Answers: 1. ValidateService. 2. It eliminates drift because instances are replaced rather than modified. 3. Application Load Balancer (ALB).

Muddy Points & Cross-Refs

  • ECS vs. EKS Scaling: While ECS is AWS-native and integrates deeply with CodeDeploy for Blue/Green, EKS often requires Kubernetes Autoscalers (HPA/VPA) and differs in how it handles rolling updates (via Deployment manifests).
  • Lambda@Edge: Note that Lambda@Edge (used for CloudFront) does not support CodeDeploy traffic shifting aliases; deployments here are managed through CloudFront distribution updates.

Comparison Tables

Platform Comparison: CodeDeploy Capabilities

FeatureEC2ECSLambda
Agent Required?YesNoNo
AppSpec FormatYAMLYAML/JSONYAML/JSON
Traffic ShiftingDNS/LB SwapALB Target Group SwapAlias Weighting
In-Place SupportYesNoNo
Rollback MethodRedeploy old versionSwap Target GroupsUpdate Alias

Comparison: Mutable vs. Immutable

AspectMutableImmutable
ProcessPatching existing serversReplacing servers with new ones
SpeedFaster for small changesSlower (image build time)
ReliabilityLow (drift occurs)High (consistent state)
RollbackComplex (must undo changes)Simple (terminate new, keep old)
All AWS Certified DevOps Engineer - Professional (DOP-C02) Study Resources

Related Notes

  • Mastering AWS Alerting and Automated Remediation1,050 words
  • Study Guide: Analyzing Failed Deployments in AWS940 words
  • Incident Analysis: Troubleshooting Failed Processes in AWS1,050 words
  • Mastering AWS Monitoring & Security Analytics: Logs, Metrics, and Findings1,050 words
  • AWS Log Analysis: Athena, CloudWatch Insights, and OpenSearch920 words
  • Analyzing Real-Time Log Streams with Amazon Kinesis Data Streams985 words
  • CloudWatch Anomaly Detection Alarms: Professional Study Guide820 words
  • AWS Application Storage Patterns: EBS, EFS, and S31,054 words
  • Lab: Automating Security Controls and Data Protection with AWS Secrets Manager and Config942 words
  • Master Study Guide: Automating Security Controls & Data Protection (AWS DOP-C02)1,184 words
  • Mastering AWS CloudFormation StackSets: Multi-Account & Multi-Region Orchestration895 words
  • Mastering System Configuration Changes in AWS945 words

Ready to study AWS Certified DevOps Engineer - Professional (DOP-C02)?

Practice tests, flashcards, and all study notes — free, no sign-up.

Start Studying

Ready to study AWS Certified DevOps Engineer - Professional (DOP-C02)?

Practice tests, flashcards, and all study notes — free, no sign-up needed.

Start Studying — Free
AWS Certified DevOps Engineer - Professional (DOP-C02) ResourcesExplore All HivesBlogHome

© 2026 BrainyBee. Free AI-powered exam prep.

Loading Diagram...
Flowchart, top to bottom. New Deployment Requirement connects to Is zero-downtime required?. B connects to In-Place Deployment (No). B connects to Is cost a major constraint? (Yes). D connects to Rolling Deployment (Yes). D connects to Risk Tolerance? (No). F connects to Canary Deployment (Low). F connects to Blue/Green Deployment (High).