Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidUserData.Malformed) when calling the CreateLaunchTemplate operation #15

Open
bjxuch opened this issue Sep 16, 2019 · 3 comments
Open

Comments

@bjxuch
Copy link

bjxuch commented Sep 16, 2019

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
Copy link
Contributor

ranshn commented Sep 16, 2019

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
Copy link
Author

bjxuch commented Sep 17, 2019

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:

  • wget
  • ruby
  • curl
  • amazon-efs-utils

runcmd:

  • [ sh, -c, "curl https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install -o /home/ec2-user/install" ]
  • [ sh, -c, "chmod +x /home/ec2-user/install" ]
  • [ sh, -c, "./home/ec2-user/install auto" ]
  • [ sh, -c, "systemctl enable codedeploy-agent.service" ]
  • [ sh, -c, "systemctl start codedeploy-agent.service" ]
  • [ sh, -c, "mkdir -p /var/www/media" ]
  • [ sh, -c, "echo 'fs-e22b8000:/ /var/www/media efs tls,_netdev' >> /etc/fstab" ]
  • [ sh, -c, "mount -a -t efs defaults" ]
  • [ sh, -c, "chown -R ec2-user. /var/www/media" ]

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
Copy link
Contributor

ranshn commented Sep 17, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants