Note

You are viewing the documentation for an older version of boto (boto2).

Boto3, the next version of Boto, is now stable and recommended for general use. It can be used side-by-side with Boto in the same project, so it is easy to start using Boto3 in your existing projects as well as new projects. Going forward, API updates and all new feature work will be focused on Boto3.

For more information, see the documentation for boto3.

pyami

boto.pyami

boto.pyami.bootstrap

class boto.pyami.bootstrap.Bootstrap

The Bootstrap class is instantiated and run as part of the PyAMI instance initialization process. The methods in this class will be run from the rc.local script of the instance and will be run as the root user.

The main purpose of this class is to make sure the boto distribution on the instance is the one required.

create_working_dir()
fetch_s3_file(s3_file)
load_boto()
load_packages()
main()
write_metadata()

boto.pyami.config

class boto.pyami.config.Config(path=None, fp=None, do_load=True)
dump()
dump_safe(fp=None)
dump_to_sdb(domain_name, item_name)
get(section, name, default=None)
get_instance(name, default=None)
get_user(name, default=None)
get_value(section, name, default=None)
getbool(section, name, default=False)
getfloat(section, name, default=0.0)
getint(section, name, default=0)
getint_user(name, default=0)
has_option(*args, **kwargs)
load_credential_file(path)

Load a credential file as is setup like the Java utilities

load_from_path(path)
load_from_sdb(domain_name, item_name)
save_option(path, section, option, value)

Write the specified Section.Option to the config file specified by path. Replace any previous value. If the path doesn’t exist, create it. Also add the option the the in-memory config.

save_system_option(section, option, value)
save_user_option(section, option, value)
setbool(section, name, value)

boto.pyami.copybot

class boto.pyami.copybot.CopyBot
copy_bucket_acl()
copy_key_acl(src, dst)
copy_keys()
copy_log()
main()

boto.pyami.installers

class boto.pyami.installers.Installer(config_file=None)

Abstract base class for installers

add_cron(name, minute, hour, mday, month, wday, who, command, env=None)

Add an entry to the system crontab.

add_env(key, value)

Add an environemnt variable

add_init_script(file)

Add this file to the init.d directory

install()

Do whatever is necessary to “install” the package.

start(service_name)

Start a service.

stop(service_name)

Stop a service.

boto.pyami.installers.ubuntu

boto.pyami.installers.ubuntu.apache

class boto.pyami.installers.ubuntu.apache.Apache(config_file=None)

Install apache2, mod_python, and libapache2-svn

install()
main()

boto.pyami.installers.ubuntu.ebs

boto.pyami.installers.ubuntu.installer

class boto.pyami.installers.ubuntu.installer.Installer(config_file=None)

Base Installer class for Ubuntu-based AMI’s

add_cron(name, command, minute='*', hour='*', mday='*', month='*', wday='*', who='root', env=None)
Write a file to /etc/cron.d to schedule a command
env is a dict containing environment variables you want to set in the file name will be used as the name of the file
add_env(key, value)

Add an environemnt variable For Ubuntu, the best place is /etc/environment. Values placed here do not need to be exported.

add_init_script(file, name)

Add this file to the init.d directory

create_user(user)

Create a user on the local system

install()

This is the only method you need to override

start(service_name)
stop(service_name)

boto.pyami.installers.ubuntu.mysql

This installer will install mysql-server on an Ubuntu machine. In addition to the normal installation done by apt-get, it will also configure the new MySQL server to store it’s data files in a different location. By default, this is /mnt but that can be configured in the [MySQL] section of the boto config file passed to the instance.

class boto.pyami.installers.ubuntu.mysql.MySQL(config_file=None)
change_data_dir(password=None)
install()
main()

boto.pyami.installers.ubuntu.trac

class boto.pyami.installers.ubuntu.trac.Trac(config_file=None)

Install Trac and DAV-SVN Sets up a Vhost pointing to [Trac]->home Using the config parameter [Trac]->hostname Sets up a trac environment for every directory found under [Trac]->data_dir

[Trac] name = My Foo Server hostname = trac.foo.com home = /mnt/sites/trac data_dir = /mnt/trac svn_dir = /mnt/subversion server_admin = root@foo.com sdb_auth_domain = users # Optional SSLCertificateFile = /mnt/ssl/foo.crt SSLCertificateKeyFile = /mnt/ssl/foo.key SSLCertificateChainFile = /mnt/ssl/FooCA.crt

install()
main()
setup_vhost()

boto.pyami.launch_ami

boto.pyami.launch_ami.main()
boto.pyami.launch_ami.usage()

boto.pyami.scriptbase

class boto.pyami.scriptbase.ScriptBase(config_file=None)
main()
mkdir(path)
notify(subject, body='')
run(command, notify=True, exit_on_error=False, cwd=None)
umount(path)

boto.pyami.startup

class boto.pyami.startup.Startup(config_file=None)
main()
run_scripts()