forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added (incomplete) first crack at customer facing ec2 start scripts.
- Loading branch information
1 parent
db1e76e
commit 2c0911e
Showing
3 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
This directory contains scripts to help launch an H2O cluster in EC2. | ||
You must install the boto python library. | ||
|
||
http://boto.readthedocs.org/en/latest/ | ||
http://www.amazon.com/Python-and-AWS-Cookbook-ebook/dp/B005ZTO0UW/ref=sr_1_1?ie=UTF8&qid=1379879111&sr=8-1&keywords=python+aws | ||
|
||
Work in progress... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import time | ||
import boto | ||
import boto.ec2 | ||
|
||
|
||
# Environment variables you MUST set. | ||
# ----------------------------------- | ||
# | ||
# os.environ['AWS_ACCESS_KEY_ID'] = '...' | ||
# os.environ['AWS_SECRET_ACCESS_KEY'] = '...' | ||
|
||
|
||
# Options you MUST tailor to your own AWS account. | ||
# ------------------------------------------------ | ||
|
||
# SSH key pair name. | ||
keyName = '0xdata_Big' | ||
|
||
# AWS security group name. | ||
# Note: | ||
# H2O uses TCP and UDP ports 54321 and 54322. | ||
# RStudio uses TCP port 8787. | ||
securityGroupName = 'SecurityDisabled' | ||
|
||
|
||
# Options you might want to change. | ||
# --------------------------------- | ||
|
||
numInstancesToLaunch = 2 | ||
instanceType = 'm1.large' | ||
instanceNameRoot = 'H2ORStudioDemo' | ||
|
||
|
||
# Options to help debugging. | ||
# -------------------------- | ||
|
||
debug = 0 | ||
# debug = 1 | ||
dryRun = False | ||
# dryRun = True | ||
|
||
|
||
# Options you should not change unless you really mean to. | ||
# -------------------------------------------------------- | ||
|
||
regionName = 'us-east-1' | ||
amiId = 'ami-634f050a' | ||
|
||
|
||
#-------------------------------------------------------------------------- | ||
# No need to change anything below here. | ||
#-------------------------------------------------------------------------- | ||
|
||
publicFileName = 'nodes-public' | ||
privateFileName = 'nodes-private' | ||
|
||
if not dryRun: | ||
fpublic = open(publicFileName, 'w') | ||
fprivate = open(privateFileName, 'w') | ||
|
||
print 'Using boto version', boto.Version | ||
if (debug): | ||
boto.set_stream_logger('h2o-ec2') | ||
ec2 = boto.ec2.connect_to_region(regionName, debug=debug) | ||
|
||
print 'Launching', numInstancesToLaunch, 'instances.' | ||
|
||
reservation = ec2.run_instances( | ||
image_id=amiId, | ||
min_count=numInstancesToLaunch, | ||
max_count=numInstancesToLaunch, | ||
key_name=keyName, | ||
instance_type=instanceType, | ||
security_groups=[securityGroupName], | ||
dry_run=dryRun | ||
) | ||
|
||
for i in range(numInstancesToLaunch): | ||
instance = reservation.instances[i] | ||
print 'Waiting for instance', i, '...' | ||
while instance.state != 'running': | ||
print ' .' | ||
time.sleep(5) | ||
instance.update() | ||
print ' instance', i, 'is up.' | ||
name = instanceNameRoot + str(i) | ||
instance.add_tag('Name', value=name) | ||
|
||
print 'Creating output files: ', publicFileName, privateFileName | ||
|
||
for i in range(numInstancesToLaunch): | ||
instance = reservation.instances[i] | ||
instanceName = '' | ||
if 'Name' in instance.tags: | ||
instanceName = instance.tags['Name']; | ||
print 'Instance', i | ||
print ' Name: ', instanceName | ||
print ' PUBLIC: ', instance.public_dns_name | ||
print ' PRIVATE:', instance.private_ip_address | ||
fpublic.write(instance.public_dns_name + '\n') | ||
fprivate.write(instance.private_ip_address + '\n') | ||
|
||
fpublic.close() | ||
fprivate.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import time | ||
import boto | ||
import boto.ec2 | ||
|
||
|
||
# Environment variables you MUST set. | ||
# ----------------------------------- | ||
# | ||
# os.environ['AWS_ACCESS_KEY_ID'] = '...' | ||
# os.environ['AWS_SECRET_ACCESS_KEY'] = '...' | ||
|
||
|
||
# Options you might want to change. | ||
# --------------------------------- | ||
|
||
instanceNameRoot = 'H2ORStudioDemo' | ||
|
||
|
||
# Options to help debugging. | ||
# -------------------------- | ||
|
||
debug = 0 | ||
# debug = 1 | ||
|
||
|
||
# Options you should not change unless you really mean to. | ||
# -------------------------------------------------------- | ||
|
||
regionName = 'us-east-1' | ||
|
||
|
||
#-------------------------------------------------------------------------- | ||
# No need to change anything below here. | ||
#-------------------------------------------------------------------------- | ||
|
||
print 'Using boto version', boto.Version | ||
if (debug): | ||
boto.set_stream_logger('h2o-ec2') | ||
ec2 = boto.ec2.connect_to_region(regionName, debug=debug) | ||
|
||
reservations = ec2.get_all_instances() | ||
for reservation in reservations: | ||
instances = reservation.instances | ||
for instance in instances: | ||
instanceName = '(empty)' | ||
if 'Name' in instance.tags: | ||
instanceName = instance.tags['Name']; | ||
if instanceName.startswith(instanceNameRoot): | ||
print ' ', instance | ||
print ' ', instanceName | ||
print ' ', instance.public_dns_name | ||
print ' ', instance.ip_address | ||
print ' ', instance.private_dns_name | ||
print ' ', instance.private_ip_address |