aws / amazon-ecs-agent

Amazon Elastic Container Service Agent
http://aws.amazon.com/ecs/
Apache License 2.0
2.08k stars 610 forks source link

Way to disable per-container memory limit in task definition #155

Closed robbyt closed 8 years ago

robbyt commented 9 years ago

According to the docs1, the per-container memory limit is required. This is inconvenient, because I use the same ElasticBeanstalk Dockerrun.aws.json file with multiple instance types.

Is there a way to disable this setting?

tedder commented 8 years ago

Ha, and I missed the 'one or both' clause.

mpestritto commented 8 years ago

Yes - I am setting both. The only thing I changed was adding the memoryReservation to my config file. Unfortunately, the aws ecs register-task-definition call from command line fails with what is below. Any ideas if this is an aws api issue? aws-cli issue?

Curious to see if anyone was able to get it working from command line. As a side note -- works fine from aws web console.

Will gladly transfer this discussion to another thread.

"memory": 384, "memoryReservation": 128,

jenkins@:~/workspace/project-name$ aws ecs register-task-definition --family api-workflow-www-staging --cli-input-json file://project-name-v_189.json

Parameter validation failed:
Unknown parameter in containerDefinitions[0]: "memoryReservation", must be one of: name, image, cpu, memory, links, portMappings, essential, entryPoint, command, environment, mountPoints, volumesFrom, hostname, user, workingDirectory, disableNetworking, privileged, readonlyRootFilesystem, dnsServers, dnsSearchDomains, extraHosts, dockerSecurityOptions, dockerLabels, ulimits, logConfiguration
tedder commented 8 years ago

I bet you'll need to wait for the awscli to be updated. Typically the reference implementations (java, ruby, botocore/awscli/boto3) get updated within the same day of new features, others can take longer. Here's where to watch for a new version of awscli: https://aws.amazon.com/releasenotes/CLI

You can watch all of them here: https://aws.amazon.com/releasenotes

And I publish an RSS feed of it here: http://tedder.me/rss/aws-release-notes.xml

mpestritto commented 8 years ago

Great -- Thanks @tedder I'll look around. Appreciate it.

CameronGo commented 8 years ago

Wonder what version of the ECS agent has to be running.

samuelkarp commented 8 years ago

Hey all,

As you might have noticed, we've now launched the ability to set a soft memory limit as per my proposal. You can see the launch announcement here: https://aws.amazon.com/about-aws/whats-new/2016/08/amazon-ec2-container-service-now-supports-networking-modes-and-memory-reservation/.

To use the new memoryReservation field in your task definition, you must be running ECS agent version 1.5.0 or greater and Docker version 1.9.0 or greater.

You can set memoryReservation in the ECS console today. The AWS CLI and SDKs will be updated with the new field soon.

Please let us know if you have any further questions.

Thanks, Sam

tallavi commented 8 years ago

Still wondering if there's a way to use the new feature in a ecs-cli compose command. Anyone knows?

samuelkarp commented 8 years ago

@tallavi Can you open a separate issue for tracking this on the Amazon ECS CLI project?

tallavi commented 8 years ago

Done.

mpestritto commented 8 years ago

Following-up on exposing the parameter to aws ecs.... It was a boto issue. PR is up. https://github.com/boto/botocore/pull/1006

benjaminwai commented 8 years ago

Taking a stab on Elastic Beanstalk I tried the "memoryReservation" param in multi-containers' Dockerrun.aws.json and it is returning "Service:AmazonECS...: Invalid setting for container... At least one of 'memory' or 'memoryReservation' must be specified'. I guess eb is not yet passing "memoryReservation"? Looking forward to be able to use it in eb.

ssorathia commented 7 years ago

Any update on when this would be available for EB? I'm still seeing the following: Service:AmazonECS, Code:ClientException, Message:Invalid setting for container 'app1'. At least one of 'memory' or 'memoryReservation' must be specified., Class:com.amazonaws.services.ecs.model.ClientException

And here is my Dockerrun.aws.json file showing that it's configured: `"essential": true,

  "memoryReservation": 64,
  "logConfiguration": {

`

But still no luck. Considering this was in ECS quite some time ago, I'm wondering if something is broken with EB.

Anybody know?

vinayan3 commented 7 years ago

@ssorathia Please see this forum post https://forums.aws.amazon.com/message.jspa?messageID=747465#747465

ElasticBeanStalk is not broken but does not support the new parameter yet. As the AWS developer says they do not have a timeline to it being fixed.

I was really hoping for this feature to be accessible through ElasticBeanStalk because that's how I deploy things onto ECS these days.

ssorathia commented 7 years ago

@vinayan3 Thanks so much for that link! For some reason my search didn't yield that post! Thanks for helping me out, at least now I know I'm not crazy. I must have checked my spelling a dozen times! :)

danilobuerger commented 7 years ago

Sadly this is still missing from Cloudformation :-(

brewboy commented 7 years ago

+1

samuelkarp commented 7 years ago

@danilobuerger @brewboy The MemoryReservation field is available in the AWS::ECS::TaskDefinition type in CloudFormation.

yololftw commented 4 years ago

@samuelkarp Is this option exposed in aws batch?