0

I have a script that uses ec2-associate-address that I have set in a cron job to run on boot. The idea is to use this instance as a spot instance that will automatically get its public IP assigned on boot. However, since it is a VPC instance, it seems like it cannot make outbound requests until the EIP is assigned.

The error I get is: Unknown problem connecting to host: 'https://ec2.amazonaws.com' Unable to execute HTTP request: Connect to ec2.amazonaws.com:443 timed out

What is the easiest way to accomplish this? I know the ID of the EIP, but I obviously will not have the instance ID since it is a spot request.

1 Answer 1

1

EC2 has an option to auto-associate a random public IP upon instance creation. If you enable that, your instance should be able to issue the API call to associate your EIP.

If you're using the python-based AWS CLI, you can issue the --associate-public-ip-address paramater to do this. If you're not using this tool, you should start doing so, as the java-based command-line tools which you're using will eventually be deprecated.

1
  • Thanks! Relaunching the instance with an auto-IP did the trick! Jun 29, 2015 at 15:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .