0
ec2-run-instances $AMI_ID -n 1 -g $SECURITY_GROUP -k $PEM_NAME -f myFile -t m1.large --availability-zone us-east-1a --monitor -K $EC2_PRIVATE_KEY -C $EC2_CERT

Is what creates the instance.

myFile has chmod a+x permissions:

#!/bin/bash -ex

sudo mkdir /home/ubuntu/thisactuallyworked

This seems like it should work. I also tried replacing -f with --user-data-file, but it still hangs the box. I'm using a > 10.04 Ubuntu AMI, and all examples point to this working. What gives?!

1 Answers1

0

From the manual, I understood that your file will be available in the machine not executed in the machine. So you will need a next step that is a ssh to the machine to execute this file.

Notice also that you may need to put the a+x on the remote machine instead of in your own machine.

Rodolfo
  • 146
  • 2
  • This is not accurate at all. If the system has init-hooks/ec2ubuntu it looks only at the first 2 chars and if it has a `#!` then it executes it. See: http://ec2ubuntu.googlecode.com/svn/trunk/etc/init.d/ec2-run-user-data – rh0dium Aug 10 '12 at 14:23