Create Backend CodeBuild

Create Backend CodeBuild

  • Access AWS Console and search for CodeBuild in the menu
  • Select Build project
  • Click Create project
  • Enter Project name: aws-fcj-container-be

create-project

Configure Source:

  • Select GitHub as Source provider
  • Choose Personal access
  • Select Personal access token
  • For Connection, choose the secret created earlier
  • Select Repository in my GitHub account
  • Paste the HTTPS URL into GitHub repository field (URL copied from step 6.2)
  • Source version: refs/tags/*

source-config

In the Primary source webhook events section:

  • Webhook: Select Rebuild every time a code change is pushed to the repository
  • Choose Single build
  • Event type: PUSH
  • Enter HEAD_REF: HEAD_REF
  • Enter Pattern: ^refs/tags/

webhook-config

Configure environment:

  • Provisioning model: On-demand
  • Environment image: Managed image
  • Compute: EC2
  • Operating system: Ubuntu
  • Runtime: Standard
  • Image: aws/codebuild/standard:7.0
  • Image version: Always use latest image for version
  • Service role: New service role
  • Role name: codebuild-aws-fcj-container-be-service-role

environment

Expand Additional configuration

additional-config

  • Click Add environment variable
  • Add environment variables according to the table:

env-variables

  • Click Create build project to complete

create-complete

Add role for BE CodeBuild

After creating the build project:

  • Access the newly created build project

access-project

  • In the Service role section, click on the role to navigate to IAM management

service-role

Add permissions to the role:

  • Select Add permissions
  • Choose Attach policy
  • Search and select these policies:
    • AmazonECS_FullAccess
    • CloudWatchLogsFullAccess
    • WriteECRRepositoryContent
  • Click Attach policies

attach-policies