是否可以通过 AWSCLI(用户数据)运行 python 脚本。我尝试过,但它没有运行,我的日志中有以下内容
boot.log:2015-08-07 10:08:30,660 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: './step-1
cloud-init.log:2015-08-07 10:08:30,660 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: './step-1'
cloud-init-output.log:2015-08-07 10:08:30,660 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: './step-1'
注意 step-1 是我的脚本,我试图将其作为 user-data 传递。另外,我的脚本存在于我运行命令的同一目录中,因此它应该选择
默认解释器似乎是Python。因此,如果您只想执行 shell 脚本,则需要以 hash-bang 开头,例如:
#!/bin/bash
/yourpath/step-1
请注意,为了调试此问题,请尝试: cat /var/log/cloud-init-output.log
并看到:https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)