cdocutils.nodes document q)q}q(U nametypesq}q(X"working with launch configurationsqNXec2_tutqXcreating a connectionqNX#checking health status of instancesq NX#checking what instances are runningq NXterminating instancesq NX'an introduction to boto's ec2 interfaceq NX!using elastic block storage (ebs)q NXstopping instancesqNX ebs basicsqNXlaunching instancesqNXworking with snapshotsqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU"working-with-launch-configurationsqhUec2-tutqhUcreating-a-connectionqh U#checking-health-status-of-instancesqh U#checking-what-instances-are-runningqh Uterminating-instancesq h U'an-introduction-to-boto-s-ec2-interfaceq!h Uusing-elastic-block-storage-ebsq"hUstopping-instancesq#hU ebs-basicsq$hUlaunching-instancesq%hUworking-with-snapshotsq&uUchildrenq']q((cdocutils.nodes target q))q*}q+(U rawsourceq,X .. _ec2_tut:Uparentq-hUsourceq.X=/Users/kyleknap/Documents/GitHub/boto/docs/source/ec2_tut.rstq/Utagnameq0Utargetq1U attributesq2}q3(Uidsq4]Ubackrefsq5]Udupnamesq6]Uclassesq7]Unamesq8]Urefidq9huUlineq:KUdocumentq;hh']ubcdocutils.nodes section q<)q=}q>(h,Uh-hh.h/Uexpect_referenced_by_nameq?}q@hh*sh0UsectionqAh2}qB(h6]h7]h5]h4]qC(h!heh8]qD(h heuh:Kh;hUexpect_referenced_by_idqE}qFhh*sh']qG(cdocutils.nodes title qH)qI}qJ(h,X'An Introduction to boto's EC2 interfaceqKh-h=h.h/h0UtitleqLh2}qM(h6]h7]h5]h4]h8]uh:Kh;hh']qNcdocutils.nodes Text qOX'An Introduction to boto's EC2 interfaceqPqQ}qR(h,hKh-hIubaubcdocutils.nodes paragraph qS)qT}qU(h,XThis tutorial focuses on the boto interface to the Elastic Compute Cloud from Amazon Web Services. This tutorial assumes that you have already downloaded and installed boto.qVh-h=h.h/h0U paragraphqWh2}qX(h6]h7]h5]h4]h8]uh:Kh;hh']qYhOXThis tutorial focuses on the boto interface to the Elastic Compute Cloud from Amazon Web Services. This tutorial assumes that you have already downloaded and installed boto.qZq[}q\(h,hVh-hTubaubh<)q]}q^(h,Uh-h=h.h/h0hAh2}q_(h6]h7]h5]h4]q`hah8]qahauh:K h;hh']qb(hH)qc}qd(h,XCreating a Connectionqeh-h]h.h/h0hLh2}qf(h6]h7]h5]h4]h8]uh:K h;hh']qghOXCreating a Connectionqhqi}qj(h,heh-hcubaubhS)qk}ql(h,XxThe first step in accessing EC2 is to create a connection to the service. The recommended way of doing this in boto is::h-h]h.h/h0hWh2}qm(h6]h7]h5]h4]h8]uh:Kh;hh']qnhOXwThe first step in accessing EC2 is to create a connection to the service. The recommended way of doing this in boto is:qoqp}qq(h,XwThe first step in accessing EC2 is to create a connection to the service. The recommended way of doing this in boto is:h-hkubaubcdocutils.nodes literal_block qr)qs}qt(h,X>>> import boto.ec2 >>> conn = boto.ec2.connect_to_region("us-west-2", ... aws_access_key_id='', ... aws_secret_access_key='')h-h]h.h/h0U literal_blockquh2}qv(U xml:spaceqwUpreserveqxh4]h5]h6]h7]h8]uh:Kh;hh']qyhOX>>> import boto.ec2 >>> conn = boto.ec2.connect_to_region("us-west-2", ... aws_access_key_id='', ... aws_secret_access_key='')qzq{}q|(h,Uh-hsubaubhS)q}}q~(h,X'At this point the variable ``conn`` will point to an EC2Connection object. In this example, the AWS access key and AWS secret key are passed in to the method explicitly. Alternatively, you can set the boto config environment variables and then simply specify which region you want as follows::h-h]h.h/h0hWh2}q(h6]h7]h5]h4]h8]uh:Kh;hh']q(hOXAt this point the variable qq}q(h,XAt this point the variable h-h}ubcdocutils.nodes literal q)q}q(h,X``conn``h2}q(h6]h7]h5]h4]h8]uh-h}h']qhOXconnqq}q(h,Uh-hubah0UliteralqubhOX will point to an EC2Connection object. In this example, the AWS access key and AWS secret key are passed in to the method explicitly. Alternatively, you can set the boto config environment variables and then simply specify which region you want as follows:qq}q(h,X will point to an EC2Connection object. In this example, the AWS access key and AWS secret key are passed in to the method explicitly. Alternatively, you can set the boto config environment variables and then simply specify which region you want as follows:h-h}ubeubhr)q}q(h,X2>>> conn = boto.ec2.connect_to_region("us-west-2")h-h]h.h/h0huh2}q(hwhxh4]h5]h6]h7]h8]uh:Kh;hh']qhOX2>>> conn = boto.ec2.connect_to_region("us-west-2")qq}q(h,Uh-hubaubhS)q}q(h,XwIn either case, conn will point to an EC2Connection object which we will use throughout the remainder of this tutorial.qh-h]h.h/h0hWh2}q(h6]h7]h5]h4]h8]uh:Kh;hh']qhOXwIn either case, conn will point to an EC2Connection object which we will use throughout the remainder of this tutorial.qq}q(h,hh-hubaubeubh<)q}q(h,Uh-h=h.h/h0hAh2}q(h6]h7]h5]h4]qh%ah8]qhauh:K!h;hh']q(hH)q}q(h,XLaunching Instancesqh-hh.h/h0hLh2}q(h6]h7]h5]h4]h8]uh:K!h;hh']qhOXLaunching Instancesqq}q(h,hh-hubaubhS)q}q(h,XPossibly, the most important and common task you'll use EC2 for is to launch, stop and terminate instances. In its most primitive form, you can launch an instance as follows::h-hh.h/h0hWh2}q(h6]h7]h5]h4]h8]uh:K#h;hh']qhOXPossibly, the most important and common task you'll use EC2 for is to launch, stop and terminate instances. In its most primitive form, you can launch an instance as follows:qq}q(h,XPossibly, the most important and common task you'll use EC2 for is to launch, stop and terminate instances. In its most primitive form, you can launch an instance as follows:h-hubaubhr)q}q(h,X(>>> conn.run_instances('')h-hh.h/h0huh2}q(hwhxh4]h5]h6]h7]h8]uh:K'h;hh']qhOX(>>> conn.run_instances('')qq}q(h,Uh-hubaubhS)q}q(h,XThis will launch an instance in the specified region with the default parameters. You will not be able to SSH into this machine, as it doesn't have a security group set. See :doc:`security_groups` for details on creating one.h-hh.h/h0hWh2}q(h6]h7]h5]h4]h8]uh:K)h;hh']q(hOXThis will launch an instance in the specified region with the default parameters. You will not be able to SSH into this machine, as it doesn't have a security group set. See qq}q(h,XThis will launch an instance in the specified region with the default parameters. You will not be able to SSH into this machine, as it doesn't have a security group set. See h-hubcsphinx.addnodes pending_xref q)q}q(h,X:doc:`security_groups`qh-hh.h/h0U pending_xrefqh2}q(UreftypeXdocqUrefwarnqɈU reftargetqXsecurity_groupsU refdomainUh4]h5]U refexplicith6]h7]h8]UrefdocqXec2_tutquh:K)h']qh)q}q(h,hh2}q(h6]h7]q(Uxrefqheh5]h4]h8]uh-hh']qhOXsecurity_groupsqԅq}q(h,Uh-hubah0hubaubhOX for details on creating one.qׅq}q(h,X for details on creating one.h-hubeubhS)q}q(h,XNow, let's say that you already have a key pair, want a specific type of instance, and you have your :doc:`security group ` all setup. In this case we can use the keyword arguments to accomplish that::h-hh.h/h0hWh2}q(h6]h7]h5]h4]h8]uh:K-h;hh']q(hOXeNow, let's say that you already have a key pair, want a specific type of instance, and you have your qޅq}q(h,XeNow, let's say that you already have a key pair, want a specific type of instance, and you have your h-hubh)q}q(h,X':doc:`security group `qh-hh.h/h0hh2}q(UreftypeXdocqhɈhXsecurity_groupsU refdomainUh4]h5]U refexplicith6]h7]h8]hhuh:K-h']qh)q}q(h,hh2}q(h6]h7]q(hheh5]h4]h8]uh-hh']qhOXsecurity groupq셁q}q(h,Uh-hubah0hubaubhOXM all setup. In this case we can use the keyword arguments to accomplish that:qq}q(h,XM all setup. In this case we can use the keyword arguments to accomplish that:h-hubeubhr)q}q(h,X>>> conn.run_instances( '', key_name='myKey', instance_type='c1.xlarge', security_groups=['your-security-group-here'])h-hh.h/h0huh2}q(hwhxh4]h5]h6]h7]h8]uh:K1h;hh']qhOX>>> conn.run_instances( '', key_name='myKey', instance_type='c1.xlarge', security_groups=['your-security-group-here'])qq}q(h,Uh-hubaubhS)q}q(h,XkThe main caveat with the above call is that it is possible to request an instance type that is not compatible with the provided AMI (for example, the instance was created for a 64-bit instance and you choose a m1.small instance_type). For more details on the plethora of possible keyword parameters, be sure to check out boto's :doc:`EC2 API reference `.h-hh.h/h0hWh2}q(h6]h7]h5]h4]h8]uh:K7h;hh']q(hOXHThe main caveat with the above call is that it is possible to request an instance type that is not compatible with the provided AMI (for example, the instance was created for a 64-bit instance and you choose a m1.small instance_type). For more details on the plethora of possible keyword parameters, be sure to check out boto's qq}q(h,XHThe main caveat with the above call is that it is possible to request an instance type that is not compatible with the provided AMI (for example, the instance was created for a 64-bit instance and you choose a m1.small instance_type). For more details on the plethora of possible keyword parameters, be sure to check out boto's h-hubh)r}r(h,X":doc:`EC2 API reference `rh-hh.h/h0hh2}r(UreftypeXdocrhɈhXref/ec2U refdomainUh4]h5]U refexplicith6]h7]h8]hhuh:K7h']rh)r}r(h,jh2}r(h6]h7]r (hjeh5]h4]h8]uh-jh']r hOXEC2 API referencer r }r (h,Uh-jubah0hubaubhOX.r}r(h,X.h-hubeubeubh<)r}r(h,Uh-h=h.h/h0hAh2}r(h6]h7]h5]h4]rh#ah8]rhauh:K>h;hh']r(hH)r}r(h,XStopping Instancesrh-jh.h/h0hLh2}r(h6]h7]h5]h4]h8]uh:K>h;hh']rhOXStopping Instancesrr}r(h,jh-jubaubhS)r}r(h,XyOnce you have your instances up and running, you might wish to shut them down if they're not in use. Please note that this will only de-allocate virtual hardware resources (as well as instance store drives), but won't destroy your EBS volumes -- this means you'll pay nominal provisioned EBS storage fees even if your instance is stopped. To do this, you can do so as follows::h-jh.h/h0hWh2}r (h6]h7]h5]h4]h8]uh:K?h;hh']r!hOXxOnce you have your instances up and running, you might wish to shut them down if they're not in use. Please note that this will only de-allocate virtual hardware resources (as well as instance store drives), but won't destroy your EBS volumes -- this means you'll pay nominal provisioned EBS storage fees even if your instance is stopped. To do this, you can do so as follows:r"r#}r$(h,XxOnce you have your instances up and running, you might wish to shut them down if they're not in use. Please note that this will only de-allocate virtual hardware resources (as well as instance store drives), but won't destroy your EBS volumes -- this means you'll pay nominal provisioned EBS storage fees even if your instance is stopped. To do this, you can do so as follows:h-jubaubhr)r%}r&(h,XL>>> conn.stop_instances(instance_ids=['instance-id-1','instance-id-2', ...])h-jh.h/h0huh2}r'(hwhxh4]h5]h6]h7]h8]uh:KEh;hh']r(hOXL>>> conn.stop_instances(instance_ids=['instance-id-1','instance-id-2', ...])r)r*}r+(h,Uh-j%ubaubhS)r,}r-(h,XThis will request a 'graceful' stop of each of the specified instances. If you wish to request the equivalent of unplugging your instance(s), simply add ``force=True`` keyword argument to the call above. Please note that stop instance is not allowed with Spot instances.h-jh.h/h0hWh2}r.(h6]h7]h5]h4]h8]uh:KGh;hh']r/(hOXThis will request a 'graceful' stop of each of the specified instances. If you wish to request the equivalent of unplugging your instance(s), simply add r0r1}r2(h,XThis will request a 'graceful' stop of each of the specified instances. If you wish to request the equivalent of unplugging your instance(s), simply add h-j,ubh)r3}r4(h,X``force=True``h2}r5(h6]h7]h5]h4]h8]uh-j,h']r6hOX force=Truer7r8}r9(h,Uh-j3ubah0hubhOXg keyword argument to the call above. Please note that stop instance is not allowed with Spot instances.r:r;}r<(h,Xg keyword argument to the call above. Please note that stop instance is not allowed with Spot instances.h-j,ubeubeubh<)r=}r>(h,Uh-h=h.h/h0hAh2}r?(h6]h7]h5]h4]r@h ah8]rAh auh:KMh;hh']rB(hH)rC}rD(h,XTerminating InstancesrEh-j=h.h/h0hLh2}rF(h6]h7]h5]h4]h8]uh:KMh;hh']rGhOXTerminating InstancesrHrI}rJ(h,jEh-jCubaubhS)rK}rL(h,XOnce you are completely done with your instance and wish to surrender both virtual hardware, root EBS volume and all other underlying components you can request instance termination. To do so you can use the call bellow::h-j=h.h/h0hWh2}rM(h6]h7]h5]h4]h8]uh:KNh;hh']rNhOXOnce you are completely done with your instance and wish to surrender both virtual hardware, root EBS volume and all other underlying components you can request instance termination. To do so you can use the call bellow:rOrP}rQ(h,XOnce you are completely done with your instance and wish to surrender both virtual hardware, root EBS volume and all other underlying components you can request instance termination. To do so you can use the call bellow:h-jKubaubhr)rR}rS(h,XQ>>> conn.terminate_instances(instance_ids=['instance-id-1','instance-id-2', ...])h-j=h.h/h0huh2}rT(hwhxh4]h5]h6]h7]h8]uh:KRh;hh']rUhOXQ>>> conn.terminate_instances(instance_ids=['instance-id-1','instance-id-2', ...])rVrW}rX(h,Uh-jRubaubhS)rY}rZ(h,XaPlease use with care since once you request termination for an instance there is no turning back.r[h-j=h.h/h0hWh2}r\(h6]h7]h5]h4]h8]uh:KTh;hh']r]hOXaPlease use with care since once you request termination for an instance there is no turning back.r^r_}r`(h,j[h-jYubaubeubh<)ra}rb(h,Uh-h=h.h/h0hAh2}rc(h6]h7]h5]h4]rdhah8]reh auh:KXh;hh']rf(hH)rg}rh(h,X#Checking What Instances Are Runningrih-jah.h/h0hLh2}rj(h6]h7]h5]h4]h8]uh:KXh;hh']rkhOX#Checking What Instances Are Runningrlrm}rn(h,jih-jgubaubhS)ro}rp(h,XBYou can also get information on your currently running instances::rqh-jah.h/h0hWh2}rr(h6]h7]h5]h4]h8]uh:KYh;hh']rshOXAYou can also get information on your currently running instances:rtru}rv(h,XAYou can also get information on your currently running instances:h-joubaubhr)rw}rx(h,XX>>> reservations = conn.get_all_reservations() >>> reservations [Reservation:r-00000000]h-jah.h/h0huh2}ry(hwhxh4]h5]h6]h7]h8]uh:K[h;hh']rzhOXX>>> reservations = conn.get_all_reservations() >>> reservations [Reservation:r-00000000]r{r|}r}(h,Uh-jwubaubhS)r~}r(h,XyA reservation corresponds to a command to start instances. You can see what instances are associated with a reservation::h-jah.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:K_h;hh']rhOXxA reservation corresponds to a command to start instances. You can see what instances are associated with a reservation:rr}r(h,XxA reservation corresponds to a command to start instances. You can see what instances are associated with a reservation:h-j~ubaubhr)r}r(h,XM>>> instances = reservations[0].instances >>> instances [Instance:i-00000000]h-jah.h/h0huh2}r(hwhxh4]h5]h6]h7]h8]uh:Kbh;hh']rhOXM>>> instances = reservations[0].instances >>> instances [Instance:i-00000000]rr}r(h,Uh-jubaubhS)r}r(h,XOAn instance object allows you get more meta-data available about the instance::rh-jah.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kfh;hh']rhOXNAn instance object allows you get more meta-data available about the instance:rr}r(h,XNAn instance object allows you get more meta-data available about the instance:h-jubaubhr)r}r(h,X[>>> inst = instances[0] >>> inst.instance_type u'c1.xlarge' >>> inst.placement u'us-west-2'h-jah.h/h0huh2}r(hwhxh4]h5]h6]h7]h8]uh:Khh;hh']rhOX[>>> inst = instances[0] >>> inst.instance_type u'c1.xlarge' >>> inst.placement u'us-west-2'rr}r(h,Uh-jubaubhS)r}r(h,XhIn this case, we can see that our instance is a c1.xlarge instance in the `us-west-2` availability zone.h-jah.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Knh;hh']r(hOXJIn this case, we can see that our instance is a c1.xlarge instance in the rr}r(h,XJIn this case, we can see that our instance is a c1.xlarge instance in the h-jubcdocutils.nodes title_reference r)r}r(h,X `us-west-2`h2}r(h6]h7]h5]h4]h8]uh-jh']rhOX us-west-2rr}r(h,Uh-jubah0Utitle_referencerubhOX availability zone.rr}r(h,X availability zone.h-jubeubeubh<)r}r(h,Uh-h=h.h/h0hAh2}r(h6]h7]h5]h4]rhah8]rh auh:Krh;hh']r(hH)r}r(h,X#Checking Health Status Of Instancesrh-jh.h/h0hLh2}r(h6]h7]h5]h4]h8]uh:Krh;hh']rhOX#Checking Health Status Of Instancesrr}r(h,jh-jubaubhS)r}r(h,XVYou can also get the health status of your instances, including any scheduled events::rh-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Ksh;hh']rhOXUYou can also get the health status of your instances, including any scheduled events:rr}r(h,XUYou can also get the health status of your instances, including any scheduled events:h-jubaubhr)r}r(h,XV>>> statuses = conn.get_all_instance_status() >>> statuses [InstanceStatus:i-00000000]h-jh.h/h0huh2}r(hwhxh4]h5]h6]h7]h8]uh:Kuh;hh']rhOXV>>> statuses = conn.get_all_instance_status() >>> statuses [InstanceStatus:i-00000000]rr}r(h,Uh-jubaubhS)r}r(h,XAn instance status object allows you to get information about impaired functionality or scheduled / system maintenance events::h-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kyh;hh']rhOX~An instance status object allows you to get information about impaired functionality or scheduled / system maintenance events:rr}r(h,X~An instance status object allows you to get information about impaired functionality or scheduled / system maintenance events:h-jubaubhr)r}r(h,X|>>> status = statuses[0] >>> status.events [Event:instance-reboot] >>> event = status.events[0] >>> event.description u'Maintenance software update.' >>> event.not_before u'2011-12-11T04:00:00.000Z' >>> event.not_after u'2011-12-11T10:00:00.000Z' >>> status.instance_status Status:ok >>> status.system_status Status:ok >>> status.system_status.details {u'reachability': u'passed'}h-jh.h/h0huh2}r(hwhxh4]h5]h6]h7]h8]uh:K|h;hh']rhOX|>>> status = statuses[0] >>> status.events [Event:instance-reboot] >>> event = status.events[0] >>> event.description u'Maintenance software update.' >>> event.not_before u'2011-12-11T04:00:00.000Z' >>> event.not_after u'2011-12-11T10:00:00.000Z' >>> status.instance_status Status:ok >>> status.system_status Status:ok >>> status.system_status.details {u'reachability': u'passed'}rr}r(h,Uh-jubaubhS)r}r(h,XThis will by default include the health status only for running instances. If you wish to request the health status for all instances, simply add ``include_all_instances=True`` keyword argument to the call above.h-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']r(hOXThis will by default include the health status only for running instances. If you wish to request the health status for all instances, simply add rr}r(h,XThis will by default include the health status only for running instances. If you wish to request the health status for all instances, simply add h-jubh)r}r(h,X``include_all_instances=True``h2}r(h6]h7]h5]h4]h8]uh-jh']rhOXinclude_all_instances=Truerr}r(h,Uh-jubah0hubhOX$ keyword argument to the call above.rr}r(h,X$ keyword argument to the call above.h-jubeubeubeubh<)r}r(h,Uh-hh.h/h0hAh2}r(h6]h7]h5]h4]rh"ah8]rh auh:Kh;hh']r(hH)r}r(h,X!Using Elastic Block Storage (EBS)rh-jh.h/h0hLh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOX!Using Elastic Block Storage (EBS)rr}r(h,jh-jubaubh<)r}r(h,Uh-jh.h/h0hAh2}r(h6]h7]h5]h4]rh$ah8]rhauh:Kh;hh']r(hH)r}r(h,X EBS Basicsrh-jh.h/h0hLh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOX EBS Basicsrr}r(h,jh-jubaubhS)r}r(h,XEBS can be used by EC2 instances for permanent storage. Note that EBS volumes must be in the same availability zone as the EC2 instance you wish to attach it to.rh-jh.h/h0hWh2}r (h6]h7]h5]h4]h8]uh:Kh;hh']r hOXEBS can be used by EC2 instances for permanent storage. Note that EBS volumes must be in the same availability zone as the EC2 instance you wish to attach it to.r r }r (h,jh-jubaubhS)r}r(h,XTo actually create a volume you will need to specify a few details. The following example will create a 50GB EBS in one of the `us-west-2` availability zones::h-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']r(hOXTo actually create a volume you will need to specify a few details. The following example will create a 50GB EBS in one of the rr}r(h,XTo actually create a volume you will need to specify a few details. The following example will create a 50GB EBS in one of the h-jubj)r}r(h,X `us-west-2`h2}r(h6]h7]h5]h4]h8]uh-jh']rhOX us-west-2rr}r(h,Uh-jubah0jubhOX availability zones:rr}r(h,X availability zones:h-jubeubhr)r}r (h,XI>>> vol = conn.create_volume(50, "us-west-2") >>> vol Volume:vol-00000000h-jh.h/h0huh2}r!(hwhxh4]h5]h6]h7]h8]uh:Kh;hh']r"hOXI>>> vol = conn.create_volume(50, "us-west-2") >>> vol Volume:vol-00000000r#r$}r%(h,Uh-jubaubhS)r&}r'(h,X:You can check that the volume is now ready and available::r(h-jh.h/h0hWh2}r)(h6]h7]h5]h4]h8]uh:Kh;hh']r*hOX9You can check that the volume is now ready and available:r+r,}r-(h,X9You can check that the volume is now ready and available:h-j&ubaubhr)r.}r/(h,Xp>>> curr_vol = conn.get_all_volumes([vol.id])[0] >>> curr_vol.status u'available' >>> curr_vol.zone u'us-west-2'h-jh.h/h0huh2}r0(hwhxh4]h5]h6]h7]h8]uh:Kh;hh']r1hOXp>>> curr_vol = conn.get_all_volumes([vol.id])[0] >>> curr_vol.status u'available' >>> curr_vol.zone u'us-west-2'r2r3}r4(h,Uh-j.ubaubhS)r5}r6(h,XkWe can now attach this volume to the EC2 instance we created earlier, making it available as a new device::h-jh.h/h0hWh2}r7(h6]h7]h5]h4]h8]uh:Kh;hh']r8hOXjWe can now attach this volume to the EC2 instance we created earlier, making it available as a new device:r9r:}r;(h,XjWe can now attach this volume to the EC2 instance we created earlier, making it available as a new device:h-j5ubaubhr)r<}r=(h,XA>>> conn.attach_volume (vol.id, inst.id, "/dev/sdx") u'attaching'h-jh.h/h0huh2}r>(hwhxh4]h5]h6]h7]h8]uh:Kh;hh']r?hOXA>>> conn.attach_volume (vol.id, inst.id, "/dev/sdx") u'attaching'r@rA}rB(h,Uh-j<ubaubhS)rC}rD(h,XYou will now have a new volume attached to your instance. Note that with some Linux kernels, `/dev/sdx` may get translated to `/dev/xvdx`. This device can now be used as a normal block device within Linux.h-jh.h/h0hWh2}rE(h6]h7]h5]h4]h8]uh:Kh;hh']rF(hOX]You will now have a new volume attached to your instance. Note that with some Linux kernels, rGrH}rI(h,X]You will now have a new volume attached to your instance. Note that with some Linux kernels, h-jCubj)rJ}rK(h,X `/dev/sdx`h2}rL(h6]h7]h5]h4]h8]uh-jCh']rMhOX/dev/sdxrNrO}rP(h,Uh-jJubah0jubhOX may get translated to rQrR}rS(h,X may get translated to h-jCubj)rT}rU(h,X `/dev/xvdx`h2}rV(h6]h7]h5]h4]h8]uh-jCh']rWhOX /dev/xvdxrXrY}rZ(h,Uh-jTubah0jubhOXD. This device can now be used as a normal block device within Linux.r[r\}r](h,XD. This device can now be used as a normal block device within Linux.h-jCubeubeubh<)r^}r_(h,Uh-jh.h/h0hAh2}r`(h6]h7]h5]h4]rah&ah8]rbhauh:Kh;hh']rc(hH)rd}re(h,XWorking With Snapshotsrfh-j^h.h/h0hLh2}rg(h6]h7]h5]h4]h8]uh:Kh;hh']rhhOXWorking With Snapshotsrirj}rk(h,jfh-jdubaubhS)rl}rm(h,X(Snapshots allow you to make point-in-time snapshots of an EBS volume for future recovery. Snapshots allow you to create incremental backups, and can also be used to instantiate multiple new volumes. Snapshots can also be used to move EBS volumes across availability zones or making backups to S3.rnh-j^h.h/h0hWh2}ro(h6]h7]h5]h4]h8]uh:Kh;hh']rphOX(Snapshots allow you to make point-in-time snapshots of an EBS volume for future recovery. Snapshots allow you to create incremental backups, and can also be used to instantiate multiple new volumes. Snapshots can also be used to move EBS volumes across availability zones or making backups to S3.rqrr}rs(h,jnh-jlubaubhS)rt}ru(h,XCreating a snapshot is easy::rvh-j^h.h/h0hWh2}rw(h6]h7]h5]h4]h8]uh:Kh;hh']rxhOXCreating a snapshot is easy:ryrz}r{(h,XCreating a snapshot is easy:h-jtubaubhr)r|}r}(h,X^>>> snapshot = conn.create_snapshot(vol.id, 'My snapshot') >>> snapshot Snapshot:snap-00000000h-j^h.h/h0huh2}r~(hwhxh4]h5]h6]h7]h8]uh:Kh;hh']rhOX^>>> snapshot = conn.create_snapshot(vol.id, 'My snapshot') >>> snapshot Snapshot:snap-00000000rr}r(h,Uh-j|ubaubhS)r}r(h,XOnce you have a snapshot, you can create a new volume from it. Volumes are created lazily from snapshots, which means you can start using such a volume straight away::h-j^h.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOXOnce you have a snapshot, you can create a new volume from it. Volumes are created lazily from snapshots, which means you can start using such a volume straight away:rr}r(h,XOnce you have a snapshot, you can create a new volume from it. Volumes are created lazily from snapshots, which means you can start using such a volume straight away:h-jubaubhr)r}r(h,Xw>>> new_vol = snapshot.create_volume('us-west-2') >>> conn.attach_volume (new_vol.id, inst.id, "/dev/sdy") u'attaching'h-j^h.h/h0huh2}r(hwhxh4]h5]h6]h7]h8]uh:Kh;hh']rhOXw>>> new_vol = snapshot.create_volume('us-west-2') >>> conn.attach_volume (new_vol.id, inst.id, "/dev/sdy") u'attaching'rr}r(h,Uh-jubaubhS)r}r(h,XAIf you no longer need a snapshot, you can also easily delete it::rh-j^h.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOX@If you no longer need a snapshot, you can also easily delete it:rr}r(h,X@If you no longer need a snapshot, you can also easily delete it:h-jubaubhr)r}r(h,X*>>> conn.delete_snapshot(snapshot.id) Trueh-j^h.h/h0huh2}r(hwhxh4]h5]h6]h7]h8]uh:Kh;hh']rhOX*>>> conn.delete_snapshot(snapshot.id) Truerr}r(h,Uh-jubaubeubh<)r}r(h,Uh-jh.h/h0hAh2}r(h6]h7]h5]h4]rhah8]rhauh:Kh;hh']r(hH)r}r(h,X"Working With Launch Configurationsrh-jh.h/h0hLh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOX"Working With Launch Configurationsrr}r(h,jh-jubaubhS)r}r(h,XLaunch Configurations allow you to create a re-usable set of properties for an instance. These are used with AutoScaling groups to produce consistent repeatable instances sets.rh-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOXLaunch Configurations allow you to create a re-usable set of properties for an instance. These are used with AutoScaling groups to produce consistent repeatable instances sets.rr}r(h,jh-jubaubhS)r}r(h,X(Creating a Launch Configuration is easy:rh-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOX(Creating a Launch Configuration is easy:rr}r(h,jh-jubaubcdocutils.nodes doctest_block r)r}r(h,X>>> conn = boto.connect_autoscale() >>> config = LaunchConfiguration(name='foo', image_id='ami-abcd1234', key_name='foo.pem') >>> conn.create_launch_configuration(config)h-jh.Nh0U doctest_blockrh2}r(hwhxh4]h5]h6]h7]h8]uh:Nh;hh']rhOX>>> conn = boto.connect_autoscale() >>> config = LaunchConfiguration(name='foo', image_id='ami-abcd1234', key_name='foo.pem') >>> conn.create_launch_configuration(config)rr}r(h,Uh-jubaubhS)r}r(h,XNOnce you have a launch configuration, you can list you current configurations:rh-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOXNOnce you have a launch configuration, you can list you current configurations:rr}r(h,jh-jubaubj)r}r(h,Xb>>> conn = boto.connect_autoscale() >>> config = conn.get_all_launch_configurations(names=['foo'])h-jh.Nh0jh2}r(hwhxh4]h5]h6]h7]h8]uh:Nh;hh']rhOXb>>> conn = boto.connect_autoscale() >>> config = conn.get_all_launch_configurations(names=['foo'])rr}r(h,Uh-jubaubhS)r}r(h,X@If you no longer need a launch configuration, you can delete it:rh-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rhOX@If you no longer need a launch configuration, you can delete it:rr}r(h,jh-jubaubj)r}r(h,XO>>> conn = boto.connect_autoscale() >>> conn.delete_launch_configuration('foo')h-jh.Nh0jh2}r(hwhxh4]h5]h6]h7]h8]uh:Nh;hh']rhOXO>>> conn = boto.connect_autoscale() >>> conn.delete_launch_configuration('foo')rr}r(h,Uh-jubaubcsphinx.addnodes versionmodified r)r}r(h,Uh-jh.h/h0Uversionmodifiedrh2}r(UversionrX2.27.0rh4]h5]h6]h7]h8]UtyperXversionchangedruh:Kh;hh']rhS)r}r(h,Uh-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh;hh']rcdocutils.nodes inline r)r}r(h,Uh2}r(h6]h7]rjah5]h4]h8]uh-jh']rhOXChanged in version 2.27.0.rr}r(h,Uh-jubah0Uinlinerubaubaubcdocutils.nodes note r)r}r(h,XIf ``use_block_device_types=True`` is passed to the connection it will deserialize Launch Configurations with Block Device Mappings into a re-usable format with BlockDeviceType objects, similar to how AMIs are deserialized currently. Legacy behavior is to put them into a format that is incompatabile with creating new Launch Configurations. This switch is in place to preserve backwards compatability, but its usage is the preferred format going forward. If you would like to use the new format, you should use something like: >>> conn = boto.connect_autoscale(use_block_device_types=True) >>> config = conn.get_all_launch_configurations(names=['foo'])h-jh.h/h0Unoterh2}r(h6]h7]h5]h4]h8]uh:Nh;hh']r(hS)r}r(h,XIf ``use_block_device_types=True`` is passed to the connection it will deserialize Launch Configurations with Block Device Mappings into a re-usable format with BlockDeviceType objects, similar to how AMIs are deserialized currently. Legacy behavior is to put them into a format that is incompatabile with creating new Launch Configurations. This switch is in place to preserve backwards compatability, but its usage is the preferred format going forward.h-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh']r(hOXIf rr}r (h,XIf h-jubh)r }r (h,X``use_block_device_types=True``h2}r (h6]h7]h5]h4]h8]uh-jh']r hOXuse_block_device_types=Truerr}r(h,Uh-j ubah0hubhOX is passed to the connection it will deserialize Launch Configurations with Block Device Mappings into a re-usable format with BlockDeviceType objects, similar to how AMIs are deserialized currently. Legacy behavior is to put them into a format that is incompatabile with creating new Launch Configurations. This switch is in place to preserve backwards compatability, but its usage is the preferred format going forward.rr}r(h,X is passed to the connection it will deserialize Launch Configurations with Block Device Mappings into a re-usable format with BlockDeviceType objects, similar to how AMIs are deserialized currently. Legacy behavior is to put them into a format that is incompatabile with creating new Launch Configurations. This switch is in place to preserve backwards compatability, but its usage is the preferred format going forward.h-jubeubhS)r}r(h,XGIf you would like to use the new format, you should use something like:rh-jh.h/h0hWh2}r(h6]h7]h5]h4]h8]uh:Kh']rhOXGIf you would like to use the new format, you should use something like:rr}r(h,jh-jubaubj)r}r(h,X}>>> conn = boto.connect_autoscale(use_block_device_types=True) >>> config = conn.get_all_launch_configurations(names=['foo'])h-jh.Nh0jh2}r(hwhxh4]h5]h6]h7]h8]uh:Nh;hh']rhOX}>>> conn = boto.connect_autoscale(use_block_device_types=True) >>> config = conn.get_all_launch_configurations(names=['foo'])r r!}r"(h,Uh-jubaubeubeubeubeh,UU transformerr#NU footnote_refsr$}r%Urefnamesr&}r'Usymbol_footnotesr(]r)Uautofootnote_refsr*]r+Usymbol_footnote_refsr,]r-U citationsr.]r/h;hU current_liner0NUtransform_messagesr1]r2cdocutils.nodes system_message r3)r4}r5(h,Uh2}r6(h6]UlevelKh4]h5]Usourceh/h7]h8]UlineKUtypeUINFOr7uh']r8hS)r9}r:(h,Uh2}r;(h6]h7]h5]h4]h8]uh-j4h']r<hOX-Hyperlink target "ec2-tut" is not referenced.r=r>}r?(h,Uh-j9ubah0hWubah0Usystem_messager@ubaUreporterrANUid_startrBKU autofootnotesrC]rDU citation_refsrE}rFUindirect_targetsrG]rHUsettingsrI(cdocutils.frontend Values rJorK}rL(Ufootnote_backlinksrMKUrecord_dependenciesrNNU rfc_base_urlrOUhttp://tools.ietf.org/html/rPU tracebackrQUpep_referencesrRNUstrip_commentsrSNU toc_backlinksrTUentryrUU language_coderVUenrWU datestamprXNU report_levelrYKU _destinationrZNU halt_levelr[KU strip_classesr\NhLNUerror_encoding_error_handlerr]Ubackslashreplacer^Udebugr_NUembed_stylesheetr`Uoutput_encoding_error_handlerraUstrictrbU sectnum_xformrcKUdump_transformsrdNU docinfo_xformreKUwarning_streamrfNUpep_file_url_templatergUpep-%04drhUexit_status_levelriKUconfigrjNUstrict_visitorrkNUcloak_email_addressesrlUtrim_footnote_reference_spacermUenvrnNUdump_pseudo_xmlroNUexpose_internalsrpNUsectsubtitle_xformrqU source_linkrrNUrfc_referencesrsNUoutput_encodingrtUutf-8ruU source_urlrvNUinput_encodingrwU utf-8-sigrxU_disable_configryNU id_prefixrzUU tab_widthr{KUerror_encodingr|UUTF-8r}U_sourcer~h/Ugettext_compactrU generatorrNUdump_internalsrNU smart_quotesrU pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUlongrUinput_encoding_error_handlerrjbUauto_id_prefixrUidrUdoctitle_xformrUstrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledrU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hjh&j^h"jhjhh=h$jh%hh!h=h#jh j=hjahh]uUsubstitution_namesr}rh0h;h2}r(h6]h4]h5]Usourceh/h7]h8]uU footnotesr]rUrefidsr}rh]rh*asub.