title: Schedule to start an EC2 instance and run a python script within it
body: <p>I am trying to schedule my python script in AWS, however I don't want the instances to be running all the time. So, trying to automate the process of:</p>
  
  <ol>
  <li>Start the EC2 instance on a specific time</li>
  <li>Run the python script within it</li>
  <li>Stop the EC2 instance once the job is completed.</li>
  </ol>
  
  <p>I cannot run this script directly as a Lambda function because the script does some parallel processing which requires more RAM, so choosing a bigger AWS instance rather than writing it as a lambda function. Also, don't want this instance to be running all the time as it is expensive. </p>
  
  <p>So far, I followed <a href="https://matoski.com/article/aws-automatic-start-stop-instances-lambda/" rel="noreferrer">Automatic starting and stopping of AWS EC2 instances with Lambda and CloudWatch · matoski.com</a> and created a Lambda function to start and stop the instance at specific time, however I couldn't find a way to run the python script once the instance is started.</p>
  
  <p>Can anyone point me in the right direction?</p>