Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can launch an ec2 instance without user data:

aws ec2 request-spot-instances --spot-price .01 --instance-count 1 --launch-specification '{ "ImageId": "ami-3275ee5b", "KeyName": "key", "InstanceType": "t1.micro"}'

But when I try it with userdata I get the following error:

aws ec2 request-spot-instances --spot-price .01 --instance-count 1 --launch-specification '{ "ImageId": "ami-3275ee5b", "KeyName": "key", "UserData": {"Fn::Base64" : { "Fn::Join" : ["", ["#!/bin/bash\n","touch /tmp/userdata_sucess\n"]]}}, "InstanceType": "t1.micro"}'

Invalid value ('OrderedDict([(u'Fn::Base64', OrderedDict([(u'Fn::Join', [u'', [u'#!/bin/bash\n', u'touch /tmp/userdata_sucess\n']])]))])') for param string:UserData of type string

I was following the example here

share|improve this question

When you request spot instance, Amazon require userdatа to be in base64 format. Example:

aws ec2 request-spot-instances \
--spot-price 0.01 \
--instance-count 2 \
--launch-specification \
    "{ \
        \"ImageId\":\"ami-a6926dce\", \
        \"InstanceType\":\"m3.medium\", \
        \"KeyName\":\"test-key\", \
        \"SecurityGroups\": [\"test-sg\"], \
        \"UserData\":\"`base64`\" \

More info at: Request spot instances

Example is from: Small Tip: How to use AWS CLI to start Spot instances with UserData

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.