Development and deploymentIntermediate23 min read

What Does Deployment stage Mean?

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security
On This Page

Quick Definition

The deployment stage is a specific step in the software release process where your application code is moved from one environment to another. For example, after you finish coding a new feature, you deploy it to a test server so your team can check for bugs. Later, you deploy the approved version to the live production server where real users can access it. It is a key part of the DevOps lifecycle and often automated with tools like AWS CodeDeploy or Jenkins.

Commonly Confused With

Deployment stagevsDevelopment environment

The development environment is a workspace for writing and testing code, often on a local machine or a shared dev server. A deployment stage is a named checkpoint in the CI/CD pipeline that encompasses the entire process of moving code to an environment, not the environment itself. For example, the 'development stage' in a pipeline may deploy code to a development environment, but the two terms are not interchangeable.

A developer writes code on their laptop (development environment). When they push to a branch, the pipeline's 'dev stage' deploys that code to a shared dev server. The environment is the server, the stage is the pipeline step.

Deployment stagevsBuild stage

The build stage compiles source code into deployable artifacts (like a .jar file or Docker image). The deployment stage takes that artifact and installs it into a target runtime environment. Build is about packaging; deployment is about releasing. Mixing them up could lead to selecting the wrong stage when asked about running integration tests after installation.

In a CodePipeline, the build stage compiles code and runs unit tests, producing a built artifact. The deployment stage then takes that artifact and runs it on a server.

Deployment stagevsEnvironment variable

An environment variable is a key-value pair that configures an application's behavior at runtime within a specific environment. A deployment stage is the context in which those variables are set and used. Environment variables are part of the configuration applied during a deployment stage, not the stage itself.

In a deployment stage called 'staging', you set the database URL variable to point to the staging database. The environment variable is a configuration detail, while the deployment stage is the entire process that includes setting that variable.

Deployment stagevsContinuous delivery

Continuous delivery is a software development practice where every code change is automatically built, tested, and prepared for release to production. Deployment stages are the specific pipeline segments that implement continuous delivery. CD is the philosophy; deployment stages are the concrete implementation steps.

A company practices continuous delivery, meaning they have automated pipelines. Within that pipeline, they have stages: test, staging, production. Each stage is a deployment stage that moves the code closer to users.

Must Know for Exams

The AWS Developer Associate exam (DVA-C02) treats deployment stages as a core concept, especially under the 'Development with AWS Services' and 'Deployment' domain objectives. The exam expects you to understand how to model deployment stages using AWS CodePipeline, CodeDeploy, Elastic Beanstalk, and CloudFormation. Questions often require you to design a pipeline that moves code through development, testing, staging, and production, with appropriate gates and environment configurations.

Specifically, you should be able to differentiate between deployment strategies like blue/green, canary, and rolling, and know how each relates to deployment stages. The exam may present a scenario where a company wants to reduce risk when releasing a new version. You might need to recommend a deployment stage configuration using AWS CodeDeploy with a blue/green deployment to an Auto Scaling group. Another common question pattern involves specifying lifecycle hooks in a deployment stage, such as the BeforeInstall hook for running pre-deployment scripts.

The exam also tests your knowledge of environment variables and configuration management across stages. For instance, a question might ask how to securely pass database connection strings to an Elastic Beanstalk environment in the production stage without hardcoding them in the source code. The correct answer would involve using AWS Systems Manager Parameter Store or Secrets Manager. You must understand how deployment stages interact with monitoring and rollback. A scenario might describe a failed deployment in the staging stage, and you need to determine the correct action: stop the pipeline, roll back to the previous version, and notify the team via Amazon SNS.

Finally, exam questions often assess your understanding of the deployment lifecycle within AWS CodeDeploy. You need to know the order of lifecycle events (ApplicationStop, DownloadBundle, BeforeInstall, AfterInstall, ApplicationStart, ValidateService) and what each does. These events map directly to deployment stages. A common trap is confusing the 'ValidateService' event with a manual approval step-remember that ValidateService is an automated hook, not a manual gate. Mastering these details is crucial for scoring high on the deployment-related questions.

Simple Meaning

Imagine you are a chef preparing a new dessert recipe in a restaurant kitchen. Your journey has several stages. First, you experiment with ingredients in a small test kitchen, which is like a developer's laptop. Then you move to the main kitchen to cook a batch for the staff to taste, similar to a test environment. Finally, you serve the dessert to paying customers in the dining room, which is the production environment. Each of these moves is a deployment stage.

In the IT world, a deployment stage is a named environment where your software runs at a particular point in the release pipeline. Common stages include development, where code is written and first tested, staging, which mimics production for final verification, and production, where real users interact with the software. Each stage has its own purpose and level of risk. The deployment stage concept helps teams organize the release process so that changes are tested thoroughly before reaching users.

Think of it like a quality checkpoint in a factory. At each deployment stage, you inspect the product, run automated tests, and ensure it works correctly. If something fails in the staging stage, you catch it before it affects real customers. This staged approach reduces downtime, prevents errors, and makes software updates safer and more predictable. For an AWS Developer Associate candidate, understanding deployment stages means knowing how to use services like AWS Elastic Beanstalk, CodePipeline, and CloudFormation to automate moving code through these stages.

Full Technical Definition

In modern software engineering, particularly within cloud-native and DevOps practices, the deployment stage is a defined, gated phase in a continuous delivery pipeline. It represents a specific target environment-such as development, integration, testing, staging, or production-where a software artifact (e.g., a Docker image, a compiled binary, or a set of scripts) is installed and configured for execution. The deployment stage is not merely a single action but a coordinated sequence of operations that may include infrastructure provisioning, artifact transfer, environment variable setting, database migration, and health check validation.

From an AWS perspective, deployment stages are formalized through services like AWS CodePipeline, which structures a release process into sequential stages. Each stage can contain multiple actions, such as source code retrieval from AWS CodeCommit, building with AWS CodeBuild, and deploying to an environment managed by AWS Elastic Beanstalk or AWS EC2. Stage transitions often require approvals, either manual or through automated compliance checks. The concept of immutable infrastructure is common, where each deployment stage creates a fresh environment rather than modifying an existing one.

Under the hood, deployment stages rely on infrastructure as code (IaC) tools like AWS CloudFormation or Terraform to define and provision resources consistently. For example, a staging deployment might spin up an Auto Scaling group with the latest application version, run integration tests, and then tear down the environment. Production deployment often uses blue/green or canary release strategies to minimize risk. The deployment stage also interacts with monitoring and logging services-AWS CloudWatch and AWS X-Ray-to verify that the service behaves as expected after deployment.

Key protocols and standards include HTTP/HTTPS for health check endpoints, SSH or AWS Systems Manager for configuration management, and container orchestration with Amazon ECS or EKS for microservices. A crucial technical detail is that deployment stages are typically managed via JSON or YAML pipeline definitions, such as the buildspec.yaml and appspec.yaml files used by AWS CodeBuild and CodeDeploy. These files define the lifecycle hooks (e.g., BeforeInstall, AfterInstall) that execute custom scripts during each stage. Understanding these components is vital for the AWS Developer Associate exam, where questions often ask about stage design, environment variables, and rollback strategies.

Real-Life Example

Think of how a new smartphone app update gets to your phone from the developer's initial idea. The first deployment stage is the developer's own computer, like a chef's personal test kitchen. Here, the developer writes the code and runs basic checks to see if it runs at all. It's a messy, creative space where mistakes are expected.

Next, the code moves to a shared team environment, called a staging server. This is like a restaurant's main kitchen where the whole cooking team works together. The app is installed on a server that closely matches the real production environment, but only team members can see it. The quality assurance team tests features, checks for bugs, and verifies that new code doesn't break existing functions. If a waiter finds a bug, the developer goes back to the first stage to fix it.

Once the team approves the version, it goes to a beta testing stage. This is like letting a few trusted friends taste the new dish before it appears on the menu. The app is released to a small group of real users who provide feedback. This stage catches issues that only appear with diverse devices or network conditions.

Finally, the app reaches the production deployment stage. This is the full rollout to the entire restaurant menu-all users see the update. The deployment to production is often done gradually, like serving the new dish only in one section of the dining room first, then expanding. If something goes wrong, the team can quickly roll back to the previous version, just as the chef can pull a dish from the menu. Each of these stages-developer laptop, staging, beta, production-is a distinct deployment stage, each with its own purpose, checks, and risks.

Why This Term Matters

In practical IT operations, deployment stages are the backbone of safe and reliable software releases. Without clearly defined stages, teams risk deploying buggy code directly to users, causing downtime, data loss, or security vulnerabilities. For example, a small e-commerce site that skips the staging stage might accidentally push a broken checkout feature to production, losing sales and customer trust. Each stage acts as a safety net, catching issues before they reach end users.

From a DevOps perspective, deployment stages enable automation and repeatability. Tools like AWS CodePipeline and Jenkins allow teams to define a pipeline with multiple stages, each running specific tests and approvals automatically. This reduces human error and speeds up delivery. Many organizations also use multiple parallel deployment stages to support different environments-such as a dedicated staging environment for integration testing and a separate one for performance testing.

Understanding deployment stages is also critical for compliance and auditing. In regulated industries like finance or healthcare, auditors need to verify that code has passed through defined stages before reaching production. A well-documented deployment stage history provides an immutable audit trail. Stage gates, such as manual approval steps or automated vulnerability scans, ensure that only compliant code progresses.

Finally, deployment stages enable advanced release strategies like blue/green, canary, and rolling deployments. In a blue/green deployment, you have two identical production environments (blue and green). You deploy the new version to the inactive environment, test it, then switch traffic. This approach requires precise stage management. For an AWS Developer Associate, mastering deployment stages is not just about passing an exam-it is about building production-ready systems that are resilient, scalable, and maintainable.

How It Appears in Exam Questions

On the AWS Developer Associate exam, deployment stage questions appear in several distinct patterns. One common type is the scenario-based design question. For example: 'A company uses AWS CodePipeline to deploy a web application. They have two environments: a test environment and a production environment. The development team wants to automatically deploy every commit to the test environment, but require a manual approval before deploying to production. How should they configure the pipeline stages?' The correct answer would involve creating a pipeline with a 'Test' stage containing a deploy action, and a 'Production' stage with a manual approval step as a gate before the deploy action. The trap is that some learners might incorrectly add the approval step to the test stage instead.

Another common pattern involves troubleshooting deployment failures. A question might describe a scenario where a deployment to Amazon EC2 instances using CodeDeploy fails during the AfterInstall hook. The candidate must identify which log file (traditionally /opt/codedeploy-agent/deployment-root/deployment-logs/codedeploy-agent-deployments.log) to check for detailed error information. Or the exam might ask which lifecycle event should be used to run a script that registers the new instance with a load balancer-the answer is During AfterInstall or ValidateService.

Configuration-based questions are also frequent. For instance: 'A developer defines a deployment stage in a CloudFormation template. Which AWS resource type should they use to deploy a containerized application to Amazon ECS?' The answer is AWS::CodeDeploy::DeploymentGroup with an ECS compute platform. Another question might ask about the purpose of the ValidateService lifecycle event in CodeDeploy-the candidate must know it performs health checks, not code download.

Finally, the exam may ask about versioning and rollback across deployment stages. For example: 'An application deployed using CodeDeploy has a failed deployment in production. The team wants to revert to the last known good revision. What should they do?' The correct answer is to use the CodeDeploy rollback feature, which automatically redeploys the previous revision. The exam might also test that rollbacks create a new deployment, not a switch back to an old environment. Knowing these details helps you recognize the correct answer among distractors that mention manual instance termination or re-running the pipeline from the start.

Practise Deployment stage Questions

Test your understanding with exam-style practice questions.

Practise

Example Scenario

A small startup named 'FitTrack' develops a mobile fitness app. The team of three developers uses a simple deployment pipeline on AWS. They have three main deployment stages: development, staging, and production. Every time a developer pushes code to the main branch in AWS CodeCommit, an AWS CodePipeline triggers automatically.

The first stage is 'DevDeploy'. The pipeline uses AWS CodeBuild to compile the code and run unit tests. If the tests pass, it deploys the application to an AWS Elastic Beanstalk environment configured for development. The environment is a single EC2 instance with low resources, just enough for the team to see if the app runs. The development stage does not require any manual approval-it updates automatically with every commit.

After successful deployment to the development environment, the pipeline moves to the 'StagingDeploy' stage. This stage deploys the same code to a staging environment that mimics production: it uses a load balancer, two EC2 instances, and a small Amazon RDS database. Before deploying, the pipeline runs integration tests against the running staging application. If the tests fail, the pipeline stops and sends an alert to the team via Amazon SNS. Only if all tests pass does the pipeline proceed.

The final stage is 'ProdDeploy'. This stage has a manual approval gate. A senior developer must review the staging results and click 'Approve' in the AWS CodePipeline console. Once approved, CodeDeploy performs a blue/green deployment to the production environment, which consists of a large Auto Scaling group behind an Application Load Balancer. The new code is deployed to a fresh 'green' environment. After the green environment passes a health check, traffic is switched from the old (blue) to the new (green) environment. If anything goes wrong during the ValidateService step, the pipeline automatically rolls back to the blue environment. This staged, automated pipeline ensures that FitTrack's users always see a stable, tested version of the app.

Common Mistakes

Thinking that the development stage is the same as the staging stage.

Development is for initial code changes and unit tests, while staging is a production-like environment for integration and end-to-end testing. They serve different purposes-one identifies bugs as early as possible, the other validates that the system works as a whole.

Always separate development and staging environments. Use development for quick feedback, staging for full integration verification before production.

Assuming a deployment stage is just one action, like copying files.

A full deployment stage includes provisioning infrastructure, transferring artifacts, setting environment variables, running lifecycle hooks, and performing health checks. It is a coordinated process, not a single copy operation.

Map out each step in a deployment stage: provision, install, configure, test, validate. Use lifecycle hooks to automate each part.

Applying the same environment variables across all stages without modification.

Different environments need different configuration values, such as database endpoints, API keys, and log levels. Using production credentials in a development stage could lead to security breaches or accidental data corruption.

Use environment-specific parameter files or AWS Systems Manager Parameter Store to inject correct values per stage.

Ignoring the ValidateService lifecycle event in CodeDeploy.

The ValidateService event is essential for automatically verifying that the deployed application is healthy. Skipping it means the deployment might succeed even if the app is not serving requests correctly.

Always include a health check script in the ValidateService hook that pings the application endpoint and returns a success or failure code.

Believing that rollback in CodeDeploy reverts to the previous stage automatically.

A rollback only redeploys the last successful revision within the same stage; it does not move the pipeline back to an earlier stage. The pipeline remains in its current stage after rollback.

Understand that rollback is a deployment action, not a pipeline stage reversal. Use the pipeline manual approval or a separate rollback pipeline if you need to revert to an earlier stage.

Exam Trap — Don't Get Fooled

{"trap":"The exam might present a scenario where a deployment to production fails, and a 'rollback' option is described as 'reverting the pipeline to the staging stage' or 'restoring the previous deployment revision in the production stage'. Many learners mistakenly choose the seemingly logical 'revert to staging' option.","why_learners_choose_it":"Learners often think of rollback as undoing all work and going back a full step in the pipeline.

They associate a failed production deployment with the need to return to the staging environment to fix the issue, rather than understanding that a rollback is a corrective action within the current production stage itself.","how_to_avoid_it":"Remember that in CodeDeploy and similar tools, a rollback is an automated process that happens within the same deployment stage. It redeploys the last known good revision to the same environment (e.

g., production) and does not affect the pipeline stage history. The correct answer is always 'Initiate a rollback to the previous revision in the production deployment group.' Never assume rollback means moving to an earlier pipeline stage."

Step-by-Step Breakdown

1

Source Stage Trigger

The deployment pipeline begins when a code change is detected, typically a commit to a repository (e.g., AWS CodeCommit, GitHub). A webhook or scheduled check triggers the first stage. This matters because it defines what event initiates the deployment process.

2

Build and Package the Code

In the build stage, source code is compiled, dependencies are installed, and the application is packaged into a deployable artifact (e.g., a .zip file, container image, or compiled binary). This artifact is what will be installed in later deployment stages.

3

Deploy to Development Environment

The artifact is automatically deployed to a development environment. This is often a simple, low-resource server. Quick automated smoke tests verify the basic functionality. This stage catches obvious errors early without affecting other users.

4

Deploy to Staging/Test Environment

After the development stage passes, the artifact is deployed to a staging environment that closely mimics production. Here, full integration tests, performance tests, and security scans are run. This stage is essential for catching environment-specific issues.

5

Manual Approval Gate

Before moving to production, a manual approval step is often added. An authorized team member reviews the test results from staging and manually approves the deployment. This acts as a human quality checkpoint, ensuring that nothing unintended reaches real users.

6

Deploy to Production Environment

Once approved, the artifact is deployed to the production environment using a safe strategy like blue/green or rolling deployment. During this step, lifecycle hooks (e.g., BeforeInstall, AfterInstall, ValidateService) are executed to configure the application and verify its health.

7

Post-Deployment Validation

After the deployment completes, monitoring tools like Amazon CloudWatch and AWS X-Ray check that application performance and error rates remain healthy. If issues are detected, the pipeline can trigger an automatic rollback to the previous version. This final step ensures continuous observability.

Practical Mini-Lesson

To truly understand deployment stages in an AWS context, you need to work through a real pipeline configuration. Let's consider using AWS CodePipeline with a simple Node.js application. First, define your pipeline structure. In the console, you create a pipeline with at least three stages: Source, Build, and Deploy. Each stage has one or more actions.

In the Source stage, connect to your repository (e.g., AWS CodeCommit). The action type is 'Source'. This stage pulls the latest code when a commit is pushed. The output is the source artifact, usually stored in an Amazon S3 bucket that CodePipeline manages.

Next is the Build stage. Use AWS CodeBuild as the action provider. Create a buildspec.yaml file in your repository. This file defines the build commands: 'npm install', 'npm run build', and 'npm test'. The buildspec also specifies artifacts-the files that will be passed to the next stage, typically a dist folder or a zipped package. Important: set the buildspec's 'artifacts' section correctly; otherwise, the deployment stage won't have the right files.

Now comes the deployment stage. For a simple application using Elastic Beanstalk, you can add a deploy action with AWS Elastic Beanstalk as the provider. You must specify the application name and environment name, such as 'MyApp-Staging'. Elastic Beanstalk automatically handles provisioning an EC2 instance, load balancer, and monitoring. You can also configure environment variables (like DATABASE_URL) in the Elastic Beanstalk environment configuration, not in the code.

A common practical issue arises with environment-specific values. For instance, in the staging stage you want to use a separate RDS database than in production. The best practice is to use AWS Systems Manager Parameter Store or Secrets Manager to store these values, and have your application fetch them at startup based on an environment variable like 'ENVIRONMENT=staging' set in the Elastic Beanstalk environment. This avoids hardcoding secrets and makes the deployment stages truly portable.

Another critical detail is the deployment strategy. For the production stage, you may want a blue/green deployment. In Elastic Beanstalk, you can configure this in the environment's deployment preferences. For CodeDeploy, you define a DeploymentGroup with the compute platform (EC2, Lambda, or ECS) and set the deployment style to blue/green. This ensures zero downtime during updates.

What can go wrong? The most common failure is an incorrect build artifact path: if the build stage outputs files to a folder that the deployment stage does not expect, the deployment will fail because it cannot find the installable files. Another issue is environment variable mismatch: if staging and production share the same parameter names but the staging environment accidentally reads the production database URL, data corruption can occur. Always test each deployment stage independently by checking the logs in CodePipeline execution history. Understanding these practical details prevents real-world outages and is exactly what the AWS Developer Associate exam evaluates.

Memory Tip

Think '3 D's' for deployment stages: Develop (dev stage), Double-check (staging stage), Deliver (production stage). Each stage is a checkpoint with increasing risk.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Related Glossary Terms

Frequently Asked Questions

How many deployment stages do I need for a typical web app?

There is no fixed number, but a common pattern is three: development, staging, and production. Some teams add a build stage and a manual approval step. The key is to have at least one pre-production stage to catch issues before users see them.

Can deployment stages be skipped in an emergency?

Technically yes, but it is risky. AWS CodePipeline allows manual approvals and stage overrides, but skipping stages bypasses testing gates. In a real emergency, a hotfix could be deployed directly to production, but only if you accept the increased risk of unforeseen bugs.

Do deployment stages cost money?

Yes, each stage runs resources. A development environment might be a small t2.micro EC2 instance, which costs very little. Staging and production environments are larger and cost more. However, the cost is usually justified by preventing costly production outages.

What is the difference between a deployment stage and a deployment group in CodeDeploy?

A deployment stage is a logical phase in a pipeline (e.g., 'Deploy to Staging'). A deployment group is a CodeDeploy resource that defines the target instances or Lambda functions for a specific deployment. A stage can contain a deploy action that references a deployment group.

How do I handle database schema changes across deployment stages?

Use database migration tools like AWS Database Migration Service or a migration tool integrated into your app (e.g., Flyway). Run migration scripts in the deployment's AfterInstall lifecycle hook, not in the build stage, because the database is available only after the application is installed in the target environment.

What happens to old instances during a deployment stage?

It depends on the deployment strategy. In a rolling deployment, old instances are terminated or replaced gradually. In a blue/green deployment, the old environment (blue) is kept running until the new one (green) passes health checks, then traffic is switched and the blue environment is terminated.

Can I have multiple environments in one deployment stage?

No, a single deployment stage corresponds to one target environment. If you need to deploy to multiple environments in parallel, you can create separate stages. For example, you might have one stage for 'Deploy to US East Staging' and another for 'Deploy to EU West Staging'.

Is it possible to reuse the same deployment stage for multiple applications?

You can use a common pipeline template, but each application typically has its own pipeline and stage configuration to avoid conflicts. Shared stages would need careful resource naming and isolation to prevent collisions.

Summary

The deployment stage is a fundamental concept in modern software delivery, representing a specific, gated phase in a CI/CD pipeline where code is released to a target environment. It is not just a single action but a coordinated process involving infrastructure provisioning, artifact installation, configuration management, lifecycle hooks, and validation checks. Understanding deployment stages helps teams release software safely and reliably, reducing the risk of downtime and errors.

In the context of the AWS Developer Associate exam, deployment stages are central to the deployment domain. You must be able to design pipelines with multiple stages, configure lifecycle events, implement blue/green and rolling deployments, set environment-specific variables, and handle rollbacks. Common mistakes include conflating stages with environments, ignoring validation hooks, and misunderstanding the scope of a rollback. Exam traps often test your knowledge of what a rollback actually does versus what it does not do.

For practical mastery, map out a simple three-stage pipeline (dev, staging, production), implement it in AWS CodePipeline with Elastic Beanstalk or CodeDeploy, and experiment with lifecycle hooks and environment variables. The key takeaway for the exam is that deployment stages provide the structure for safe, automated, and auditable software releases. By understanding their purpose, components, and best practices, you can answer deployment-related questions with confidence and build production-ready systems in your career.