Migrating Bold BI from EC2 Docker to ECS Fargate
Published:
Objective
To migrate the Bold BI application from a single-container Docker deployment in an EC2 instance to a scalable ECS Fargate-based architecture, ensuring data consistency and minimal downtime.
Step 1: Backup PostgreSQL Database
- Access the PostgreSQL container
- Take a database backup using:
docker exec postgres pg_dump -U postgres bold_services > bold_services_backup.sql
- Copy the backup file to a safe location
Step 2: Backup app_data Folder
- Locate the app_data directory inside the container or mounted volume
- Compress and back up:
tar -czvf app_data_backup.tar.gz app_data/
Migration to ECS Fargate:
Deploy Bold BI application in ECS fargate using the documentation below:
Document : Bold BI on ECS Fargate
Step 3: Create Application Load Balancer
- Create an Application Load Balancer
- Configure:
- Listener (HTTP/HTTPS)
- Security groups
- Subnets
Step 4: Create Target Group
- Create target group for ECS service
- Configure:
- Target type: IP
- Port: Application port (e.g., 80)
- Health check path
step 5: Create Task Definition:
- Use Bold BI Docker image
- Configure CPU & memory
- Add environment variables
- Configure port mappings
Example task definition:
{
"taskDefinitionArn": "<task-definition-ARN>", //provide the task definition ARN here
"containerDefinitions": [
{
"name": "boldbi",
"image": "syncfusion/boldbi",
"cpu": 0,
"portMappings": [
{
"name": "boldbi-80-tcp",
"containerPort": 80,
"hostPort": 80,
"protocol": "tcp",
"appProtocol": "http"
}
],
"essential": true,
"environment": [
{
"name": "BOLD_SERVICES_REVERSE_PROXY",
"value": "true"
},
{
"name": "APP_BASE_URL",
"value": "<app_url> " //provide app base url here
}
],
"mountPoints": [
{
"sourceVolume": "BoldBI-volume",
"containerPath": "/application/app_data",
"readOnly": false
},
{
"sourceVolume": "BoldBI-volume-nginx",
"containerPath": "/etc/nginx/sites-available",
"readOnly": false
}
],
"volumesFrom": [],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/BoldBI",
"awslogs-create-group": "true",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
},
"systemControls": []
}
],
"family": "BoldBI",
"taskRoleArn": "arn:aws:iam::<arn-role> ", //provide arn role here
"executionRoleArn": "arn:aws:iam::<executionRoleArn>", //provide ecs task execustion role
"networkMode": "awsvpc",
"revision": 89,
"volumes": [
{
"name": "BoldBI-volume",
"efsVolumeConfiguration": {
"fileSystemId": "<filesystem-id>",
"rootDirectory": "/"
}
},
{
"name": "BoldBI-volume-nginx",
"efsVolumeConfiguration": {
"fileSystemId": "<filesystem-id>",
"rootDirectory": "/nginx"
}
}
],
"status": "ACTIVE",
"requiresAttributes": [
{
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
},
{
"name": "ecs.capability.execution-role-awslogs"
},
{
"name": "ecs.capability.efsAuth"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
},
{
"name": "ecs.capability.efs"
},
{
"name": "com.amazonaws.ecs.capability.task-iam-role"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.25"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
},
{
"name": "ecs.capability.task-eni"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
}
],
"placementConstraints": [],
"compatibilities": [
"EC2",
"MANAGED_INSTANCES",
"FARGATE"
],
"requiresCompatibilities": [
"FARGATE"
],
"cpu": "4096",
"memory": "8192",
"runtimePlatform": {
"cpuArchitecture": "X86_64",
"operatingSystemFamily": "LINUX"
},
"registeredAt": "2026-03-18T08:12:08.046Z",
"registeredBy": "<arn-id> ",
"tags": []
}
Create ECS Service:
- Set desired task
- Choose the launch type as Fargate
- Enable turn-on ECS Exec option for bash the task later
- Attach the load balancer
- Attach target group
Step 6: Mount app_data and nginx folder using EFS
Note: Mount the app_data and nginx folder in the separate VM using below Documentation:
Documentation: How to Mount a Persistent Volume for App Data in Amazon AWS ECS Service
Step 7: Restore Data
- Once ECS service went to running and completed state please do below steps for restore the app_data and db data
8.1 Replace app_data
- Copy backed-up app_data into EFS mount location
8.2 Restore Database to RDS
- Create new DB in Amazon RDS
- Restore DB:
psql -h <rds-endpoint> -U <username> -d <database_name> -f boldbi_backup.sql
Step 8: Execute Commands Inside ECS Task
- Access running ECS container (via exec/bash):
aws ecs execute-command \
--cluster <cluster-name> \
--task <task-id> \
--container <container-name> \
--interactive \
--command "/bin/bash"
Note: For bash the task you should allow the AmazonSSMManagedInstanceCore in your task role
Step 9: Run Bold BI DB Utility to change the connection string in db
- Inside the container, run required Bold BI DB migration/upgrade utility for update the new db details in new migrated site
- Documentation : Reset application database
Step 10: Restart ECS Service
- Restart ECS tasks/service to apply all configurations:
Step 11: Access Application
• Map domain to ALB
• Access Bold BI using domain URL