2

I have tried booting several times an ec2 t2.nano with custom userdata, but I can't get it working, the logs say:

/var/log/cloud-init.log

helpers.py[DEBUG]: Running config-rightscale_userdata using lock (<FileLock using file '/var/lib/cloud/instances/i-b4fef82a/sem/config_rightscale_userdata'>)

[CLOUDINIT] cc_rightscale_userdata.py[DEBUG]: Failed to get raw userdata in module rightscale_userdata```

Also, I'm sure userdata is in there, running ec2metadata, I can see my shell script:

user-data: #!/bin/bash
echo "Running" > ~/running
sudo apt-get update -y
sudo apt-get install git -y

git clone https://host.git
cd dir
. setup.sh

I'm running an ubuntu instance like so:

aws ec2 run-instances --region us-east-1 --security-group-ids "sg-885493f2" "sg-aa6eadd0" "sg-e360a399" --key-name reduza-fontes --instance-type t2.nano --user-data file:///Users/lucaswxp/launch-ec2-squid.txt --image-id ami-2d39803a

Any ideas?

Lucas Pelegrino
  • 202
  • 1
  • 4
  • 10
  • Try a different AMI. What is the rightscale relevance? – dmourati Aug 13 '16 at 04:58
  • @dmourati I'm not sure, all I saw was "Failed to get raw userdata", will try different AMI – Lucas Pelegrino Aug 13 '16 at 05:01
  • did you try doing this using the AWS console for comparison? did you try base64 encoding of the user data? does the first line literally just have `#!/bin/bash` (the "user-data: " part should not be part of the user data). – Skaperen Aug 13 '16 at 06:00
  • do a minimal case test with a simple use data (commands to store a file) on a generic AMI. – Skaperen Aug 13 '16 at 06:03
  • @dmourati Tried a different AMI, same. – Lucas Pelegrino Aug 15 '16 at 00:32
  • @Skaperen, yes the first line is the shebang, I tried a script as simple as "echo 'Test' > ~/test', it did not work. Any ideas how to debug? It seems it is not getting executed. – Lucas Pelegrino Aug 15 '16 at 00:32
  • @Skaperen About base64, yes it is encoded. – Lucas Pelegrino Aug 15 '16 at 00:35
  • Don't encode: http://stackoverflow.com/questions/22344038/aws-ec2-run-instances-base64-encoded-user-data-blob-is-ignored – dmourati Aug 15 '16 at 02:28
  • the different AMI, was it the standard plain Ubuntu? if so, try a simpler userdata that just touches a unique file, then ssh in and see if the file was created. – Skaperen Aug 15 '16 at 06:29
  • i tried your user data and it seems to run partially. it creates file `running` but there is no directory `dir` for `setup.sh` to exist in. does that script remove it? the `git` package is now installed. maybe the AMI you are running has cloudinit final disabled (how i block userdata on AMIs i build). – Skaperen Aug 15 '16 at 07:43

0 Answers0