2 Answers
- Newest
- Most votes
- Most comments
1
Check the log output in "/var/log/cloud-init-output.log".
See if there are any errors or other problems.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
Also, by default, InitFile is run as the root user, so errors around permissions are unlikely to occur.
1
Thanks for the extra insight. I have it working with bash but I'll try userdata and take a look at the link when I get another chance.
answered a year ago
Relevant content
- asked 9 months ago
- asked 10 months ago
- asked 4 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago
There were no errors in /var/log/cloud-init-output.log. In fact, when I look at /etc/resolv.config, the changes have been made, but, and the bit I forgot to mention is, the error message "Failed to receive 1 resource signal(s) within the specified duration". Is it possible that certain linux commands don't work well with init-signal in certain situations?
This document describes how to troubleshoot that error when it appears. https://repost.aws/knowledge-center/cloudformation-failed-signal Basically, we recognize that Linux commands can be executed with cloud-init.
ec2.InitCommand.shellCommand('rm -f /etc/securetty'),
=> file is removed and signal returned to cfn/cdkec2.InitCommand.shellCommand('rm -f /etc/resolv.conf')
=> file is removed and no signal returned to cdk/cfn. As a result, "The following resource(s) failed to create: [myclientami5D1A95132]" was assumed, even though it was up and running before the rollback. Not sure if the troubleshooting doc can help anymoreAre there any errors in logs such as "/var/log/cloud-init.log" and "/var/log/cfn-init.log"?
more /var/log/cloud-init.log | grep resolv
Apr 30 16:06:28 cloud-init[2518]: stages.py[INFO]: Skipping modules ['resolv-conf'] because they are not verified on distro 'amazon'. To run anyway, add them to 'unverified_modules' in config. Apr 30 16:06:28 cloud-init[2518]: stages.py[DEBUG]: Running module resolv-conf (<module 'cloudinit.config.cc_resolv_conf' from '/usr/lib/python2.7/dist-packages/cloudinit/config/cc_resolv_conf.pyc'>) with frequency once-per-instance Apr 30 16:06:28 cloud-init[2518]: util.py[DEBUG]: Writing to /var/lib/cloud/instances/i-0d74593409a869245/sem/config_resolv_conf - wb: [644] 20 bytes Apr 30 16:06:28 cloud-init[2518]: helpers.py[DEBUG]: Running config-resolv-conf using lock (<FileLock using file '/var/lib/cloud/instances/i-0d74593409a869245/sem/config_resolv_conf'>) Apr 30 16:06:28 cloud-init[2518]: cc_resolv_conf.py[DEBUG]: Skipping module named resolv-conf, no 'manage_resolv_conf' key in configuration