Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Has anyone successful passed user data to the AWS CLI ?

I have tried various incantations of the following but it does not work.

Docs say string must be base64 encoded :

The instance logs never indicate the script is executed and chef is installed.

aws ec2 run-instances --image-id ami-a73264ce --count 1 --instance-type t1.micro       --key-name scrubbed --iam-instance-profile Arn=arn:aws:iam::scrubbed:instance-profile/scrubbed --user-data $(base64 --wrap=0)

curl -L | sudo bash
share|improve this question

2 Answers 2

up vote 1 down vote accepted

The documentation is inconsistent between the : aws website, the git repo for the tool and the output of the tool itself.

It seems the most up to date info is in the repo pages :

The answer is the use something like : --user-data file://

share|improve this answer

Yes we have. The parameter works as defined, BUT the problem is that the ec2 treats userdata as an opaque data type - it passes it along as is, with no concrete representation of what it really is - that is left to the consuming app process on the instance. The command line nature of the CLI requires this encoding, but then the receiving process is now obligated to decode it. And Chef does not. Nor does You can confirm this by checking the instance meta data at

Seems like the CLI should encode the base64 userdata payload.

EDIT: Turns out the documentation is bad, the -user-data param actually accepts a file param, and does the encoding. --user-data file:///path/to/the/file. See

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.