Skip to content

Use cached IP Address for amazonec2 driver

Steve Xuereb requested to merge use-amazon-cached-ip into master

GetIP gets called every time docker-machine wants to send an ssh command. For the amazonec2 driver it is not using the saved IPAddress but calling the aws API every time which leads to an excessive amount of IP calls which exhaust the API limit. Before sending a request for the IP check if it's populated, the IPAddress is being populated for the first time when the machine starts in instanceIpAvailable

Reading amazon documentation on weather a public IP can change during the lifecycle of a machine it does not seem like it will effect docker-machine in any way.

This seems to effect other drivers like the google driver, but drivers like digitalocean are not effected since the use the baseDriver.GetIP which does not call the API. Also on drivers like softlayer it is doing the same check before calling the API.

We can see significant reduction of API calls:

Before Patch: Number of DescribeInstances: 34 Number of GetSSHHostname: 17

After Patch: Number of DescribeInstances: 13 Number of GetSSHHostname: 17

More investigation of this issue can be found in gitlab-org/gitlab-runner#3424 (comment 231357594)

reference gitlab-org/gitlab-runner#3424 (closed)

Merge request reports