0

I'm transitioning one of my AWS Elastic Beanstalk applications over to Docker using Elastic Beanstalk's Multi-container Docker configuration. I've created a new EB Application with a new environment. When I attempt to deploy my Dockerrun.aws.json config, EB eventually fails with the following error in the events tab:

Service:AmazonECS, Code:ClientException, Message:Invalid setting for 
container 'api'. At least one of 'memory' or 'memoryReservation' must 
be specified., Class:com.amazonaws.services.ecs.model.ClientException

My Dockerrun.aws.json config is roughly as follows:

{
    "AWSEBDockerrunVersion": 2,
    "containerDefinitions": [
        {
            "name": "api_proxy",
            "image": "{account_id}.dkr.ecr.us-east-1.amazonaws.com/{repo}:latest",
            "essential": true,
            "memory": 128,
            "portMappings": [
                {
                    "hostPort": 80,
                    "containerPort": 80
                }
            ],
            "links": [
                "api"
            ]
        },
        {
            "name": "api",
            "image": "{account_id}.dkr.ecr.us-east-1.amazonaws.com/{repo}:latest",
            "environment": {
                "DJANGO_SETTINGS_MODULE": "api.aws"
            },
            "essential": true,
            "memory": 128
        }
    ]
}

Any help would definitely be appreciated.

Update 2018-02-15:

My current deployment process is as follows. I first create the Docker images and upload them to Amazon's ECR. I then zip the Dockerrun.aws.json file. Since this is the first deployment of the app in a new AWS EB environment, I'm currently uploading the zip file in the environment creation process. The platform I'm choosing is Preconfigured platform: Multi-container Docker. For Application Code, I upload my zipfile containing the Dockerrun.aws.json file.

  • How do you deploy the app? – ALex_hha Feb 15 '18 at 19:35
  • Just added a section on some basics of how I'm currently deploying the app. – basicdays Feb 15 '18 at 20:06
  • What version of platform are you using? – ALex_hha Feb 16 '18 at 11:56
  • The platform is "Multi-container Docker 17.09.1-ce (Generic)" – basicdays Feb 16 '18 at 23:41
1

As far as I can see from off doc - environment option should be object array, so your json should looks like

{
    "AWSEBDockerrunVersion": 2,
    "containerDefinitions": [{
        "name": "api",
        "image": "nginx:latest",
        "essential": true,
        "memory": 128,
        "environment": [{
            "name": "DJANGO_SETTINGS_MODULE",
            "value": "api.aws"
        }]
    },{
        "name": "api_proxy",
        "image": "nginx:latest",
        "essential": true,
        "memory": 128,
        "links": ["api"],
        "portMappings": [{
            "hostPort": 80,
            "containerPort": 80
        }]
    }]
}

At least I was able to run environment with the json above

  • Oh my... Yes that was all it was, the environment section wasn't written correctly. The memory config was after environment which caused the red herring error message. – basicdays Feb 20 '18 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.