ó FRTc@snddlZddlZddlZddlZddlZdZd„Zd„ZedkrjeƒndS(iÿÿÿÿNsi SYNOPSIS launch_ami.py -a ami_id [-b script_bucket] [-s script_name] [-m module] [-c class_name] [-r] [-g group] [-k key_name] [-n num_instances] [-w] [extra_data] Where: ami_id - the id of the AMI you wish to launch module - The name of the Python module containing the class you want to run when the instance is started. If you use this option the Python module must already be stored on the instance in a location that is on the Python path. script_file - The name of a local Python module that you would like to have copied to S3 and then run on the instance when it is started. The specified module must be import'able (i.e. in your local Python path). It will then be copied to the specified bucket in S3 (see the -b option). Once the new instance(s) start up the script will be copied from S3 and then run locally on the instance. class_name - The name of the class to be instantiated within the module or script file specified. script_bucket - the name of the bucket in which the script will be stored group - the name of the security group the instance will run in key_name - the name of the keypair to use when launching the AMI num_instances - how many instances of the AMI to launch (default 1) input_queue_name - Name of SQS to read input messages from output_queue_name - Name of SQS to write output messages to extra_data - additional name-value pairs that will be passed as userdata to the newly launched instance. These should be of the form "name=value" The -r option reloads the Python module to S3 without launching another instance. This can be useful during debugging to allow you to test a new version of your script without shutting down your instance and starting up another one. The -w option tells the script to run synchronously, meaning to wait until the instance is actually up and running. It then prints the IP address and internal and external DNS names before exiting. cCstGHtjƒdS(N(t usage_stringtsystexit(((sB/opt/freeware/lib/python2.7/site-packages/boto/pyami/launch_ami.pytusageFscCsýyMtjtjddddddddd d d d d ddg ƒ\}}WntƒnXi dd6dd6dd6dd6dd6dd 6dd6dd6dd6dd6}d}d}xT|D]L\}}|dGkrâ||d|jddƒƒ}d?|d|jfGHd@|jGHx|jD]}dA|jGHqW|rùt}x‚|sºtjdBƒg|jD]}|jƒ^qVg|jD]}|j^qv}|GH|j dCƒt!|jƒkr9t}q9q9Wx8|jD]*}dD|j"GHdE|j#GHdF|j$GHqÅWqùndS(TNisa:b:c:g:hi:k:m:n:o:rs:wtamitbuckettclasstgroupthelpt inputqueuetkeypairtmodulet numinstancest outputqueuetreloadt script_nametwaitt module_namet class_namet script_buckettdefaultt num_instancestinput_queue_nametoutput_queue_names-as--amis-bs--buckets-cs--classs-gs--groups-hs--helps-is --inputqueues-ks --keypairs-ms--modules-ns--num_instancess-os --outputqueues-rs--reloads-ss--scripts-ws--waits%s is requiredsReloading module %s to S3sCopying module %s to S3s.pyit script_md5s%s=%ssaws_access_key_id=%ssaws_secret_access_key=%st|t user_datatkey_nametsecurity_groupst max_countsAMI: %s - %s (Started)s0Reservation %s contains the following instances:s %sitrunnings Instance: %ssPublic DNS Name: %ssPrivate DNS Name: %s(s-as--ami(s-bs--bucket(s-cs--class(s-gs--group(s-hs--help(s-is --inputqueue(s-ks --keypair(s-ms--module(s-ns--num_instances(s-os --outputqueue(s-rs--reload(s-ss--script(s-ws--wait(%tgetoptRtargvRtNonetinttTruetgettimpt find_moduletbotot connect_s3t get_buckettnew_keytset_contents_from_filetmd5titemstappendt connect_ec2taws_access_key_idtaws_secret_access_keytjointget_all_imagestruntlocationtidt instancestFalsettimetsleeptupdatetstatetcounttlentami_launch_indextpublic_dns_nametprivate_dns_name(toptstargstparamsRRtotatrequiredtpnametltcRtkeytktvtkvtstrstimgtrtiRtstatus((sB/opt/freeware/lib/python2.7/site-packages/boto/pyami/launch_ami.pytmainJs¾                                              t__main__( RRR%R9R'RRRUt__name__(((sB/opt/freeware/lib/python2.7/site-packages/boto/pyami/launch_ami.pyts     )  f