How apingale2026/aws_devops_pipeline_simple_manual_aws_project_1 works
1. Repository purpose
- This repo is a small AWS DevOps pipeline for a containerized Flask To-Do application.
- The main architectural idea is: GitHub source → Docker image build → ECR registry → EC2 runtime deployment, fully automated by AWS CI/CD services.
2. Application boundary
- app.py contains the actual Flask web app and is the application layer you would diagram as the runtime service.
- The app provides CRUD behavior for a To-Do list, so the external interface is the HTTP web endpoint exposed by the container.
3. Containerization boundary
- Dockerfile defines how the Flask app is packaged into a container image.
- This is the boundary between application code and deployment/runtime infrastructure: the app runs inside a Docker container rather than directly on EC2.
4. Artifact registry
- The built image is pushed to Amazon ECR.
- ECR is the durable handoff point between build and deploy stages, and it is where the deploy target pulls the exact image version from.
5. CI build subsystem
- buildspec.yml is the CodeBuild definition.
- Its role is to build the Docker image, authenticate to ECR, and publish the image artifact so downstream deployment can reference the correct version.
6. Deployment orchestration
- appspec.yml is the CodeDeploy deployment manifest.
- It tells CodeDeploy how to place files and run deployment hooks on the EC2 instance, making it the bridge between pipeline artifacts and server-side execution.
7. EC2 runtime subsystem
- The app ultimately runs on an Amazon EC2 instance.
- The instance is not just a compute host; it is the target deployment node that pulls the container image from ECR and launches the containerized Flask service.
8. Host provisioning and lifecycle scripts
- userdatascript is used to bootstrap the EC2 instance, likely installing Docker, AWS CLI, and the CodeDeploy agent.
- scripts/pull_and_run.sh and scripts/cleanup.sh look like deployment lifecycle helpers: one to fetch and start the new container, and one to stop/remove old containers or cleanup prior state.
9. Pipeline flow
- The end-to-end flow described in the README is:
- developer pushes code to GitHub,
- CodePipeline detects the change,
- CodeBuild builds and pushes the container image to ECR,
- CodeDeploy updates the EC2 host using the deployment spec and scripts.
- This is a classic source-controlled immutable image deployment pattern.
10. AWS service roles and boundaries
- The architecture depends on three AWS services with distinct responsibilities:
- CodePipeline for orchestration,
- CodeBuild for image creation and registry publish,
- CodeDeploy for host-side rollout.
- ECR is the artifact store, and EC2 is the execution environment.
11. Operational characteristics
- Deployments are push-triggered via GitHub webhook integration, so each new commit can launch the pipeline automatically.
- Because the app is containerized, the deployment unit is the image version, not a mutable server filesystem state.
12. What to draw in an architecture diagram
- Draw four main zones:
- Source control: GitHub repo containing app.py, Dockerfile, and pipeline files.
- Build/registry: CodeBuild building a Docker image and pushing to ECR.
- Deployment control plane: CodePipeline and CodeDeploy.
- Runtime: EC2 instance with Docker and the CodeDeploy agent running the Flask container.
- The central data flow is source code → build artifact/image → registry → deployed container on EC2.
Main entry points: pull_and_run.sh Pull and run · Dockerfile Container spec · app.py Flask app · requirements.txt Deps
Components 16
Source control
Repository content and application code
- GitHub · Pushes commits and starts the delivery flow
- Flask app · CRUD To-Do application entrypoint
app.py - Container spec · Packages the Flask app into a Docker image
Dockerfile - Deps · Python package dependencies for the app
requirements.txt
Build and registry
Container image creation and artifact storage
- CodeBuild spec · Builds the Docker image and publishes it to ECR
buildspec.yml - CodeBuild · Executes image build and registry publish steps
- ECR · Stores the immutable container image artifact
Deployment control
Pipeline and deployment orchestration
- CodePipeline · Coordinates source, build, and deploy stages
- AppSpec · Describes how CodeDeploy places files and runs hooks
appspec.yml - CodeDeploy · Rolls out the new image to the target host
Runtime host
EC2 target and container launch environment
- EC2 host · Runs the deployed containerized Flask service
- Bootstrap · Installs Docker, AWS CLI, and the CodeDeploy agent
userdatascript - Deploy scripts · Starts and stops the container during deployment
- Pull and run · Fetches the image and launches the Flask container
scripts/pull_and_run.sh - Cleanup · Stops old containers and clears prior state
scripts/cleanup.sh - Flask container · Containerized To-Do web application serving HTTP requests
Connections 16
- GitHub → CodePipeline: push trigger · Commit events start the delivery pipeline
- Flask app → Container spec: packaged by · Application code is assembled into the image
- Deps → Container spec: install deps · Dependencies are included in the container image
- CodePipeline → CodeBuild: build stage · Pipeline hands off to image build
- CodeBuild spec → CodeBuild: configures · Build instructions define the build actions
- CodeBuild → ECR: push image · Built image is published to the registry
- CodePipeline → CodeDeploy: deploy stage · Pipeline triggers host rollout after build
- AppSpec → CodeDeploy: configures · Deployment manifest defines rollout behavior
- CodeDeploy → EC2 host: roll out · Deployment updates the target instance
- Bootstrap → EC2 host: bootstrap · User data prepares the instance for deployment
- EC2 host → Deploy scripts: runs hooks · Deployment invokes lifecycle helper scripts
- Deploy scripts → Cleanup: pre-stop · Cleanup removes previous container state
- Deploy scripts → Pull and run: start · Pull and run script launches the new container
- Pull and run → ECR: pull image · Instance retrieves the immutable image version
- Pull and run → Flask container: launches · Container is started on the EC2 host
- Flask container → EC2 host: serves on · Runtime service executes on the compute host