Bad edit to sudoers file on EC2 instance, how to fix it?
How about user-data ?

I believe adding the "#cloud-boothook" allow to force the user-data to run at every restart.

#cloud-boothook
#!/bin/bash
echo 'test' &gt; /home/ec2-user/user-script-output.txt


If so, you could fix your sudo scripts hopefully... or install / add AWS run commands configuration https://aws.amazon.com/blogs/aws/new-ec2-run-command-remote-instance-management-at-scale/

For sure if it is an EBS Drive, you can detach &amp; fix and then re-attach on the original system. A bit of a pain though.