Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15421121
D10458.id27530.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10458.id27530.diff
View Options
diff --git a/src/applications/drydock/blueprint/DrydockAmazonEC2HostBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockAmazonEC2HostBlueprintImplementation.php
--- a/src/applications/drydock/blueprint/DrydockAmazonEC2HostBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockAmazonEC2HostBlueprintImplementation.php
@@ -269,7 +269,23 @@
$resource->setAttribute('eip-status', 'Associated');
$resource->save();
- $address = $public_ip;
+ if ($this->getDetail('always-use-private-ip')) {
+ // Use the private IP address.
+ $result = $this->getAWSEC2Future()
+ ->setRawAWSQuery(
+ 'DescribeInstances',
+ array(
+ 'InstanceId.0' => $instance_id,))
+ ->resolve();
+
+ $reservation = $result->reservationSet->item[0];
+ $instance = $reservation->instancesSet->item[0];
+
+ $address = (string)$instance->privateIpAddress;
+ } else {
+ // Use the public IP address.
+ $address = $public_ip;
+ }
} catch (PhutilAWSException $ex) {
// We can't allocate an Elastic IP (probably because we've reached
// the maximum allowed on the account). Terminate the EC2 instance
@@ -585,6 +601,17 @@
'to instances so that Phabricator can SSH to them from the '.
'internet (instances are still only accessible by SSH key pairs)'),
),
+ 'always-use-private-ip' => array(
+ 'name' => pht('Always Use Private IP'),
+ 'type' => 'bool',
+ 'caption' => pht(
+ 'When instances are placed in a VPC, and are not placed behind '.
+ 'a NAT, an elastic IP may be required in order to establish '.
+ 'outbound internet connections. Enable this option if elastic IP '.
+ 'allocation is only enabled for this purpose, and you want to '.
+ 'connect to the machine on it\'s private IP address (because of '.
+ 'firewall rules).'),
+ ),
'skip-ssh-setup-windows' => array(
'name' => pht('Skip SSH setup on Windows'),
'type' => 'bool',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 22, 9:10 PM (5 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7384400
Default Alt Text
D10458.id27530.diff (2 KB)
Attached To
Mode
D10458: Allow private IP address to always be used, even if elastic IP is allocated
Attached
Detach File
Event Timeline
Log In to Comment