I am learning and exploring AWS ECS service by creating cluster, service and task definition (ECS EC2 launch type). And pulling docker image from AWS ECR. Both cluster and task definitions are getting creating successfully. But while creating service, its holding "Create In Progress" state long time and showing Create Failled. And when scrolling down , it also lists Rollback also.
My Docker file looks like the following for helloworld angular application,
FROM node:latest as build
WORKDIR /app
RUN npm install -g @angular/cli
COPY ./package.json .
RUN npm install
COPY . .
RUN ng build --configuration production
FROM nginx as runtime
COPY --from=build /app/dist/helloworld/ /usr/share/nginx/html
EXPOSE 80
Steps Done For My Task
Cluster Creation
1.1 Created cluster with support of Ec2 Launch type 1.2 Choosing Amazon Linux 2 instance 1.3 Choosed t2.micro instance type
Task Definition
2.1 Choosed Ec2 launch type 2.2 Choosed Linux/x86_64 2.3 .5 vCpu and 1 Gb Memory 2.4 Choosed my ECR URL for image and mapped to port 80 2.5 Networ mode awsvpc
Service creation
3.1 Choosed Ec2 Launch type 3.2 Application type service. 3.3 Choosed family with created task defintion. 3.4 Service type replica 3.4 Choosed Desired no of task 1
NB -:It is working sucessfully in ECS Fargate method (By choosing Fargate option in Task definition and Fargate option in service)
Problem is When I am defining task defintion ec2 launch type and service also Ec2 launch type. If I am choosing Ec2 type in both places , it showing created failled error. When I am checking CloudWatch Logs its not giving any log.
Trouble shooted way,
Can anyone suggest any troubleshooting method or kindly give any guidance to resolve please?
Updated Error
Error occurred during operation 'ECS Deployment Circuit Breaker was triggered error in aws ecs
You can't use t2.micro
for an ECS task that requires "1 Gb Memory". t2.micro
is too small for that as it has only 1 Gb of RAM. OS and other processes that run on the instance take large chunk of the 1 Gb available, leaving not enough for the task.