Author: tomaz
Date: Tue Nov 1 02:46:50 2011
New Revision: 1195778
URL: http://svn.apache.org/viewvc?rev=1195778&view=rev
Log:
Add example about deploying an EC2 node (0.6.0 functionality).
Modified:
libcloud/site/trunk/content/docs/compute-deployment.mdtext
Modified: libcloud/site/trunk/content/docs/compute-deployment.mdtext
URL:
http://svn.apache.org/viewvc/libcloud/site/trunk/content/docs/compute-deployment.mdtext?rev=1195778&r1=1195777&r2=1195778&view=diff
==============================================================================
--- libcloud/site/trunk/content/docs/compute-deployment.mdtext (original)
+++ libcloud/site/trunk/content/docs/compute-deployment.mdtext Tue Nov 1
02:46:50 2011
@@ -15,7 +15,7 @@ tool so it shouldn't be used as such.
*Note: Deployment functionality depends on the `paramiko` library which can be
installed using pip - `pip install paramiko`.*
-### Example 1 - Deploying a Node and installing your SSH key and Puppet on it
###
+### Example 1 - Deploying a Rackspace Node using password authentication and
installing your SSH key and Puppet on it ###
::python
from libcloud.compute.types import Provider
@@ -45,3 +45,37 @@ tool so it shouldn't be used as such.
node = conn.deploy_node(name='test', image=images[0], size=sizes[0],
deploy=msd)
# <Node: uuid=..., name=test, state=3, public_ip=['1.1.1.1'],
provider=Rackspace ...>
# the node is now booted, with your ssh key and puppet installed.
+
+
+### Example 2 - Deploying an EC2 Node using SSH key authentication and
installing Puppet on it ###
+
+ ::python
+ from libcloud.compute.types import Provider
+ from libcloud.compute.providers import get_driver
+ from libcloud.compute.deployment import ScriptDeployment
+
+ EC2_ACCESS_ID = 'your access key'
+ EC2_SECRET = 'your secret'
+
+ Driver = get_driver(Provider.EC2_US_EAST)
+ conn = Driver(EC2_ACCESS_ID, EC2_SECRET)
+
+ # a simple script to install puppet post boot, can be much more
complicated.
+ script = ScriptDeployment("apt-get -y install puppet")
+
+ # Ubuntu 10.04
+ image = [i for i in driver.list_images() if i.id =='ami-09965860' ][0]
+ size = [s for s in driver.list_sizes() if s.id == 't1.micro'][0]
+
+ # Name of the SSH key which is automatically installed on the server.
+ # Key needs to be generated and named in the AWS control panel.
+ key_name = 'my_default'
+
+ # Path to the private key created using the AWS control panel.
+ key_path = '/home/user/path/to/key.pem'
+
+ # deploy_node takes the same base keyword arguments as create_node.
+ node = conn.deploy_node(name='test', image=image, size=size, deploy=script,
+ ssh_key=key_path, ex_keyname=key_name)
+ # <Node: uuid=..., name=test, state=3, public_ip=['1.1.1.1'], provider=EC2
...>
+ # the node is now booted, with puppet installed.