€cdocutils.nodes document q)q}q(U nametypesq}q(Xconnecting to your new databaseqNX'an introduction to boto's rds interfaceqNXcreating a connectionqNXrds_tutq ˆXcreating a security groupq NXmaking a backupq NXstarting an rds instanceq NuUsubstitution_defsq }qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUconnecting-to-your-new-databaseqhU'an-introduction-to-boto-s-rds-interfaceqhUcreating-a-connectionqh Urds-tutqh Ucreating-a-security-groupqh Umaking-a-backupqh Ustarting-an-rds-instancequUchildrenq]q(cdocutils.nodes target q)q }q!(U rawsourceq"X .. _rds_tut:Uparentq#hUsourceq$X=/Users/kyleknap/Documents/GitHub/boto/docs/source/rds_tut.rstq%Utagnameq&Utargetq'U attributesq(}q)(Uidsq*]Ubackrefsq+]Udupnamesq,]Uclassesq-]Unamesq.]Urefidq/huUlineq0KUdocumentq1hh]ubcdocutils.nodes section q2)q3}q4(h"Uh#hh$h%Uexpect_referenced_by_nameq5}q6h h sh&Usectionq7h(}q8(h,]h-]h+]h*]q9(hheh.]q:(hh euh0Kh1hUexpect_referenced_by_idq;}q)q?}q@(h"X'An Introduction to boto's RDS interfaceqAh#h3h$h%h&UtitleqBh(}qC(h,]h-]h+]h*]h.]uh0Kh1hh]qDcdocutils.nodes Text qEX'An Introduction to boto's RDS interfaceqF…qG}qH(h"hAh#h?ubaubcdocutils.nodes paragraph qI)qJ}qK(h"XèThis tutorial focuses on the boto interface to the Relational Database Service from Amazon Web Services. This tutorial assumes that you have boto already downloaded and installed, and that you wish to setup a MySQL instance in RDS.qLh#h3h$h%h&U paragraphqMh(}qN(h,]h-]h+]h*]h.]uh0Kh1hh]qOhEXèThis tutorial focuses on the boto interface to the Relational Database Service from Amazon Web Services. This tutorial assumes that you have boto already downloaded and installed, and that you wish to setup a MySQL instance in RDS.qP…qQ}qR(h"hLh#hJubaubcdocutils.nodes warning qS)qT}qU(h"XThis tutorial covers the **ORIGINAL** module for RDS. It has since been supplanted by a second major version & an updated API complete with all service operations. The documentation for the new version of boto's support for RDS is at :doc:`RDS v2 `.h#h3h$h%h&UwarningqVh(}qW(h,]h-]h+]h*]h.]uh0Nh1hh]qXhI)qY}qZ(h"XThis tutorial covers the **ORIGINAL** module for RDS. It has since been supplanted by a second major version & an updated API complete with all service operations. The documentation for the new version of boto's support for RDS is at :doc:`RDS v2 `.h#hTh$h%h&hMh(}q[(h,]h-]h+]h*]h.]uh0K h]q\(hEXThis tutorial covers the q]…q^}q_(h"XThis tutorial covers the h#hYubcdocutils.nodes strong q`)qa}qb(h"X **ORIGINAL**h(}qc(h,]h-]h+]h*]h.]uh#hYh]qdhEXORIGINALqe…qf}qg(h"Uh#haubah&UstrongqhubhEXÅ module for RDS. It has since been supplanted by a second major version & an updated API complete with all service operations. The documentation for the new version of boto's support for RDS is at qi…qj}qk(h"XÅ module for RDS. It has since been supplanted by a second major version & an updated API complete with all service operations. The documentation for the new version of boto's support for RDS is at h#hYubcsphinx.addnodes pending_xref ql)qm}qn(h"X:doc:`RDS v2 `qoh#hYh$h%h&U pending_xrefqph(}qq(UreftypeXdocqrUrefwarnqsˆU reftargetqtXref/rds2U refdomainUh*]h+]U refexplicitˆh,]h-]h.]UrefdocquXrds_tutqvuh0K h]qwcdocutils.nodes literal qx)qy}qz(h"hoh(}q{(h,]h-]q|(Uxrefq}hreh+]h*]h.]uh#hmh]q~hEXRDS v2q…q€}q(h"Uh#hyubah&Uliteralq‚ubaubhEX.…qƒ}q„(h"X.h#hYubeubaubh2)q…}q†(h"Uh#h3h$h%h&h7h(}q‡(h,]h-]h+]h*]qˆhah.]q‰hauh0Kh1hh]qŠ(h>)q‹}qŒ(h"XCreating a Connectionqh#h…h$h%h&hBh(}qŽ(h,]h-]h+]h*]h.]uh0Kh1hh]qhEXCreating a Connectionq…q‘}q’(h"hh#h‹ubaubhI)q“}q”(h"X~The first step in accessing RDS is to create a connection to the service. The recommended method of doing this is as follows::h#h…h$h%h&hMh(}q•(h,]h-]h+]h*]h.]uh0Kh1hh]q–hEX}The first step in accessing RDS is to create a connection to the service. The recommended method of doing this is as follows:q—…q˜}q™(h"X}The first step in accessing RDS is to create a connection to the service. The recommended method of doing this is as follows:h#h“ubaubcdocutils.nodes literal_block qš)q›}qœ(h"X¯>>> import boto.rds >>> conn = boto.rds.connect_to_region( ... "us-west-2", ... aws_access_key_id=', ... aws_secret_access_key='')h#h…h$h%h&U literal_blockqh(}qž(U xml:spaceqŸUpreserveq h*]h+]h,]h-]h.]uh0Kh1hh]q¡hEX¯>>> import boto.rds >>> conn = boto.rds.connect_to_region( ... "us-west-2", ... aws_access_key_id=', ... aws_secret_access_key='')q¢…q£}q¤(h"Uh#h›ubaubhI)q¥}q¦(h"X=At this point the variable conn will point to an RDSConnection object in the US-WEST-2 region. Bear in mind that just as any other AWS service, RDS is region-specific. In this example, the AWS access key and AWS secret key are passed in to the method explicitely. Alternatively, you can set the environment variables:q§h#h…h$h%h&hMh(}q¨(h,]h-]h+]h*]h.]uh0Kh1hh]q©hEX=At this point the variable conn will point to an RDSConnection object in the US-WEST-2 region. Bear in mind that just as any other AWS service, RDS is region-specific. In this example, the AWS access key and AWS secret key are passed in to the method explicitely. Alternatively, you can set the environment variables:qª…q«}q¬(h"h§h#h¥ubaubcdocutils.nodes bullet_list q­)q®}q¯(h"Uh#h…h$h%h&U bullet_listq°h(}q±(Ubulletq²X*h*]h+]h,]h-]h.]uh0K%h1hh]q³(cdocutils.nodes list_item q´)qµ}q¶(h"X.``AWS_ACCESS_KEY_ID`` - Your AWS Access Key IDq·h#h®h$h%h&U list_itemq¸h(}q¹(h,]h-]h+]h*]h.]uh0Nh1hh]qºhI)q»}q¼(h"h·h#hµh$h%h&hMh(}q½(h,]h-]h+]h*]h.]uh0K%h]q¾(hx)q¿}qÀ(h"X``AWS_ACCESS_KEY_ID``h(}qÁ(h,]h-]h+]h*]h.]uh#h»h]qÂhEXAWS_ACCESS_KEY_IDqÃ…qÄ}qÅ(h"Uh#h¿ubah&h‚ubhEX - Your AWS Access Key IDqÆ…qÇ}qÈ(h"X - Your AWS Access Key IDh#h»ubeubaubh´)qÉ}qÊ(h"X7``AWS_SECRET_ACCESS_KEY`` - Your AWS Secret Access Key h#h®h$h%h&h¸h(}qË(h,]h-]h+]h*]h.]uh0Nh1hh]qÌhI)qÍ}qÎ(h"X6``AWS_SECRET_ACCESS_KEY`` - Your AWS Secret Access KeyqÏh#hÉh$h%h&hMh(}qÐ(h,]h-]h+]h*]h.]uh0K&h]qÑ(hx)qÒ}qÓ(h"X``AWS_SECRET_ACCESS_KEY``h(}qÔ(h,]h-]h+]h*]h.]uh#hÍh]qÕhEXAWS_SECRET_ACCESS_KEYqÖ…q×}qØ(h"Uh#hÒubah&h‚ubhEX - Your AWS Secret Access KeyqÙ…qÚ}qÛ(h"X - Your AWS Secret Access Keyh#hÍubeubaubeubhI)qÜ}qÝ(h"Xand then simply call::qÞh#h…h$h%h&hMh(}qß(h,]h-]h+]h*]h.]uh0K(h1hh]qàhEXand then simply call:qá…qâ}qã(h"Xand then simply call:h#hÜubaubhš)qä}qå(h"XF>>> import boto.rds >>> conn = boto.rds.connect_to_region("us-west-2")h#h…h$h%h&hh(}qæ(hŸh h*]h+]h,]h-]h.]uh0K*h1hh]qçhEXF>>> import boto.rds >>> conn = boto.rds.connect_to_region("us-west-2")qè…qé}qê(h"Uh#häubaubhI)që}qì(h"XwIn either case, conn will point to an RDSConnection object which we will use throughout the remainder of this tutorial.qíh#h…h$h%h&hMh(}qî(h,]h-]h+]h*]h.]uh0K-h1hh]qïhEXwIn either case, conn will point to an RDSConnection object which we will use throughout the remainder of this tutorial.qð…qñ}qò(h"híh#hëubaubeubh2)qó}qô(h"Uh#h3h$h%h&h7h(}qõ(h,]h-]h+]h*]qöhah.]q÷h auh0K1h1hh]qø(h>)qù}qú(h"XStarting an RDS Instanceqûh#hóh$h%h&hBh(}qü(h,]h-]h+]h*]h.]uh0K1h1hh]qýhEXStarting an RDS Instanceqþ…qÿ}r(h"hûh#hùubaubhI)r}r(h"X:Creating a DB instance is easy. You can do so as follows::rh#hóh$h%h&hMh(}r(h,]h-]h+]h*]h.]uh0K3h1hh]rhEX9Creating a DB instance is easy. You can do so as follows:r…r}r(h"X9Creating a DB instance is easy. You can do so as follows:h#jubaubhš)r }r (h"XT>>> db = conn.create_dbinstance("db-master-1", 10, 'db.m1.small', 'root', 'hunter2')h#hóh$h%h&hh(}r (hŸh h*]h+]h,]h-]h.]uh0K5h1hh]r hEXT>>> db = conn.create_dbinstance("db-master-1", 10, 'db.m1.small', 'root', 'hunter2')r …r}r(h"Uh#j ubaubhI)r}r(h"XÌThis example would create a DB identified as ``db-master-1`` with 10GB of storage. This instance would be running on ``db.m1.small`` type, with the login name being ``root``, and the password ``hunter2``.h#hóh$h%h&hMh(}r(h,]h-]h+]h*]h.]uh0K7h1hh]r(hEX-This example would create a DB identified as r…r}r(h"X-This example would create a DB identified as h#jubhx)r}r(h"X``db-master-1``h(}r(h,]h-]h+]h*]h.]uh#jh]rhEX db-master-1r…r}r(h"Uh#jubah&h‚ubhEX9 with 10GB of storage. This instance would be running on r…r}r (h"X9 with 10GB of storage. This instance would be running on h#jubhx)r!}r"(h"X``db.m1.small``h(}r#(h,]h-]h+]h*]h.]uh#jh]r$hEX db.m1.smallr%…r&}r'(h"Uh#j!ubah&h‚ubhEX! type, with the login name being r(…r)}r*(h"X! type, with the login name being h#jubhx)r+}r,(h"X``root``h(}r-(h,]h-]h+]h*]h.]uh#jh]r.hEXrootr/…r0}r1(h"Uh#j+ubah&h‚ubhEX, and the password r2…r3}r4(h"X, and the password h#jubhx)r5}r6(h"X ``hunter2``h(}r7(h,]h-]h+]h*]h.]uh#jh]r8hEXhunter2r9…r:}r;(h"Uh#j5ubah&h‚ubhEX.…r<}r=(h"X.h#jubeubhI)r>}r?(h"X^To check on the status of your RDS instance, you will have to query the RDS connection again::r@h#hóh$h%h&hMh(}rA(h,]h-]h+]h*]h.]uh0K;h1hh]rBhEX]To check on the status of your RDS instance, you will have to query the RDS connection again:rC…rD}rE(h"X]To check on the status of your RDS instance, you will have to query the RDS connection again:h#j>ubaubhš)rF}rG(h"XÝ>>> instances = conn.get_all_dbinstances("db-master-1") >>> instances [DBInstance:db-master-1] >>> db = instances[0] >>> db.status u'available' >>> db.endpoint (u'db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com', 3306)h#hóh$h%h&hh(}rH(hŸh h*]h+]h,]h-]h.]uh0K=h1hh]rIhEXÝ>>> instances = conn.get_all_dbinstances("db-master-1") >>> instances [DBInstance:db-master-1] >>> db = instances[0] >>> db.status u'available' >>> db.endpoint (u'db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com', 3306)rJ…rK}rL(h"Uh#jFubaubeubh2)rM}rN(h"Uh#h3h$h%h&h7h(}rO(h,]h-]h+]h*]rPhah.]rQh auh0KGh1hh]rR(h>)rS}rT(h"XCreating a Security GrouprUh#jMh$h%h&hBh(}rV(h,]h-]h+]h*]h.]uh0KGh1hh]rWhEXCreating a Security GrouprX…rY}rZ(h"jUh#jSubaubhI)r[}r\(h"XBefore you can actually connect to this RDS service, you must first create a security group. You can add a CIDR range or an :py:class:`EC2 security group ` to your :py:class:`DB security group ` ::h#jMh$h%h&hMh(}r](h,]h-]h+]h*]h.]uh0KIh1hh]r^(hEX|Before you can actually connect to this RDS service, you must first create a security group. You can add a CIDR range or an r_…r`}ra(h"X|Before you can actually connect to this RDS service, you must first create a security group. You can add a CIDR range or an h#j[ubhl)rb}rc(h"XE:py:class:`EC2 security group `rdh#j[h$h%h&hph(}re(UreftypeXclasshs‰htX$boto.ec2.securitygroup.SecurityGroupU refdomainXpyrfh*]h+]U refexplicitˆh,]h-]h.]huhvUpy:classrgNU py:modulerhNuh0KIh]rihx)rj}rk(h"jdh(}rl(h,]h-]rm(h}jfXpy-classrneh+]h*]h.]uh#jbh]rohEXEC2 security grouprp…rq}rr(h"Uh#jjubah&h‚ubaubhEX to your rs…rt}ru(h"X to your h#j[ubhl)rv}rw(h"XH:py:class:`DB security group `rxh#j[h$h%h&hph(}ry(UreftypeXclasshs‰htX(boto.rds.dbsecuritygroup.DBSecurityGroupU refdomainXpyrzh*]h+]U refexplicitˆh,]h-]h.]huhvjgNjhNuh0KIh]r{hx)r|}r}(h"jxh(}r~(h,]h-]r(h}jzXpy-classr€eh+]h*]h.]uh#jvh]rhEXDB security groupr‚…rƒ}r„(h"Uh#j|ubah&h‚ubaubeubhš)r…}r†(h"Xt>>> sg = conn.create_dbsecurity_group('web_servers', 'Web front-ends') >>> sg.authorize(cidr_ip='10.3.2.45/32') Trueh#jMh$h%h&hh(}r‡(hŸh h*]h+]h,]h-]h.]uh0KNh1hh]rˆhEXt>>> sg = conn.create_dbsecurity_group('web_servers', 'Web front-ends') >>> sg.authorize(cidr_ip='10.3.2.45/32') Truer‰…rŠ}r‹(h"Uh#j…ubaubhI)rŒ}r(h"XCYou can then associate this security group with your RDS instance::rŽh#jMh$h%h&hMh(}r(h,]h-]h+]h*]h.]uh0KRh1hh]rhEXBYou can then associate this security group with your RDS instance:r‘…r’}r“(h"XBYou can then associate this security group with your RDS instance:h#jŒubaubhš)r”}r•(h"X#>>> db.modify(security_groups=[sg])h#jMh$h%h&hh(}r–(hŸh h*]h+]h,]h-]h.]uh0KTh1hh]r—hEX#>>> db.modify(security_groups=[sg])r˜…r™}rš(h"Uh#j”ubaubeubh2)r›}rœ(h"Uh#h3h$h%h&h7h(}r(h,]h-]h+]h*]ržhah.]rŸhauh0KXh1hh]r (h>)r¡}r¢(h"XConnecting to your New Databaser£h#j›h$h%h&hBh(}r¤(h,]h-]h+]h*]h.]uh0KXh1hh]r¥hEXConnecting to your New Databaser¦…r§}r¨(h"j£h#j¡ubaubhI)r©}rª(h"XrOnce you have reached this step, you can connect to your RDS instance as you would with any other MySQL instance::h#j›h$h%h&hMh(}r«(h,]h-]h+]h*]h.]uh0KZh1hh]r¬hEXqOnce you have reached this step, you can connect to your RDS instance as you would with any other MySQL instance:r­…r®}r¯(h"XqOnce you have reached this step, you can connect to your RDS instance as you would with any other MySQL instance:h#j©ubaubhš)r°}r±(h"X¥>>> db.endpoint (u'db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com', 3306) % mysql -h db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com -u root -phunter2 mysql>h#j›h$h%h&hh(}r²(hŸh h*]h+]h,]h-]h.]uh0K]h1hh]r³hEX¥>>> db.endpoint (u'db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com', 3306) % mysql -h db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com -u root -phunter2 mysql>r´…rµ}r¶(h"Uh#j°ubaubeubh2)r·}r¸(h"Uh#h3h$h%h&h7h(}r¹(h,]h-]h+]h*]rºhah.]r»h auh0Keh1hh]r¼(h>)r½}r¾(h"XMaking a backupr¿h#j·h$h%h&hBh(}rÀ(h,]h-]h+]h*]h.]uh0Keh1hh]rÁhEXMaking a backuprÂ…rÃ}rÄ(h"j¿h#j½ubaubhI)rÅ}rÆ(h"X<You can also create snapshots of your database very easily::rÇh#j·h$h%h&hMh(}rÈ(h,]h-]h+]h*]h.]uh0Kgh1hh]rÉhEX;You can also create snapshots of your database very easily:rÊ…rË}rÌ(h"X;You can also create snapshots of your database very easily:h#jÅubaubhš)rÍ}rÎ(h"XK>>> db.snapshot('db-master-1-2013-02-05') DBSnapshot:db-master-1-2013-02-05h#j·h$h%h&hh(}rÏ(hŸh h*]h+]h,]h-]h.]uh0Kih1hh]rÐhEXK>>> db.snapshot('db-master-1-2013-02-05') DBSnapshot:db-master-1-2013-02-05rÑ…rÒ}rÓ(h"Uh#jÍubaubhI)rÔ}rÕ(h"XPOnce this snapshot is complete, you can create a new database instance from it::h#j·h$h%h&hMh(}rÖ(h,]h-]h+]h*]h.]uh0Kmh1hh]r×hEXOOnce this snapshot is complete, you can create a new database instance from it:rØ…rÙ}rÚ(h"XOOnce this snapshot is complete, you can create a new database instance from it:h#jÔubaubhš)rÛ}rÜ(h"X•>>> db2 = conn.restore_dbinstance_from_dbsnapshot( ... 'db-master-1-2013-02-05', ... 'db-restored-1', ... 'db.m1.small', ... 'us-west-2')h#j·h$h%h&hh(}rÝ(hŸh h*]h+]h,]h-]h.]uh0Kph1hh]rÞhEX•>>> db2 = conn.restore_dbinstance_from_dbsnapshot( ... 'db-master-1-2013-02-05', ... 'db-restored-1', ... 'db.m1.small', ... 'us-west-2')rß…rà}rá(h"Uh#jÛubaubeubeubeh"UU transformerrâNU footnote_refsrã}räUrefnamesrå}ræUsymbol_footnotesrç]rèUautofootnote_refsré]rêUsymbol_footnote_refsrë]rìU citationsrí]rîh1hU current_linerïNUtransform_messagesrð]rñcdocutils.nodes system_message rò)ró}rô(h"Uh(}rõ(h,]UlevelKh*]h+]Usourceh%h-]h.]UlineKUtypeUINFOröuh]r÷hI)rø}rù(h"Uh(}rú(h,]h-]h+]h*]h.]uh#jóh]rûhEX-Hyperlink target "rds-tut" is not referenced.rü…rý}rþ(h"Uh#jøubah&hMubah&Usystem_messagerÿubaUreporterrNUid_startrKU autofootnotesr]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values r or }r (Ufootnote_backlinksr KUrecord_dependenciesr NU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrˆUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestamprNU report_levelrKU _destinationrNU halt_levelrKU strip_classesrNhBNUerror_encoding_error_handlerrUbackslashreplacerUdebugrNUembed_stylesheetr‰Uoutput_encoding_error_handlerr Ustrictr!U sectnum_xformr"KUdump_transformsr#NU docinfo_xformr$KUwarning_streamr%NUpep_file_url_templater&Upep-%04dr'Uexit_status_levelr(KUconfigr)NUstrict_visitorr*NUcloak_email_addressesr+ˆUtrim_footnote_reference_spacer,‰Uenvr-NUdump_pseudo_xmlr.NUexpose_internalsr/NUsectsubtitle_xformr0‰U source_linkr1NUrfc_referencesr2NUoutput_encodingr3Uutf-8r4U source_urlr5NUinput_encodingr6U utf-8-sigr7U_disable_configr8NU id_prefixr9UU tab_widthr:KUerror_encodingr;UUTF-8r<U_sourcer=h%Ugettext_compactr>ˆU generatorr?NUdump_internalsr@NU smart_quotesrA‰U pep_base_urlrBUhttp://www.python.org/dev/peps/rCUsyntax_highlightrDUlongrEUinput_encoding_error_handlerrFj!Uauto_id_prefixrGUidrHUdoctitle_xformrI‰Ustrip_elements_with_classesrJNU _config_filesrK]Ufile_insertion_enabledrLˆU raw_enabledrMKU dump_settingsrNNubUsymbol_footnote_startrOKUidsrP}rQ(hjMhhóhj·hh3hj›hh3hh…uUsubstitution_namesrR}rSh&h1h(}rT(h,]h*]h+]Usourceh%h-]h.]uU footnotesrU]rVUrefidsrW}rXh]rYh asub.