7
A Crash Course in CloudFront in Boto
8
------------------------------------
10
This new boto module provides an interface to Amazon's new Content Service, CloudFront.
14
This module is not well tested. Paging of distributions is not yet
15
supported. CNAME support is completely untested. Use with caution.
16
Feedback and bug reports are greatly appreciated.
18
The following shows the main features of the cloudfront module from an interactive shell:
20
Create an cloudfront connection:
22
>>> from boto.cloudfront import CloudFrontConnection
23
>>> c = CloudFrontConnection()
25
Create a new :class:`boto.cloudfront.distribution.Distribution`:
27
>>> distro = c.create_distribution(origin='mybucket.s3.amazonaws.com', enabled=False, comment='My new Distribution')
29
u'd2oxf3980lnb8l.cloudfront.net'
35
u'My new distribution'
37
u'mybucket.s3.amazonaws.com'
38
>>> d.config.caller_reference
39
u'31b8d9cf-a623-4a28-b062-a91856fac6d0'
43
Note that a new caller reference is created automatically, using
44
uuid.uuid4(). The :class:`boto.cloudfront.distribution.Distribution`, :class:`boto.cloudfront.distribution.DistributionConfig` and
45
:class:`boto.cloudfront.distribution.DistributionSummary` objects are defined in the :mod:`boto.cloudfront.distribution`
48
To get a listing of all current distributions:
50
>>> rs = c.get_all_distributions()
52
[<boto.cloudfront.distribution.DistributionSummary instance at 0xe8d4e0>,
53
<boto.cloudfront.distribution.DistributionSummary instance at 0xe8d788>]
55
This returns a list of :class:`boto.cloudfront.distribution.DistributionSummary` objects. Note that paging
56
is not yet supported! To get a :class:`boto.cloudfront.distribution.DistributionObject` from a
57
:class:`boto.cloudfront.distribution.DistributionSummary` object:
60
>>> distro = ds.get_distribution()
61
>>> distro.domain_name
62
u'd2oxf3980lnb8l.cloudfront.net'
64
To change a property of a distribution object:
67
u'My new distribution'
68
>>> distro.update(comment='This is a much better comment')
70
'This is a much better comment'
72
You can also enable/disable a distribution using the following
75
>>> distro.enable() # just calls distro.update(enabled=True)
79
>>> distro.disable() # just calls distro.update(enabled=False)
81
The only attributes that can be updated for a Distribution are
82
comment, enabled and cnames.
84
To delete a :class:`boto.cloudfront.distribution.Distribution`:
92
.. automodule:: boto.cloudfront
96
boto.cloudfront.distribution
97
----------------------------
99
.. automodule:: boto.cloudfront.distribution
103
boto.cloudfront.exception
104
-------------------------
106
.. automodule:: boto.cloudfront.exception
b'\\ No newline at end of file'