How to reboot OS at Amazon AWS EC2 instance start

1

I am seeing device driver problems in EC2 instances that are stopped, and later started. A reboot always seems to fix them. Specifically this is with EC2 FPGA instances.

I need a way to force an OS reboot sudo reboot at instance start.

I tried this cloud-init thing, but it was not working.

WilderField

Posted 2019-06-02T20:21:57.300

Reputation: 11

Question was closed 2019-06-06T17:19:30.930

Answers

0

Using the below script as a user-data script worked, although I admit this is very hackish, and probably creates vulnerabilities.

#cloud-boothook
#!/bin/bash

FILE=/home/ubuntu/reboot.txt

if [ -f "$FILE" ]; then     
  rm -rf $FILE              
  reboot
else
  touch $FILE
fi

WilderField

Posted 2019-06-02T20:21:57.300

Reputation: 11