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.
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, 0 4 * * ? *
, 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.
Other info:
The Lambda function has the Node.js environment.