In this section, you will configure an AWS CodeBuild project for the backend API service (aws-fcaj-container-be). Parallel to the frontend pipeline, this build project monitors tag-push webhook events from your GitHub repository (^refs/tags/), executes container build instructions defined in backend/buildspec.yml inside an Ubuntu container runtime (aws/codebuild/standard:8.0), pushes the container image to Amazon ECR, registers an updated task definition, and triggers a rolling service deployment on Amazon ECS. Finally, you will grant the required IAM permissions to the backend CodeBuild service role.
Log in to the AWS Management Console.
In the top search bar, enter CodeBuild.
Under the Services category, click CodeBuild.

In the left navigation menu, expand Build and select Build projects.
In the top-right corner of the Build projects dashboard, click the orange Create project button.

In the Project configuration panel, configure the general project settings:
aws-fcaj-container-be
Scroll down to the Source section and configure the primary source repository:
https://github.com/<your-username>/aws-fcaj-container-app-codebuild.git
Configure webhooks so that AWS CodeBuild automatically initiates the backend build only when a release tag is pushed to GitHub.
In the Primary source webhook events section, configure the trigger parameters:
Under Webhook event filter groups, configure Filter group 1:
^refs/tags/
Both the frontend and backend CodeBuild projects listen to the identical tag pattern ^refs/tags/. When you publish a release tag (such as v1.0.2), GitHub will trigger webhook notifications that launch both frontend and backend build jobs concurrently.
Specify the managed container runtime image and service role used to execute backend container packaging and deployment routines.
In the Environment section, configure the environment settings:
aws/codebuild/standard:8.0.aws-fcaj-container-be-service-role).
CodeBuild injects these parameters as environment variables into the build container runtime, allowing the deployment scripts to authenticate with AWS and locate target infrastructure resources.
| Name | Value | Type | Description |
|---|---|---|---|
CLUSTER_NAME | FCAJ-Lab-cluster | Plaintext | Target Amazon ECS cluster name |
SERVICE_NAME_FE | app-frontend | Plaintext | Amazon ECS frontend service name |
SERVICE_NAME_BE | app-backend | Plaintext | Amazon ECS backend service name |
AWS_REGION | us-east-1 | Plaintext | Target AWS Region where lab infrastructure is hosted |
AWS_ACCOUNT_NUMBER | <your-aws-account-id> | Plaintext | 12-digit AWS account ID without hyphens |
AWS_ACCESS_KEY_ID | <your-aws-access-key-id> | Plaintext | IAM programmatic access key ID |
AWS_SECRET_ACCESS_KEY | <your-aws-secret-access-key> | Plaintext | IAM programmatic secret access key |
CI_PROJECT_BE_NAME | aws-fcaj-container-app-backend | Plaintext | Amazon ECR backend repository name |
CI_PROJECT_FE_NAME | aws-fcaj-container-app-frontend | Plaintext | Amazon ECR frontend repository name |
TASK_NAME_FE | FCAJResbar-task-fe | Plaintext | Amazon ECS frontend task definition family name |
TASK_NAME_BE | FCAJResbar-task-be | Plaintext | Amazon ECS backend task definition family name |

These environment variables match the configuration used in the frontend build project. You can copy the values directly from your previous frontend project configuration or your local notes.
Scroll down to the Buildspec section:
backend/buildspec.yml.In the Artifacts section:

Scroll to the Logs section:
codebuild/aws-fcaj-container-be.At the bottom of the page, click the orange Create build project button.

To permit the backend build container to authenticate with Amazon ECR, register updated Amazon ECS task definitions, and initiate rolling service updates, attach the necessary IAM permissions to the generated service role.
In the AWS Management Console top search bar, search for IAM and open the IAM service dashboard.
In the left navigation pane under Access Management, click Roles.
In the search box, enter codebuild-aws-fcaj-container-be-service-role
In the search results table, click the role name codebuild-aws-fcaj-container-be-service-role.

On the role summary page, select the Permissions tab.
Click the Add permissions dropdown button and select Attach policies.

In the policy search field, search for and select the checkboxes for the following policies:
AmazonECS_FullAccess (AWS managed policy)CloudWatchLogsFullAccess (AWS managed policy)WriteECRRepositoryContent (Customer managed policy created in previous lab modules)Click Add permissions.
A confirmation alert banner appears: “Policies have been successfully attached to role.”
