- Newest
- Most votes
- Most comments
I realized that the container was runnign, however the logs were not being send to cloudwatch as a default. I had to add the logging option in add_container to send the logs to cloudwatch.
At the risk of not strictly answering the question, given that I don't like CDK too much and prefer Troposphere. In case the problem comes from the way you defined the ECS Service/Task definitions, see if you can get somewhere with AWS Copilot / ECS Compose-X. Also I would highly recommend you improve your Dockerfile for security reasons not to use the root user etc.
Essential container in task exited
will have a return code if the container started at all (different than 0) and failed.
Now, if you intend to run the task once (and exit 0 is expected) you probably don't want to use a ECS service but create a scheduled task (will start the containers based on triggers (time, events etc.) which is not expected to stay alive all the time the same way a service is. Now note that, for future work, if you have only 1 container in the task definition, that container is "essential" which means it's got to be up and running / healthy. If you have more than 1 container in the task definition, some can be expected to run and exit (SUCCESS expects return 0, otherwise any return code will do), others to be healthy, and some others just to be RUNNING.
Relevant content
- Accepted Answerasked 4 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 3 years ago
HI John, Thanks for the feedback.
My plan is to use the ecs run task as part of step function. So when Lambda is processing some data and it needs to do a data pull, it will call the RunTask of this container.
Ideally I would wanted to have the Lambda in step function do it all, however the time limits are causing the lambda to die before the complete file is downloaded and pushed to S3. This will be a regular exercise, however the lambda upfront is required as the job will need to Enqueue a request, and keep checking for file status before the ecs/container can go and start downloading the file.