Pass User Data to AWS client

amazon ec2amazon-web-services

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 : http://docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html

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 chef_user_data.sh --wrap=0)

chef_user_data.sh

#!/bin/bash
curl -L https://www.opscode.com/chef/install.sh | sudo bash

Best Answer

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 : https://github.com/aws/aws-cli

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

Related Topic