aws-microservice-project) and a CodeBuild project (for example AWS MicroserviceProject). We’ll also show a short Git workflow to push fixes from Cloud9.
Background: why we needed to fix the app
Earlier we introduced a change that produced a broken task definition (task definition 6) because a few lines were commented out in the application. Below is the problematic version that was reverted from the repository for debugging:Create the pipeline in the AWS Console
Follow these step-by-step instructions to create a simple pipeline that fetches code from CodeCommit and runs CodeBuild.- Open the AWS Management Console and navigate to CodePipeline (located near CodeBuild).
- Click Pipelines -> Create pipeline.
- Give the pipeline a descriptive name.
- Open Advanced settings and keep defaults unless you need to change encryption, service role, or artifact store settings.
- Click Next to configure the Source stage.

Source stage: AWS CodeCommit
- For Source provider, select AWS CodeCommit.
- Choose the repository
aws-microservice-project. - Select the branch
master.

- Click Next to configure the Build stage.
Build stage: AWS CodeBuild
- For Build provider select AWS CodeBuild.
- Choose the appropriate project (for example
AWS MicroserviceProject). - Click Next.



Pipeline summary
Fix code in Cloud9 and push to trigger the pipeline
Make your code edits in Cloud9 (or your local environment), commit, and push tomaster. CodePipeline will automatically start a new execution when it detects the new commit.
Example Git workflow in your Cloud9 environment:
CodePipeline automatically detects changes in the configured source repository and triggers a pipeline execution for each new commit on the tracked branch.
Corrected application example
Below is the final (corrected) application code that was pushed to the repository and picked up by CodePipeline:Update ECS service (manual step)
After the pipeline build completes successfully and produces a new image/task definition revision (for example, revision 8), update your ECS service to use that task definition:- Open the ECS console and select your cluster.
- Choose the service you want to update.
- Click Update -> Select the new task definition revision (e.g., v8).
- Click Update Service to start the deployment.
- Monitor the deployment until it reaches a steady state.
Links and references
- AWS CodePipeline Documentation
- AWS CodeBuild Documentation
- AWS CodeCommit Documentation
- Amazon ECS Documentation