-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_spot_instance_request with associate_public_ip_address=true never assign public ip. #9575
Comments
Thanks for opening the issue here - sorry this is causing you some problems. Can you tell me if the subnet that you are launching the instance into actually allows public_ips to be mapped? Paul |
Forgive me for jumping in on this thread -- this has bit me as well. 😄 Per the AWS docs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-ip-addressing.html), setting a subnet's public_ip auto-assign value to false has no effect if the EC2 reservation request has the public_ip value set to true. When using the spot_instance resource, I've been seeing reservations without the Looking at the code, the resource_aws_spot_instance seems to have different logic (https://github.com/hashicorp/terraform/blob/master/builtin/providers/aws/resource_aws_spot_instance_request.go#L112-L114) than the on-demand version (https://github.com/hashicorp/terraform/blob/master/builtin/providers/aws/resource_aws_spot_instance_request.go#L112-L114), though I think the AWS-side structures are pretty much the same. Might this be the problem, @stack72 ? |
I wrote a reproduction code. Please see a following gist: As @davidski said, ondemand and spot have different behaviors when subnet's map_public_ip_on_launch is set false. I'm confused in this behavior. |
Hey @stack72 - This issue still has the |
Bug is still present in 0.9.2. |
PR with fix is here if you would like to try: #13736 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I'm trying to launch a spot instance with public ip in VPC. My EIPs are reached limit, so I need to use auto-assigned public ip. I set associate_public_ip_address true, but public ip is never assigned. I also tried an ondemand instance. In this case, a public ip was assigned.
vpc(subnet) setting:
According to aws cli doc, spot instance with public ip can be done with followed code.
http://docs.aws.amazon.com/cli/latest/reference/ec2/request-spot-instances.html#examples
command:
spcification.json:
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
When "associate_public_ip_address=true", aws_spot_instance_request should associate public ip.
Actual Behavior
aws_spot_instance_request never associates public ip.
The text was updated successfully, but these errors were encountered: