What is CodeDeploy?
AWS CodeDeploy is a fully managed service that automates code deployments to:
- Amazon EC2
- On-premises servers
- AWS Lambda
- Amazon ECS
πΉ Itβs part of the AWS Developer Tools suite
πΉ Itβs scalable β deploy to one EC2 instance or thousands
πΉ Helps reduce errors and speed up deployments
β¨ Benefits of Using CodeDeploy
β Faster deployments with less manual effort
β Automated & standardized deployment process
β Supports rolling updates to reduce downtime
β Enables blue/green deployments to avoid user impact
β For Lambda & ECS, you can shift traffic using:
- Canary
- Linear
- All-at-once
β Supports automatic rollback on failure
βοΈ How to Use CodeDeploy
There are two ways to use CodeDeploy:
π Manual Deployments using AWS CLI
π Automated Deployments by integrating with AWS CodePipeline
πΉ AWS CodePipeline
The main orchestrator. It automates the whole CI/CD process.
πΉ AWS CodeCommit (Source)
Stores your source code (Git-based repo).
β
Output: Source Artifact
πΉ AWS CodeBuild (Build)
Compiles, runs unit tests, and builds the artifact.
β
Output: Build Artifact
πΉ AWS CodeDeploy (Deploy)
Deploys the build artifact to your EC2 instances.
π Core CodeDeploy Concepts
Concept | Description |
---|---|
Application | Represents your project in CodeDeploy |
Compute Platform | Where it runs (EC2, Lambda, ECS) |
Deployment Group | EC2 instances or Lambda/ECS targets |
Deployment Configuration | Rules for how deployments succeed/fail |
Revision | Your app version (includes source + scripts + appspec) |
Deployment | The actual execution process |
π What is AppSpec File?
An AppSpec file defines how CodeDeploy should deploy your app.
- Format: YAML or JSON
- Must be placed in the root of your source code
- Content differs based on platform
πΉ For EC2 Deployments:
File must be named: appspec.yml or appspec.json
Defines:
- Which folders to copy
- Which scripts to run (e.g., install, start app)
πΉ For ECS and Lambda deployments:.
Use appspec.yaml (for YAML) or appspec.json (for JSON).
Make sure the file is placed in the root directory of your source code.
β Final Thoughts
AWS CodeDeploy is a powerful and scalable deployment tool that becomes even more useful when combined with CodePipeline, CodeBuild, and CodeCommit.
You donβt need to SSH into EC2 and manually copy files anymore β let AWS handle it all for you π₯
π¬ Have you used CodeDeploy before? Share your experience or ask questions in the comments!
Top comments (0)