Hi,
This is for aws builder. Our AMI instance doesn’t support ssh-keypair. In the builder I can’t pass ssh_password as it is value is dynamic (set to instanceID). How do I set the value to use that instanceID.
I was trying to do something like
“ssh_password”: “{{ build ID
}}”. but it doesn’t work (throws error).
How do I achieve it to pass the instanceID packer created.
is there a way to prompt for password? so that I can input it
Error is
==> amazon-ebs: Launching a source AWS instance…
==> amazon-ebs: Adding tags to source instance
amazon-ebs: Adding tag: “Name”: “Packer Builder”
amazon-ebs: Instance ID: i-038b675f3fbf23aca
==> amazon-ebs: Waiting for instance (i-038b675f3fbf23aca) to become ready…
amazon-ebs: Public DNS: ec2-54-91-170-51.compute-1.amazonaws.com
amazon-ebs: Public IP: 54.91.170.51
amazon-ebs: Private IP: 172.31.23.129
==> amazon-ebs: Pausing after run of step ‘StepRunSourceInstance’. Press enter to continue.
==> amazon-ebs: Pausing after run of step ‘StepGetPassword’. Press enter to continue.
==> amazon-ebs: Pausing after run of step ‘StepCreateSSMTunnel’. Press enter to continue.
==> amazon-ebs: Using ssh communicator to connect: 54.91.170.51
==> amazon-ebs: Waiting for SSH to become available…
==> amazon-ebs: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
{
“variables”: {
“aws_access_key”: “{{env AWS_ACCESS_KEY_ID
}}”,
“aws_secret_key”: “{{env AWS_SECRET_ACCESS_KEY
}}”,
“region”: “us-east-1”
},
“builders”: [
{
“access_key”: “{{user aws_access_key
}}”,
“ami_name”: “vk-adcaas-aws-demo-{{timestamp}}”,
“instance_type”: “m4.xlarge”,
“region”: “us-east-1”,
“secret_key”: “{{user aws_secret_key
}}”,
“source_ami”: “ami-04fc8fbd00691cb28”,
“source_ami_filter”: {
“filters”: {
“virtualization-type”: “hvm”,
“root-device-type”: “ebs”
},
“owners”: [“679593333241”]
},
“ssh_username”: “nsrecover”,
“type”: “amazon-ebs”
}
],
“provisioners”: [
{
“type”: “shell-local”,
“environment_vars”: [
“TESTVAR={{ build PackerRunUUID
}}”,
“INSTANCEVAR={{ build ID
}}”
],
“inline”: [
“echo $TESTVAR”,
“echo $INSTANCEVAR”
]