Create Task Definition

Create Task Definition

  1. Create a Task Definition for the like service using the image pushed to ECR.
  • In the ECS interface, select Task definitions
  • Select Create new task definition

 Microservices with AWS Fargate

  1. Proceed to configure the Task definition
  • For Task definition family, enter Microservice-Definition-STACK_NAME

 Microservices with AWS Fargate

  1. Configure the environment
  • We use AWS Fargate
  • Operating system is Linux
  • You can customize the Task size
  • Select Task role, choose STACK_NAME-EcsTaskRole-XXX
  • Select Task execution role, choose STACK_NAME-EcsServiceRole-XXX

 Microservices with AWS Fargate

  1. We use the image pushed to ECR in the repository STACK_NAME-like-XXX
  • The like service code is designed to call an endpoint on the monolith to persist data with DynamoDB. It references the value of the environment variable MONOLITH_URL. We will create an environment variable with the Key as MONOLITH_URL and Value as the ALB (specifically alb-STACK_NAME-XXX)

 Microservices with AWS Fargate  Microservices with AWS Fargate

  1. Find the log group name of the lab in the CloudFormation stack, copy the physical ID and paste it into the value of the awslogs-group key

 Microservices with AWS Fargate  Microservices with AWS Fargate

  1. Review and select Create

 Microservices with AWS Fargate

  1. Thus, we have successfully created a Task definition Microservice-Definition-STACK_NAME

 Microservices with AWS Fargate