How to check whether my user data passing to EC2 instance working or not?

后端 未结 5 1987
再見小時候
再見小時候 2021-01-31 14:23

While creating new AWS EC2 instance using EC2 command line API, i am passing some user data to new instance.

Now how i came to know whether that user data executed or no

5条回答
  •  独厮守ぢ
    2021-01-31 14:34

    Debugging user data scripts on Amazon EC2 is a bit awkward indeed, as there is usually no way to actively hook into the process, so one ideally would like to gain Real time access to user-data script output as summarized in Eric Hammond's article Logging user-data Script Output on EC2 Instances:

    The recent Ubuntu AMIs still send user-data script to the console output, so you can view it remotely, but it is no longer available in syslog on the instance. The console output is only updated a few minutes after the instance boots, reboots, or terminates, which forces you to wait to see the output of the user-data script as well as not capturing output that might come out after the snapshot.

    Depending on your setup you might want to ship the logs to a remote logging facility like Loggly right away, but getting this installed early enough can obviously be kind of a chicken/egg problem (though it works great if the AMI happens to be configured like so already).

提交回复
热议问题