whatsinthename
whatsinthename

Reputation: 2157

How to schedule a AWS CLI script on Windows EC2 instance

I have a Windows EC2 instance in place. I cannot delete it every day since we have multiple tools installed like accessing Postgress RDS via Dbeaver. Now, we have an activity of deleting a few S3 folders. So using the Mobaxterm tool, I can delete it via AWS CLI commands.

However, I am unable to schedule this script which runs once daily in the morning. I explored a few posts which are not relevant to my problem. There, the user is trying to launch > run script > delete instance which I don't want to do.

What can be done in my case?

Upvotes: 0

Views: 478

Answers (1)

Paolo
Paolo

Reputation: 26230

At least two options come to mind:

  1. Use Windows task scheduler to create a task that will run your script daily directly on the instance
  2. Use AWS Systems Manager State Manager to run a custom document that will execute your script remotely on a daily basis

I would recommend the second option because you would be able to reuse it for other instances if needed.

Upvotes: 1

Related Questions