title: How can I run an AWS ECS Task and then run a Lambda function after its ready then finally stop the Task?
body: <p>I am new to AWS. I have a Lambda function which I want to run daily at 4:00 AM GMT. The Lambda function is dependent on an AWS ECS Container task to be running. Instead of running the AWS ECS Container task to run always (because it costs a lot for me), I want to be able to trigger to run it and then run the Lambda task when its ready and finally when the Lambda function is finished, I want to stop it.</p>
  <p>I looked into this and found that I can run a Lambda function using Amazon EventBridge Rules. I know I can use the CRON expression, <code>0 4 * * ? *</code>, to run it at 4:00 AM everyday. However, I am not sure how to first run the ECS Container task first and also how to stop the task when the Lambda function finishes.</p>
  <p>Other info:</p>
  <p>The Lambda function has the Node.js environment.</p>