Skip to content
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

Use private IPs #1

Merged
merged 1 commit into from
Feb 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 6 additions & 13 deletions flintrock/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ def instances(self):

@property
def master_ip(self):
return self.master_instance.public_ip_address
return self.master_instance.private_ip_address

@property
def master_host(self):
return self.master_instance.public_dns_name
return self.master_instance.private_dns_name

@property
def slave_ips(self):
return [i.public_ip_address for i in self.slave_instances]
return [i.private_ip_address for i in self.slave_instances]

@property
def slave_hosts(self):
return [i.public_dns_name for i in self.slave_instances]
return [i.private_dns_name for i in self.slave_instances]

@property
def num_masters(self):
Expand Down Expand Up @@ -297,12 +297,12 @@ def add_slaves(
{'Key': 'flintrock-role', 'Value': 'slave'},
{'Key': 'Name', 'Value': '{c}-slave'.format(c=self.name)}]))

existing_slaves = {i.public_ip_address for i in self.slave_instances}
existing_slaves = {i.private_ip_address for i in self.slave_instances}

self.slave_instances += new_slave_instances
self.wait_for_state('running')

new_slaves = {i.public_ip_address for i in self.slave_instances} - existing_slaves
new_slaves = {i.private_ip_address for i in self.slave_instances} - existing_slaves

super().add_slaves(
user=user,
Expand Down Expand Up @@ -441,13 +441,6 @@ def check_network_config(*, region_name: str, vpc_id: str, subnet_id: str):
"See: https://github.com/nchammas/flintrock/issues/43"
.format(v=vpc_id)
)
if not ec2.Subnet(subnet_id).map_public_ip_on_launch:
raise ConfigurationNotSupported(
"{s} does not auto-assign public IP addresses. "
"Flintrock requires public IP addresses.\n"
"See: https://github.com/nchammas/flintrock/issues/14"
.format(s=subnet_id)
)


def get_security_groups(
Expand Down