awslabs / ec2-spot-workshops

Collection of workshops to demonstrate best practices in using Amazon EC2 Spot Instances. https://aws.amazon.com/ec2/spot/
Other
182 stars 151 forks source link

InvalidUserData.Malformed) when calling the CreateLaunchTemplate operation #15

Open bjxuch opened 5 years ago

bjxuch commented 5 years ago

I follow the instruction and base64 the user data file, but failed on 'aws ec2 create-launch-template --launch-template-name runningAmazonEC2WorkloadsAtScale --version-description dev --launch-template-data file://launch-template-data.json' the error is 'An error occurred (InvalidUserData.Malformed) when calling the CreateLaunchTemplate operation: Invalid BASE64 encoding of user data.'

ranshn commented 5 years ago

hi @bjxuch in the "UserData" part of the launch-template-data.json file, did you paste the actual user-data or the path to the file that contains your user data? can you please use a BASE64 decoder to check that your encoded string is ok. otherwise can you please upload your edited launch-template-data.json here or paste the content?

bjxuch commented 5 years ago

pls refer the screen shot base64 --wrap=0 user-data.txt > user-data.base64.txt

adminUser:~/environment/ec2-spot-workshops/workshops/running-amazon-ec2-workloads-at-scale (master) $ base64 --decode user-data.base64.txt repo_update: true repo_upgrade: all

packages:

runcmd:

adminUser:~/environment/ec2-spot-workshops/workshops/running-amazon-ec2-workloads-at-scale (master) $ aws ec2 create-launch-template --launch-template-name runningAmazonEC2WorkloadsAtScale123 --version-description dev --launch-template-data file://launch-template-data.json

An error occurred (InvalidUserData.Malformed) when calling the CreateLaunchTemplate operation: Invalid BASE64 encoding of user data.

ranshn commented 5 years ago

Thanks for attaching user-data.base64.txt , can you please attach launch-template-data.json