title: How to debug failed fargate task initialization
body: <p>I have a fargate task which I have scheduled to run with CloudWatch Event rules, and output a timestamp to a database on a successful run. It also outputs a logfile to CloudWatch for every time it runs.</p>
  
  <p>However, there was 1 time where the log file was not created, and the database not updated. I suspect the task was never even started, or had failed to start.</p>
  
  <p>In CloudWatch, the event rule shows trigger and invocation at the time I expected the task to run, so I assume the task at least attempted to start.</p>
  
  <p>My question is: is there any way I can debug or log information about the cluster failing to start a task?</p>
  
  <p>Please let me know if I need to provide more information.</p>
  
  <p>Edit: I should specify I'm looking for a way to read this information in a log file somewhere. I know I can see failed task reason in the web console, but that's only for relatively recent tasks.</p>
  
  <p>I have posted the same question here: <a href="https://www.reddit.com/r/aws/comments/adtqvt/debugging_failed_fargate_task_initialization/" rel="noreferrer">https://www.reddit.com/r/aws/comments/adtqvt/debugging_failed_fargate_task_initialization/</a> and StackOverflow: <a href="https://forums.aws.amazon.com/thread.jspa?messageID=884638&amp;#884638" rel="noreferrer">https://forums.aws.amazon.com/thread.jspa?messageID=884638&amp;#884638</a></p>