injecting "ECS_IMAGE_PULL_BEHAVIOR=prefer-cached" into /etc/ecs/ecs.config

1

Hello,
I have a working managed ComputeEnvironment and I would like to add "ECS_IMAGE_PULL_BEHAVIOR=prefer-cached" into /etc/ecs/ecs.config in order to assure
that the container is not reloaded from ECR for each job submit.

I have tried with the following LaunchTemplate which is defined among other Resources
in my cloudFormation file:

"mwmLaunchTemplate": {
"Type" : "AWS::EC2::LaunchTemplate",
"Properties" : {
"LaunchTemplateData" : {
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="\n",
"MIME-Version: 1.0\n",
"\n",
"--==MYBOUNDARY==\n",
"Content-Type: text/x-shellscript; charset="us-ascii"\n",
"MIME-Version: 1.0\n",
"Content-Transfer-Encoding: 7bit\n",
"\n",
"#!/bin/bash\n",
"echo "ECS_IMAGE_PULL_BEHAVIOR=prefer-cached" >> /etc/ecs/ecs.config\n",
"\n",
"--==MYBOUNDARY==--"
]]}}
}
}
}

The stack creation fails (rolling back without any message) if I am using mwmLaunchTemplate inside of my ComputeEnvironment:

"mwmComputeEnvironment": {
"Type": "AWS::Batch::ComputeEnvironment",
"Properties": {
"Type": "MANAGED",
...
...
"launchTemplate": {
"LaunchTemplateId" : {"Ref": "mwmLaunchTemplate"}
},
}
....
}

mwmComputeEnvironment works well without the three lines:
"launchTemplate": {
"LaunchTemplateId" : {"Ref": "mwmLaunchTemplate"}
},

Thanks for your attention
Walter Steffe

steffew
gefragt vor 5 Jahren759 Aufrufe
1 Antwort
0

Hello, something changed in AWS batch since my previous post.

Today I retried to create my stack with the LaunchTemplate inside of the AWS::Batch::ComputeEnvironment. This time I got an error message referring to the raw:
"launchTemplate": {"LaunchTemplateId" : {"Ref": "mwmLaunchTemplate"}},

So I understood that there was a case error: I should have written "LaunchTemplate": (with initial uppercase).

In the meantime I have also corrected the LaunchTemplate definition which now is:
"mwmLaunchTemplate": {
"Type" : "AWS::EC2::LaunchTemplate",
"Properties" : {
"LaunchTemplateData" : {
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"MIME-Version: 1.0\n",
"Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="\n",
"\n",
"--==MYBOUNDARY==\n",
"Content-Type: text/x-shellscript; charset="us-ascii"\n",
"\n",
"#!/bin/bash\n",
"echo ECS_IMAGE_PULL_BEHAVIOR=prefer-cached >> /etc/ecs/ecs.config\n",
"\n",
"--==MYBOUNDARY==--"
]]}}
}
}
},

After that the creation of my Batch Environment went well without any error.

Regars
Walter Steffè

steffew
beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen