I'm trying to deploy Amazon EC2 instance through CloudFormation and I'm trying to clone a repository with a bash script with cfn-init.
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#! /bin/bash -xe\n",
"yum install -y aws-cfn-bootstrap\n",
"/opt/aws/bin/cfn-init -v ",
" --stack ", { "Ref" : "AWS::StackName" },
" --resource DocumentationInstance ",
" --configsets Install ",
" --region ", { "Ref" : "AWS::Region" }, "\n",
"git clone https://", { "Ref": "GitLabUsn" },"@gitlab.com/user/repository.git \n", { "Ref": "GitLabPwd" }
]]}}
}
However, when I deploy the EC2 instance, I can see from cloud-init-output.log that the git clone fails, and this is the error:
fatal: could not read Password for 'https://[email protected]': No such device or address
How can I input the password with the bash script correctly? I've tried the yes found here