So I have a perfectly working Packer json file I was using for some time now. In recent days I explored AWS spot instances more and decided to put in the spot options in my Packer json as well. Straightforward, no so much on the config side to go wrong… At least that’s what I think.
Now the spot request fires, comes back successfully BUT then Packer tries to connect to the private ip instead of the public ip. Needless to say that
Waiting for SSH to become available... times out:
==> lb: Interpolating tags for spot instance... lb: Adding tag: "Name": "Packer Builder" lb: Loading User Data File... lb: Creating Spot Fleet launch template... lb: Sending spot request ()... lb: Instance ID: i-0a6f4jibberish79fd ==> lb: Using ssh communicator to connect: 220.127.116.11
So really the delta to my working config without spot is:
"associate_public_ip_address": true, "spot_price": "0.004", "instance_type": "t3.micro",
Initially I thought the
"associate_public_ip_address": true has to be set in order for this to work, but no luck with or without this. This behaviour shows on Packer v1.5.5 as well as on the recently released v1.5.6.
Any hint is appreciated.