sending powershell script to Windows ec2 in user data
The problem lies in the encoding of user_data
, which is already performed by boto
. According to the boto documentation, user_data
should be "[t]he Base64-encoded MIME user data to be made available to the instance(s) in this reservation," which I find to be very misleading, since the encoding need not and should not be done in the call to run_instances
. The following Python works for me now:
# create connection...conn = ...# run instancewith open("bootstrap.ps1", "r") as fd: # don't encode user_data conn.run_instances(..., user_data=fd.read())