bot
bot

Reputation: 1423

Getting "RESOURCE:MEMORY" error on a new cluster in AWS-ECS

I have set up a band new cluster using ecs-cli on AWS with following commands:

Configure cluster : ecs-cli configure --cluster cluster_name --region region_name --default-launch-type EC2 --config-name config_name

Use default profile : ecs-cli configure default --config-name config_name

Create Cluster : ecs-cli up --keypair key_name --capability-iam --size 1 --instance-type t2.micro --security-group sg_id --vpc vpc_id --subnets subnet_id --cluster-config config_name

The cluster was created successfully on ECS. But when I am trying to run my docker-compose file to run jenkins and jenkins data volume containers (already pushed to ECR) I am getting "RESOURCE:MEMORY" error even though the CPU and memory utilisation is 0%.

Deploy docker compose file to cluster : ecs-cli compose up --cluster-config config_id

Actual Result:

WARN[0000] Skipping unsupported YAML option for service... option name=networks service name=jenkins WARN[0000] Skipping unsupported YAML option for service... option name=networks service name=jenkins_dv INFO[0000] Using ECS task definition TaskDefinition="aws-infra:4" INFO[0000] Couldn't run containers reason="RESOURCE:MEMORY"

    jenkins:
      image: jenkins:latest
      cpu_shares: 50
      mem_limit: 524288000
      ports: ["8080:8080", "50000:50000"]
      volumes_from: ['jenkins_dv']
    jenkins_dv:
      image: jenkins_dv:latest
      cpu_shares: 50
      mem_limit: 524288000   

Even when I am running the docker compose file after deleting cpu_shares and mem_limits (as it is not required for EC2 instances), I am getting same error. Since the cluster is new and does not have any CPU or memory being utilised the tasks should be created successfully. What am I doing wrong here?

Upvotes: 2

Views: 5008

Answers (1)

bot
bot

Reputation: 1423

I have got the solution to this issue. I have allocated memory limit as 500MB (in bytes) to both the containers. As per AWS documentation tc.micro has 1GB memory but if you open your instance (Cluster> EC2 Instance > container instance) and view the memory allocation, the actual memory allocated is slightly less than 1GB. I updated my file and gave memory limit as 250MB (in bytes) to both the containers and it worked.

Upvotes: 5

Related Questions