I am unable to find details in the documentation or Google searches of spot instance limitations in regard to IP addressing. I have tried to do experiments to see what might work using the web based console, the AWS CLI, and the AWS API. So I am either unable find ways to make these requests, or where I have tried what I hoped might work did not work. I would like to know if these capabilities are supposed to work by some means for a spot instance:

  1. Be assigned and use a random private IPv4 address.
  2. Be assigned and use a specified private IPv4 address.
  3. Be assigned and use a random public IPv6 address.
  4. Be assigned and use a specified public IPv6 address.

Number 1 worked, but I was unable to find a way to make the others work. Example 3 in http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-examples.html seems to imply that user specified addressing is limited in spot instances.

edit 1:

The web console instructions in http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/MultipleIP.html work for adding an IPv4 address to a network interface. But for adding an IPv6 address to a network interface, they do not. There are no error messages, but the addresses are not added.

edit 2:

The web console does not work for adding a specific IPv6 address to a network interface or to create a network interface with a specific IPv6 address. The awscli package in Ubuntu does not include IPv6 subcommands and options. However, the awscli package in Python pip does. I have succeeded adding an IPv6 address to a spot instance by attaching a network interface with an IPv6 address to it.


The only difference between spot, on-demand and reserved instances is how you're billed. This page has a lot of useful information.

  1. Default behavior
  2. Your private IP is assigned automatically at launch, but you can assign additional private IPv4 addresses. Read this page for how, and see below.
  3. and 4. IPv6 addresses are all from the same pool, you use routing / firewalls to expose them to the internet, or not, as you prefer. Make sure your VPC is set up for IPv6 and it should be largely automatic when you create a new instance - there may be some kind of a flag or option you need to set somewhere.

Private IPv4 addresses

You can assign additional private IP addresses, known as secondary private IP addresses, to instances that are running in a VPC. Unlike a primary private IP address, you can reassign a secondary private IP address from one network interface to another. A private IP address remains associated with the network interface when the instance is stopped and restarted, and is released when the instance is terminated. For more information about primary and secondary IP addresses, see Multiple IP Addresses in the Amazon EC2 User Guide for Linux Instances.

  • i have found no flag or option that makes things work. and it is not just ipv6. specifying the desired virtual private IPv4 address within the subnet range fails. it gets a random virtual private IPv4 address within the subnet range. – Skaperen Jul 7 '17 at 8:06
  • 1
    DHCP in VPC does not actually control which address to assign, so option sets don't allow you to accomplish anything, here. The primary IP of an instance is fixed at launch. – Michael - sqlbot Jul 7 '17 at 8:49
  • @Michael-sqlbot that's why I said "look at", as I couldn't remember if it was possible or not. I have a feeling there's a way to choose your private IP but it escapes me - maybe I'm thinking of internal DNS. – Tim Jul 7 '17 at 18:22
  • You could call the API and attach the desired IP to the spot instance's existing ENI after it starts, or call the API to attach anew ENI, perhaps one that's already set up, with the desired IP always attached, and modify the kernel's policy route config so that it was preferred, but there's not a way to specify the primary private IPv4 address for a spot instance. – Michael - sqlbot Jul 7 '17 at 19:19
  • Agreed, trying to find a solution to what I assume the problem is, since the question is rather vague. – Tim Jul 7 '17 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.