Search
Close this search box.

How to configure scheduling for script execution in AWS

In this tutorial we explain the steps necessary to use script execution via scheduler in Cloud8. 

EC2 Command:

  1. create an IAM Role with AmazonSSMFullAccess permission
  2. on the server where you want to run scripts, go to “Instance Settings -> Attach/Replace IAM Role” and associate the new IAM Role (mentioned in step 1) – Attention:  server must have internet access, but does not need to have a public IP
  3. install SSM-AGENT on Windows/Linux according to  http://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html
  4. test (Virginia): https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#Documents:Owner=MeOrAmazon;sort=Name – Suggestion:  use AWS-RunPowerShellScript (Windows) or AWS-RunShellScript (Linux) and run something harmless like ‘ipconfig’. Later, something more sophisticated can be used, such as copying files to S3: “aws cli s3 cp c:\home\* s://bucket/…”AWS documentation on remote commands:
    http://docs.aws .amazon.com/AWSEC2/latest/UserGuide/execute-remote-commands.html
  5. test scheduling on Cloud8: “Run Scripts” – you can pass AWS-RunPowerShellScript (Windows) or AWS-RunShellScript (Linux) and the parameters tested in step 4

 Open the action schedule and select the server(s) where you will run the script(s):

Then enter the command type option to be used,  “AWS-RunPowerShellScript” or “AWS-RunShellScript” . In the example we are scheduling the execution on a Linux server, so we will use “AWS-RunShellScript”:

Then click on the “Params” button and enter the command to be executed:

Okay, now just save the schedule and choose the recurrence (if applicable).