1. Navigate to Amazon Elastic Container Service (ECS) in the AWS Console.
2. In the left navigation pane, select Task definitions, then click Create new task definition.
3. Configure the basic settings:
fcj-core-fargate-td
4. Set the resource allocation:
5. For Task execution role, select fcjEcsTaskExecutionRole.
6. Open a new browser tab and navigate to Amazon ECR. Locate your fcj-registry repository and copy the core image URI.
7. Return to the Create new task definition tab. In the Container details section, configure:
core
8. Configure the container networking:
8080
core-http
9. Review your configuration and click Create to finalize the task definition.
1. Open a new browser tab and navigate to the AWS Secrets Manager console. Locate your secret and copy its ARN.
2. Return to the ECS console. Navigate to Task definitions, select fcj-core-fargate-td, then click Create new revision with JSON.
3. In the JSON editor, locate the containerDefinitions array. Find the container definition with “name”: “core” and add the following secrets block:
Important: Replace <secret-arn>
with the ARN you copied in step 1.
"secrets": [
{
"name": "SPRING_DATASOURCE_URL",
"valueFrom": "<secret-arn>:DB_CONNECTION_STRING::"
}
]
4. Your complete containerDefinitions should look like this:
"containerDefinitions": [
{
"name": "core",
"image": "058264371769.dkr.ecr.ap-southeast-1.amazonaws.com/fcj-registry:core",
"cpu": 0,
"portMappings": [
{
"name": "core-http",
"containerPort": 8080,
"hostPort": 8080,
"protocol": "tcp",
"appProtocol": "http"
}
],
"essential": true,
"environment": [],
"mountPoints": [],
"volumesFrom": [],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/fcj-core-fargate-td",
"mode": "non-blocking",
"awslogs-create-group": "true",
"max-buffer-size": "25m",
"awslogs-region": "ap-southeast-1",
"awslogs-stream-prefix": "ecs"
}
},
"systemControls": [],
"secrets": [
{
"name": "SPRING_DATASOURCE_URL",
"valueFrom": "arn:aws:secretsmanager:ap-southeast-1:0123456789:secret:dev/fcj/momentum-75swok:DB_CONNECTION_STRING::"
}
]
}
]
5. Click Create to save the new revision.
6. Verify that the latest revision is now 2.
1. Navigate to your ECS cluster, scroll down to Services, and click Create.
2. Configure the task definition:
3. For Service name, enter fcj-core-svc
.
4. Configure compute options:
5. For Desired tasks, enter 1
.
6. Scroll to Networking and expand the section.
7. Configure networking:
8. Configure security group:
9. Disable Public IP assignment.
10. Configure load balancing:
11. Select Use an existing load balancer and choose fcj-alb.
12. Configure listener: - Listener: Select Use an existing listener - Select HTTP:80
13. Configure target group: - Target group: Select Use an existing target group - Select fcj-core-tg
14. Review your configuration and click Create to launch the service.
15. Wait for the task status to change to Running.
16. Navigate to your Application Load Balancer (ALB), copy the DNS name, and paste it into a new browser tab.
17. You should see the application login page. Use admin
for both Username and Password to log in.