π Building an End-to-End Real-Time Project on AWS with AWS Pipeline β±οΈποΈπ
π Scenario
π The scenario involves product development with an Agile SDLC in motion.
πA team of developers will regularly make code changes, resulting in multiple code changes every day.
πThis code needs to be tested, as it is what builds the product.
πRegular code changes, also called commits or pull requests, occur.
πTo solve this problem, there should be regular builds and tests for every commit.
ποΈ Architecture: Designing the System with AWS

STEPS FOR THE ABOVE FLOW
Setup all necessary tools from the Repo:

https://github.com/vishu11223344/aws-devops-zero-to-hero
STEP 2: Go to AWS and in AWS go to CodeBuild
click on Create a Build project

In the source provider select GitHub then click on connect using OAuth and click on connect to GitHub
After that paste your repository URL

Then we have to move to the Environment section and select as shown here

Then we have to go to Buildspec.
we have to select inserts to build commands and click on the switch to the editor

version: 0.2
env:
parameter-store:
DOCKER_REGISTRY_USERNAME: /myapp/docker/username
DOCKER_REGISTRY_PASSWORD: /myapp/docker/password
DOCKER_REGISTRY_URL: /myapp/docker/url
phases:
install:
#If you use the Ubuntu standard image 2.0 or later, you must specify runtime-versions.
#If you specify runtime-versions and use an image other than Ubuntu standard image 2.0, the build fails.
runtime-versions:
python: 3.11
pre_build:
commands:
- pip install -r day-14/simple-python-app/requirements.txt
build:
commands:
- cd day-14/simple-python-app
- echo "Building Docker Images"
- echo "$DOCKER_REGISTRY_PASSWORD" | docker login -u "$DOCKER_REGISTRY_USERNAME" --password-stdin "$DOCKER_REGISTRY_URL"
- docker build -t "$DOCKER_REGISTRY_URL/$DOCKER_REGISTRY_USERNAME/simple-python-flask-app:latest" .
- docker push "$DOCKER_REGISTRY_URL/$DOCKER_REGISTRY_USERNAME/simple-python-flask-app:latest"
post_build:
commands:
- echo "Build completed successfully!"
Then click on Create a Build project
After that click on Start Build

when we click on start build we will get an error.

Then we have to go to search and search for IAM and click enter
Then on the left side select Roles and search for the roles that you have created while creating the project codebuild-p-service-role

click on codebuild-p-service-role and add permission
select AmazonSSMFullAccess and click on Add permission

After that again try to rebuild it. You will see one more error that is we have to create the parameter for the user id, password, and URL for the docker

For this click on systems manager and select parameters manager and click on Create parameter

In the name you have to fill the that you have written on the Build commands.
After that select Type as SecureString
In value, you have to write the username and click on Create a parameter

After that, you have filled in all three values

you have to rebuild your project

After it got successful you can check in Docker also

After that you have to search for code Pipeline can click on Create button

After you click on next you have to select the source provider as GitHub(versio1)
provide your repository and branch and click next

Add the build stage as shown

skip the deploy stage as we are not deploying it

click on build it will be successfully built and it will show as the below images.

If you made any changes in the repository it will automatically trigger the pipeline you can try it.
