Issue in running user-data script AWS EC2

时间:2022-09-23 17:30:23

Is it possible to run python script through AWSCLI (user-data). I tried but it didn't run and i have following in my logs

是否可以通过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'

Note step-1 is my script which i am trying to pass as user-data . Also my script is present in same directory from where i am running command so it should pick

注意步骤1是我的脚本,我试图作为用户数据传递。此外,我的脚本存在于我正在运行命令的同一目录中,因此它应该选择

2 个解决方案

#1


2  

You can use any command to be run under user-data. I have used user-data to bootstrap Windows Instances with Domain Controller setup or domain join using PowerShell; of course given that it is on EC2 - the properties are extensible whether you are running in Unix based or Windows Based.

您可以使用任何命令在用户数据下运行。我已经使用用户数据通过域控制器设置或使用PowerShell进行域连接来引导Windows实例;当然,鉴于它是在EC2上 - 无论您是在基于Unix还是基于Windows运行,属性都是可扩展的。

So you have specified, Python - so please ensure the following

所以你已经指定了Python - 所以请确保以下内容

  1. Python already installed and then take an image - use that image to bootstrap
  2. 已安装Python然后拍摄图像 - 使用该图像进行引导

  3. You enable User-Data and pass the user-data commands during the launch time
  4. 您启用User-Data并在启动期间传递用户数据命令

#2


0  

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

the document from aws say that only shell and cloud-init directive that are supported

来自aws的文档说只支持shell和cloud-init指令

#1


2  

You can use any command to be run under user-data. I have used user-data to bootstrap Windows Instances with Domain Controller setup or domain join using PowerShell; of course given that it is on EC2 - the properties are extensible whether you are running in Unix based or Windows Based.

您可以使用任何命令在用户数据下运行。我已经使用用户数据通过域控制器设置或使用PowerShell进行域连接来引导Windows实例;当然,鉴于它是在EC2上 - 无论您是在基于Unix还是基于Windows运行,属性都是可扩展的。

So you have specified, Python - so please ensure the following

所以你已经指定了Python - 所以请确保以下内容

  1. Python already installed and then take an image - use that image to bootstrap
  2. 已安装Python然后拍摄图像 - 使用该图像进行引导

  3. You enable User-Data and pass the user-data commands during the launch time
  4. 您启用User-Data并在启动期间传递用户数据命令

#2


0  

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

the document from aws say that only shell and cloud-init directive that are supported

来自aws的文档说只支持shell和cloud-init指令