Configure networking based on EC2 metadata source

Bug #1639030 reported by Robert C Jennings
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Unassigned
cloud-init (Ubuntu)
Fix Released
Medium
Scott Moser
Nominated for Xenial by Robert C Jennings
Nominated for Zesty by Robert C Jennings

Bug Description

EC2 metadata[1] presents information regarding network devices (mac, name, etc) that would be useful to consume. Chiefly we could match the network device names surfaced in the EC2 UIs (eth0, eth2...) rather than using our own enumeration at boot.

A method to detemermine if we are on an instance in EC2 as been published[2] as part of their documentation so we can now do this in the EC2 datasource without impacting clouds that have copied that datasource.

The work done for DO datasource[3] would be applicable here as a model.

[1] http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
[2] http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.html
[3] https://git.launchpad.net/cloud-init/commit/?id=9f83bb8e80806d3dd79ba426474dc3c696e19a41

Related branches

Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

Please be aware of Bug #1637252. On sysconfig based-systems, cloud-init blows up during boot. This is also known as https://bugzilla.redhat.com/show_bug.cgi?id=1389530

Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Scott Moser (smoser) wrote :

We had some discussion on this bug today in #cloud-init.
 https://irclogs.ubuntu.com/2017/07/10/%23cloud-init.html

It seems that in order to interact with the metadata service, we need
to configure the instances ip address as a dhcp request would give us.
The service will drop packets if the source address is not "right", and
right does not include ipv4 link local scope.

So there is really no way to talk to the metadata service unless you
do a dhcp.

This little script run in a Ubuntu 16.04 image shows what we were trying to
do and shows a way that it seems to work:
  http://paste.ubuntu.com/25062706/
results of:
  addr: http://paste.ubuntu.com/25062713/
  link-local: http://paste.ubuntu.com/25062728/

So that gives us 2 basic options
a.) use dhclient (or appropriate distro-provided dhcp client)
   This probably can be made to work, but we ultimately would have to work with
   different clients on different distros or image configurations and also have
   to deal with "side affects" of having done dhclient. Ie, dhclient calls hook
   scripts on up and down. That may not be a problem, but it definitely could be.

b.) use a "built in" dhcp client.
   http://code.activestate.com/recipes/577649-dhcp-query/

Revision history for this message
Mark Thomas (markthomas) wrote :

Proposed for Zesty and Xenial so that you can discuss the path to a Xenial SRU for IPv6 support.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.9-259-g7e76c57b-0ubuntu1

---------------
cloud-init (0.7.9-259-g7e76c57b-0ubuntu1) artful; urgency=medium

  * Disable upstart support, as upstart is no longer shipped in artful.
    [Dimitri Ledkov]
  * New upstream snapshot.
    - distro: allow distro to specify a default locale [Ryan Harper]
    - tests: fix two recently added tests for sles distro.
    - url_helper: dynamically import oauthlib import from inside oauth_headers
      [Chad Smith]
    - tox: make xenial environment run with python3.6
    - suse: Add support for openSUSE and return SLES to a working state.
      [Robert Schweikert]
    - GCE: Add a main to the GCE Datasource.
    - ec2: Add IPv6 dhcp support to Ec2DataSource. [Chad Smith] (LP: #1639030)
    - url_helper: fail gracefully if oauthlib is not available
      [Lars Kellogg-Stedman] (LP: #1713760)
    - cloud-init analyze: fix issues running under python 2. [Andrew Jorgensen]
    - Configure logging module to always use UTC time.
      [Ryan Harper] (LP: #1713158)
    - Log a helpful message if a user script does not include shebang.
      [Andrew Jorgensen]
    - cli: Fix command line parsing of coniditionally loaded subcommands.
      [Chad Smith] (LP: #1712676)
    - doc: Explain error behavior in user data include file format.
      [Jason Butz]
    - cc_landscape & cc_puppet: Fix six.StringIO use in writing configs
      [Chad Smith] (LP: #1699282, #1710932)
    - schema cli: Add schema subcommand to cloud-init cli and cc_runcmd schema
      [Chad Smith]
    - Debian: Remove non-free repositories from apt sources template.
      [Joonas Kylmälä] (LP: #1700091)

 -- Scott Moser <email address hidden> Wed, 30 Aug 2017 21:18:05 -0400

Changed in cloud-init (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Scott Moser (smoser) wrote : Fixed in Cloud-init 17.1

This bug is believed to be fixed in cloud-init in 17.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Confirmed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.