Skip to content

[Problem] aws ec2 run-instances with option --user-data #3338

@DevOpsRoot

Description

@DevOpsRoot

Hi,

Since around 2 month, i'm using ec2 run-instances with option --user-data like this and it's perfectly works :

function dev-tools_create_instance()
{
    echo "## DEPLOY ##"
    aws ec2 run-instances \
    	--image-id ami-016f9e78 \
    	--count 1 \
    	--instance-type t2.medium \
    	--subnet-id subnet-0863a9c593474cebf \
        --security-group-ids sg-0120c0771c0f771b9 sg-0a8a8fe8dce209282 sg-031f5455a19646c46 sg-021ca18608ae06f7c sg-06cfce7182c4bc206 \
    	--key-name AWS-BACK-MDB \
    	--tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=EXO-$1}]" \
    	--user-data file://setup-script.txt
}

but now i've got an error in /var/log/cloud-init-output

/var/lib/cloud/instance/scripts/part-001: 35: /var/lib/cloud/instance/scripts/part-001: Syntax error: "|" unexpected
Cloud-init v. 0.7.9 running 'modules:final' at Thu, 24 May 2018 08:06:10 +0000. Up 11.80 seconds.

and i think the error come from here in my file://setup-script.txt

sudo apt-get -y install httpie
echo <docker_mdp> | docker login --username <docker_user> --password-stdin

Have you change something in the parsing of this file ?

Thanks in advance,
Luc

Metadata

Metadata

Assignees

No one assigned

    Labels

    closing-soonThis issue will automatically close in 4 days unless further comments are made.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions