Developer Tools

AWS CodeDeploy

View on GitHub

AWS CodeDeploy

AWS CodeDeploy is a deployment service that automates application updates to compute targets by orchestrating revision distribution and lifecycle hooks. It operates as a control-plane service that coordinates deployments from artifact stores or CI systems to targets such as Amazon EC2 instances, AWS Lambda functions, Amazon ECS services, or on-premises servers. It normally fits into a CI/CD pipeline as the service that applies application revisions to runtime environments using defined deployment strategies.

🗂 Resource Category

Developer Tools • Compute

🧠 Exam Memory Hook

Think: "Automated application deployments with in-place or blue/green strategies to EC2, Lambda, or ECS = AWS CodeDeploy"


📖 Ownership

Classification: Shared Responsibility Service

AWS responsibilities: AWS operates and patches the CodeDeploy control plane, service APIs, console, and the underlying AWS infrastructure that hosts the service; AWS secures and maintains the service platform and its availability. AWS provides official CodeDeploy agent packages and service integrations, but does not operate customer compute targets or the guest operating systems on those targets. AWS is responsible for patching physical infrastructure and the hypervisor that underpins AWS-managed compute services.

Customer responsibilities: The customer provisions and secures deployment targets (EC2 instances, Lambda functions, ECS tasks, or on-premises servers), configures deployment applications, deployment groups, AppSpec files, IAM roles and permissions, and stores revision artifacts; the customer installs and updates the CodeDeploy agent on EC2 or on-premises servers when required. The customer also monitors deployments, configures health checks and rollback behavior, maintains application code and packaged dependencies, and manages guest OS, runtime, and container image patching for their targets.

Patching responsibilities: AWS patches AWS-owned physical infrastructure and hypervisor; AWS patches the CodeDeploy managed control plane and service runtime. The customer patches guest operating systems, application runtimes, libraries, dependencies, container images, and customer-deployed applications. The CodeDeploy agent running on EC2 or on-premises servers is installed and updated by the customer unless using an AWS-managed compute option that removes the agent requirement.


🏗 Typical Architecture

💡 Top 5 Features

  • Supports in-place (rolling) and blue/green deployment strategies for application revisions.
  • Uses an AppSpec file and lifecycle hooks to run scripts or commands at defined deployment stages.
  • Deploys to multiple target types including Amazon EC2, on-premises servers, AWS Lambda, and Amazon ECS.
  • Integrates with CI/CD pipelines and artifact stores to fetch revisions and trigger deployments.
  • Provides deployment monitoring and can perform automatic rollbacks when configured with health checks or alarms.

✅ Top 5 Use Cases

  • Automating staged or blue/green deployments to EC2 fleets where lifecycle hooks must run pre- and post-deploy scripts.
  • Shifting production traffic to updated Lambda functions with traffic-weights and rollback on failures.
  • Coordinating blue/green or canary deployments for Amazon ECS services to minimize user impact during upgrades.
  • Deploying application revisions to on-premises servers using the CodeDeploy agent to unify hybrid release processes.
  • Integrating with CodePipeline to provide an end-to-end CI/CD pipeline that moves artifacts from build to deployment.

🏗 Architecture Placement

AWS CodeDeploy sits in the CI/CD control plane and receives artifact revisions or pipeline triggers from systems like AWS CodePipeline or Amazon S3. It orchestrates distribution and installation of revisions to compute targets (EC2, Lambda, ECS, or on-premises) and invokes lifecycle hooks on those targets. It is a regional service that requires appropriate IAM permissions and, for EC2/on-premises targets, a running CodeDeploy agent installed by the customer when applicable.

🎯 Commonly Used With

- AWS CodePipeline
- Amazon S3
- Amazon EC2
- AWS Lambda
- Amazon CloudWatch

🌍 5 Real-World Examples

  • A retail engineering team uses CodeDeploy with blue/green deployments to update a customer-facing web app on EC2 while shifting traffic and validating health checks to reduce release risk.
  • A financial firm deploys new serverless transaction processing functions by routing a percentage of traffic to updated AWS Lambda revisions and rolling back when monitoring alarms trigger.
  • A healthcare analytics team automates deployment of containerized services to Amazon ECS with CodeDeploy to coordinate traffic shifting and minimize downtime during updates.
  • A telecommunications operator deploys configuration changes to on-premises gateways using the CodeDeploy agent to standardize release procedures across hybrid infrastructure.
  • A technology company integrates CodeDeploy into CodePipeline to deliver build artifacts from source control to production environments with defined lifecycle scripts for database migrations.

🎓 AWS Exam Clues

  • Choose CodeDeploy when you need in-place or blue/green strategies and lifecycle hooks for EC2, Lambda, ECS, or on-premises targets.
  • Remember that EC2 and on-premises targets typically require a customer-installed CodeDeploy agent to execute lifecycle hooks.
  • CodeDeploy often appears alongside CodePipeline and Amazon S3 in exam scenarios describing end-to-end CI/CD pipelines.
  • Automatic rollback and deployment health checks require configuration and may depend on CloudWatch alarms or provided health checks.
  • IAM roles and instance/profile permissions are required for CodeDeploy to access artifacts and perform actions on target compute resources.

📝 Quick Revision

CodeDeploy orchestrates automated deployments of application revisions to EC2, Lambda, ECS, or on-premises targets using in-place or blue/green strategies. Use it when you need lifecycle hooks, traffic shifting, and integration with CI/CD pipelines; ensure agents, IAM, monitoring, and target patching are managed by the customer.

🏷 Keywords

AppSpecdeployment grouprevisionCodeDeploy agentin-place deploymentblue/green deploymenttraffic shiftinglifecycle hooksdeployment configurationautomatic rollbackCodePipeline integrationCloudWatch alarms