This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: import boto | |
In [2]: c = boto.connect_s3() | |
In [3]: b = c.lookup('test-1245812163') | |
In [4]: mp = b.initiate_multipart_upload('testmpupload2') | |
In [5]: mp | |
Out[5]: <MultiPartUpload testmpupload2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: import boto | |
In [2]: c = boto.connect_s3() | |
In [3]: b = c.lookup('test-1245812163') | |
In [4]: for mp in b.list_multipart_uploads(): | |
...: print mp.key_name | |
...: | |
testmpupload1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generates the aws canonical string for the given parameters | |
def canonical_string(method, path, headers, expires=None, | |
provider=None): | |
if not provider: | |
provider = boto.provider.get_default() | |
interesting_headers = {} | |
for key in headers: | |
lk = key.lower() | |
if headers[key] != None and (lk in ['content-md5', 'content-type', 'date'] or | |
lk.startswith(provider.header_prefix)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This software code is made available "AS IS" without warranties of any | |
# kind. You may copy, display, modify and redistribute the software | |
# code either by itself or as incorporated into your code; provided that | |
# you do not remove any proprietary notices. Your use of this software | |
# code is at your own risk and you waive any claim against Amazon | |
# Digital Services, Inc. or its affiliates with respect to your use of | |
# this software code. (c) 2006 Amazon Digital Services, Inc. or its | |
# affiliates. | |
# generates the aws canonical string for the given parameters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import boto | |
from boto.s3.connection import Location | |
# | |
# create a couple of strings with our very minimal web content | |
# | |
index_html = """ | |
<html> | |
<head><title>My S3 Webpage</title></head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Credentials] | |
aws_access_key_id = <my aws access key> | |
aws_secret_access_key = <my aws secret key> | |
gs_access_key_id=<my Google Storage access key> | |
gs_secret_access_key=<my Google Storage secret key> | |
euca_access_key_id=<my Eucalyptus ECC access key> | |
euca_secret_access_key=<my Eucalyptus ECC secret key> | |
ia_access_key_id=<my Internet Archive access key> | |
ia_secret_access_key=<my Internet Archive secret key> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto | |
# this example assumes that you have not added the AI credentials to your boto config file | |
ia = boto.connect_ia('<ia_access_key_id>', '<ia_secret_access_key') | |
stats = ia.lookup('stats') | |
for key in stats: | |
print key.name, key.size | |
# or, if you have already added the IA credentials to your boto file you can do this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto.ec2 | |
import os, time | |
# define region_name to be region you want to connect to | |
region_name = 'eu-west-1' | |
conn = boto.ec2.connect_to_region(region_name) | |
# First upload a public key to use for SSH'ing to instance. Use "ssh-keygen" to generate. | |
fp = open(os.path.expanduser('~/.ssh/mykey.pub')) | |
material = fp.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assumes that https://gist.github.com/978465 has already been run. Not stand-alone | |
# grab an Elastic IP address | |
address = conn.allocate_address() | |
# now associate with my instance | |
instance.use_ip(address) | |
# now turn on monitoring | |
instance.monitor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import boto.sdb | |
>>> boto.sdb.regions() | |
[RegionInfo:us-east-1, RegionInfo:eu-west-1, RegionInfo:us-west-1, RegionInfo:ap-northeast-1, RegionInfo:ap-southeast-1] | |
>>> eu = _[1] | |
>>> eu | |
RegionInfo:eu-west-1 | |
>>> c = eu.connect() | |
>>> c | |
SDBConnection:sdb.eu-west-1.amazonaws.com | |
>>> c.get_all_domains() |