~jk0/nova/xs-ipv6

« back to all changes in this revision

Viewing changes to vendor/boto/docs/source/vpc_tut.rst

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.. _vpc_tut:
 
2
 
 
3
=======================================
 
4
An Introduction to boto's VPC interface
 
5
=======================================
 
6
 
 
7
This tutorial is based on the examples in the Amazon Virtual Private
 
8
Cloud Getting Started Guide (http://docs.amazonwebservices.com/AmazonVPC/latest/GettingStartedGuide/).
 
9
In each example, it tries to show the boto request that correspond to
 
10
the AWS command line tools.
 
11
 
 
12
Creating a VPC connection
 
13
-------------------------
 
14
First, we need to create a new VPC connection:
 
15
 
 
16
>>> from boto.vpc import VPCConnection
 
17
>>> c = VPCConnection()
 
18
 
 
19
To create a VPC
 
20
---------------
 
21
Now that we have a VPC connection, we can create our first VPC.
 
22
 
 
23
>>> vpc = c.create_vpc('10.0.0.0/24')
 
24
>>> vpc
 
25
VPC:vpc-6b1fe402
 
26
>>> vpc.id
 
27
u'vpc-6b1fe402'
 
28
>>> vpc.state
 
29
u'pending'
 
30
>>> vpc.cidr_block
 
31
u'10.0.0.0/24'
 
32
>>> vpc.dhcp_options_id
 
33
u'default'
 
34
>>> 
 
35
 
 
36
To create a subnet
 
37
------------------
 
38
The next step is to create a subnet to associate with your VPC.
 
39
 
 
40
>>> subnet = c.create_subnet(vpc.id, '10.0.0.0/25')
 
41
>>> subnet.id
 
42
u'subnet-6a1fe403'
 
43
>>> subnet.state
 
44
u'pending'
 
45
>>> subnet.cidr_block
 
46
u'10.0.0.0/25'
 
47
>>> subnet.available_ip_address_count
 
48
123
 
49
>>> subnet.availability_zone
 
50
u'us-east-1b'
 
51
>>> 
 
52
 
 
53
To create a customer gateway
 
54
----------------------------
 
55
Next, we create a customer gateway.
 
56
 
 
57
>>> cg = c.create_customer_gateway('ipsec.1', '12.1.2.3', 65534)
 
58
>>> cg.id
 
59
u'cgw-b6a247df'
 
60
>>> cg.type
 
61
u'ipsec.1'
 
62
>>> cg.state
 
63
u'available'
 
64
>>> cg.ip_address
 
65
u'12.1.2.3'
 
66
>>> cg.bgp_asn
 
67
u'65534'
 
68
>>> 
 
69
 
 
70
To create a VPN gateway
 
71
-----------------------
 
72
 
 
73
>>> vg = c.create_vpn_gateway('ipsec.1')
 
74
>>> vg.id
 
75
u'vgw-44ad482d'
 
76
>>> vg.type
 
77
u'ipsec.1'
 
78
>>> vg.state
 
79
u'pending'
 
80
>>> vg.availability_zone
 
81
u'us-east-1b'
 
82
>>>
 
83
 
 
84
Attaching a VPN Gateway to a VPC
 
85
--------------------------------
 
86
 
 
87
>>> vg.attach(vpc.id)
 
88
>>>