Tạo Task Definition

Tạo Task Definition

  1. Thực hiện tạo Task Definition cho like service sử dụng image đã push lên ECR.
  • Trong giao diện ECS, chọn Task definitions
  • Chọn Create new task definition

 Microservices with AWS Fargate

  1. Tiến hành cấu hình Task definition
  • Đặt Task definition family, nhập Microservice-Definition-STACK_NAME

 Microservices with AWS Fargate

  1. Chúng ta sử dụng image đã push lên ECR trong repository STACK_NAME-like-XXX
  • Like service code được thiết kế gọi endpoint trên monolith để duy trì dữ liệu với DynamoDB. Tham chiếu giá trị của môi trường MONOLITH_URL. Chúng ta sẽ tạo môi trường với Key là MONOLITH_URL và Value là ALB(cụ thể là alb-STACK_NAME-XXX)
  • Chọn Next

 Microservices with AWS Fargate

  1. Thực hiện cấu hình môi trường
  • Chúng ta sử dụng AWS Fargate
  • Operating system là Linux
  • Bạn có thể tùy chỉnh Task size
  • Chọn Task role, chọn STACK_NAME-EcsServiceRole-XXX

 Microservices with AWS Fargate

  1. Sử dụng Amazon CloudWatch

 Microservices with AWS Fargate

  1. Kiểm tra lại và chọn Create

 Microservices with AWS Fargate

  1. Như vậy, chúng ta đã tạo thành công một Task definition Microservice-Definition-STACK_NAME

 Microservices with AWS Fargate