{"slug": "chandra-meets-codedeploy-my-first-aws-deployment-journey", "title": "Chandra Meets CodeDeploy: My First AWS Deployment Journey", "summary": "A developer documented using AWS CodeDeploy to automate application deployment for a college placement prediction project, describing how the fully managed service handles code, configuration, and scripts across EC2, Lambda, and ECS. The writeup covers the appspec.yml lifecycle hooks, in-place and blue/green deployment strategies, and automatic rollback triggered by CloudWatch alarms.", "body_md": "*Exploring how AWS CodeDeploy makes application deployment easier, faster, and more reliable.*\n\nIn software development, creating an application is only the beginning. After writing code, developers must move it from their computers to a server where users can access it. This process is called **deployment**.\n\nImagine a student team developing a college placement prediction application. Every time the team improves the machine learning model or updates the website, they need to transfer the new files to the server, configure the application, and restart it. Doing this manually can be time-consuming and may cause errors.\n\nThis is where **AWS CodeDeploy** becomes useful. It automates the deployment of application updates to supported computing environments. In this blog, I will explore what AWS CodeDeploy is, how it works, its important features, and how a college student project can benefit from it.\n\n**AWS CodeDeploy** is a fully managed deployment service provided by Amazon Web Services (AWS). It helps developers automatically deploy application code, configuration files, scripts, and other application content to computing environments.\n\nCodeDeploy supports three major compute platforms:\n\nIt can retrieve application revisions from sources such as Amazon S3 and supported source-code repositories, depending on the deployment platform.\n\nBefore automated deployment tools became common, developers often copied files manually to servers and executed several commands to update an application. This process could lead to configuration mistakes, inconsistent deployments, and application downtime.\n\nAWS CodeDeploy was created to simplify this process. It allows developers to define deployment instructions once and reuse them whenever a new application version is released.\n\nInstead of repeatedly performing deployment tasks manually, developers can allow CodeDeploy to install the new version, execute required scripts, monitor the deployment, and report whether it succeeded.\n\nAt a high level, CodeDeploy follows a simple pattern:\n\nYou store your application code in a source location (GitHub, S3, or CodeCommit).\n\nYou describe the deployment steps in a file called appspec.yml, which lives with your code.\n\nCodeDeploy picks up the revision, copies it to your target instances (or updates your Lambda/ECS version), and runs the lifecycle hooks defined in appspec.yml in order — stopping the old version, installing the new one, and starting it back up.\n\nIf you've attached CloudWatch alarms, CodeDeploy watches them during the rollout and automatically rolls back if something looks unhealthy.\n\nHere's a simplified view of that flow:\n\n(Diagram: Developer → Source Repo → CodeDeploy reads appspec.yml → Deployment Group runs lifecycle hooks (ApplicationStop → DownloadBundle → BeforeInstall → Install/AfterInstall → ApplicationStart/ValidateService) → CloudWatch monitors health and can trigger rollback.)\n\nKey Features\n\nAutomated, consistent deployments Once configured, deployments happen the same way every time — no manually remembering which command to run on which server. This removes a huge class of human error.\n\nMultiple deployment strategies CodeDeploy supports in-place deployments (update the existing instances one at a time or in batches) and blue/green deployments (spin up a new fleet, shift traffic over, and terminate the old one only after the new one is verified). This lets you choose between speed and safety depending on the project.\n\nAutomatic rollback on failure If a deployment fails a lifecycle event or trips a CloudWatch alarm, CodeDeploy can automatically roll back to the last known good version — something that's genuinely hard to build reliably by hand.\n\nWorks across compute types The same core service deploys to EC2/on-premises servers, Lambda functions, and ECS containers, so you don't need a completely different tool depending on your architecture.\n\nCollege / Student Use Case\n\nHere's where this becomes directly relevant to campus life. At CIT, several departments run small internal web apps — placement portals, event registration pages, club websites (like our Rotaract Club page), or student project demos hosted for review. Right now, most of these are deployed manually: someone logs into a server, pulls the latest code, and restarts it, often right before a demo deadline.\n\nA practical use case: our department could host student mini-project demos (like a Flask-based ML model demo) on a small EC2 instance, with CodeDeploy watching the GitHub repository. Every time a student pushes an update before their review, CodeDeploy automatically redeploys the latest version to the demo server — no manual server access needed, and no risk of forgetting a step under deadline pressure. If the new version crashes, CodeDeploy rolls back automatically, so the demo server never goes down entirely.\n\nSimple Example\n\nA minimal appspec.yml for deploying a small web app to EC2 looks like this:\n\nyaml\n\nversion: 0.0\n\nos: linux\n\nfiles:\n\nAnd triggering a deployment through the AWS CLI is just:\n\nbash\n\naws deploy create-deployment \\\n\n  --application-name student-demo-app \\\n\n  --deployment-group-name demo-server-group \\\n\n  --github-location repository=my-username/student-project,commitId=\n\nCodeDeploy then runs each hook script in order and reports success or failure in the console.\n\nCodeDeploy automates the process of transferring and installing application updates. It reduces the need for developers to manually copy files, execute installation commands, and restart services.\n\nFor example, a team can prepare a new version of a web application and use CodeDeploy to release it to a group of EC2 instances.\n\nCodeDeploy supports different deployment strategies.\n\n**In-place deployment:** The existing servers are updated with the new application version. The application may be stopped during the update, depending on the configuration.\n\n**Blue/green deployment:** A new environment is prepared with the updated application. After testing, traffic can be redirected from the old environment to the new one. This can reduce service interruptions and make testing safer.\n\nFor EC2 deployments, CodeDeploy supports both in-place and blue/green strategies. Lambda and ECS deployments use blue/green deployment methods with traffic-shifting configurations.\n\nThe AppSpec file is an important part of CodeDeploy. It defines how files should be copied and which scripts should run during different deployment stages.\n\nFor example, a deployment may need to:\n\nThese instructions can be stored in the AppSpec file and reused during future deployments.\n\nCodeDeploy provides deployment status information through the AWS Management Console and AWS CLI. Developers can check whether a deployment succeeded, failed, or is still in progress.\n\nDeployment configurations can also work with health checks and alarms. In suitable setups, failed deployments can be stopped or rolled back to a previous application version.\n\nConsider a student team at a college developing a **Placement Prediction Web Application**.\n\nThe project uses:\n\nInitially, the team manually uploads updated Python files and the machine learning model to the EC2 server whenever they make changes. As the project grows, this becomes difficult to manage, especially when several students contribute code.\n\nThe team can use AWS CodeDeploy to automate the process.\n\nWhenever the team prepares a new application version, they can package the Flask application, configuration files, and deployment scripts into a revision. The revision can be uploaded to Amazon S3. CodeDeploy can then deploy the revision to the EC2 instance.\n\nFor example, when the team improves the prediction model, CodeDeploy can install the updated model and application files, execute the required scripts, and report the deployment result.\n\nThis approach helps students understand real-world DevOps practices, reduces repetitive manual work, and creates a more organized deployment workflow.\n\nLet us consider a basic Python Flask application deployed to an Ubuntu EC2 instance.\n\n```\nmy-flask-app/\n│\n├── app.py\n├── requirements.txt\n├── appspec.yml\n└── scripts/\n    ├── install_dependencies.sh\n    └── start_application.sh\n```\n\nThe `app.py` file contains a simple web application:\n\n``` python\nfrom flask import Flask\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef home():\n    return \"Hello from AWS CodeDeploy!\"\n\nif __name__ == \"__main__\":\n    app.run(host=\"0.0.0.0\", port=5000)\n```\n\nThe `appspec.yml` file tells CodeDeploy where to copy the application files and which scripts to execute.\n\n```\nversion: 0.0\nos: linux\n\nfiles:\n  - source: /\n    destination: /home/ubuntu/my-flask-app\n\nhooks:\n  AfterInstall:\n    - location: scripts/install_dependencies.sh\n      timeout: 300\n      runas: ubuntu\n\n  ApplicationStart:\n    - location: scripts/start_application.sh\n      timeout: 300\n      runas: ubuntu\n```\n\nThe `files` section specifies the destination directory. The `hooks` section defines scripts that run after installation and when the application starts.\n\nThe `install_dependencies.sh` script can install the Python packages required by the application.\n\n``` bash\n#!/bin/bash\ncd /home/ubuntu/my-flask-app\npython3 -m pip install -r requirements.txt\n```\n\nThe `start_application.sh` script can start the Flask application.\n\n``` bash\n#!/bin/bash\ncd /home/ubuntu/my-flask-app\nnohup python3 app.py > app.log 2>&1 &\n```\n\nThese scripts are only a basic demonstration. In a production environment, a process manager such as `systemd` should normally be used instead of repeatedly starting background processes with `nohup`.\n\nThe student team can follow these steps:\n\nThe EC2 instance must have the necessary IAM permissions, and the CodeDeploy agent must be correctly installed and running.\n\nAWS CodeDeploy offers several advantages:\n\nAlthough CodeDeploy is useful, it is not a complete replacement for every DevOps tool.\n\nCodeDeploy does not charge an additional fee for deployments to Amazon EC2, on-premises instances, AWS Lambda, or Amazon ECS. However, the AWS resources used alongside it may incur charges.\n\nFor example, students may need to pay for EC2 instances, Amazon S3 storage, data transfer, CloudWatch monitoring, or other services. AWS Free Tier eligibility and pricing conditions should be checked before using resources.\n\nCodeDeploy requires configuration of IAM roles, deployment groups, application revisions, and, for EC2 deployments, the CodeDeploy agent. Beginners may need time to understand these components.\n\nIAM permissions should follow the principle of least privilege. S3 buckets should be protected, credentials should not be stored inside application files, and deployment scripts should be reviewed before execution.\n\nCodeDeploy automates deployment, but it does not automatically fix bugs in application code, configure every server dependency, or guarantee that an application will work after deployment. Developers must prepare correct scripts and test their applications.\n\nAWS CodeDeploy is a useful AWS service for automating application deployments. It helps developers move application updates to servers, Lambda functions, or ECS services in a more consistent and controlled manner.\n\nFor college students, CodeDeploy provides practical experience with cloud computing, DevOps, deployment automation, IAM, and application release management. A student project such as a placement prediction application can benefit from fewer manual deployment steps and a more organized release process.\n\nAs I explore AWS services, CodeDeploy shows me that building an application is only one part of software engineering. Delivering and maintaining that application reliably is equally important.\n\n**Chandra's takeaway:** CodeDeploy helps turn the process of “I finished my code” into “My updated application is deployed and ready to use.” ☁️", "url": "https://wpnews.pro/news/chandra-meets-codedeploy-my-first-aws-deployment-journey", "canonical_source": "https://dev.to/chandra_prabha_v/chandra-meets-codedeploy-my-first-aws-deployment-journey-2oom", "published_at": "2026-09-16 01:30:57+00:00", "updated_at": "2026-09-16 01:37:16.849252+00:00", "lang": "en", "topics": ["mlops", "ai-infrastructure", "developer-tools"], "entities": ["AWS", "AWS CodeDeploy", "Amazon S3", "GitHub", "AWS CodeCommit", "Amazon CloudWatch", "EC2", "AWS Lambda"], "alternates": {"html": "https://wpnews.pro/news/chandra-meets-codedeploy-my-first-aws-deployment-journey", "markdown": "https://wpnews.pro/news/chandra-meets-codedeploy-my-first-aws-deployment-journey.md", "text": "https://wpnews.pro/news/chandra-meets-codedeploy-my-first-aws-deployment-journey.txt", "jsonld": "https://wpnews.pro/news/chandra-meets-codedeploy-my-first-aws-deployment-journey.jsonld"}}