awsfab_settings.py — Settings

Required setup

awsfabrictasks uses a settings system similar to the Django settings module. You add your settings to awsfab_settings.py.

Required configuration

Create a file named awsfab_settings.py, and add your AWS Security credentials:

AUTH = {'aws_access_key_id': 'Access Key ID',
        'aws_secret_access_key': 'Secret Access Key'}

You find these under My account -> Security Credentials on http://aws.amazon.com/.

.pem-key

The .pem-keys (key pairs) for you instances (the ones used for SSH login) must be added to ~/.ssh/ or the current directory. You can change these directories with the awsfab_settings.KEYPAIR_PATH variable (see Default settings).

Local override

You may override settings in awsfab_settings_local.py, which is typically used to store authentication credentials outside your version control system (i.e: with git you would add awsfab_settings_local.py to .gitignore).

Example awsfab_settings.py

# Config file for awsfabrictasks.
#
# This is a Python module, and it is imported just as a regular Python module.
# Every variable with an uppercase-only name is a setting.

AUTH = {'aws_access_key_id': 'XXXXXXXXXXXXXXXXXXXXXX',
        'aws_secret_access_key': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}

DEFAULT_REGION = 'eu-west-1'


##################################################################
# Self documenting map of AMIs
# - You are not required to use this, but it makes it easier to read
#   EC2_LAUNCH_CONFIGS.
##################################################################
ami = {
    'ubuntu-10.04-lts': 'ami-fb665f8f'
}

##################################################################
# Example user_data
# This script will be passed to the new instance at boot
# time and run late in the boot sequence.
# It can be used to do arbitrarily complex setup tasks.
# info: http://ubuntu-smoser.blogspot.co.uk/2010/03/introducing-cloud-inits-cloud-config.html
##################################################################
user_data_example = """#!/bin/sh
echo ========== Hello World: $(date) ==========
echo "I have been up for $(cut -d\  -f 1 < /proc/uptime) sec"
"""


###########################################################
# Configuration for ec2_launch_instance
###########################################################
EC2_LAUNCH_CONFIGS = {
    'ubuntu-10.04-lts-micro': {
        'description': 'Ubuntu 10.04 on the least expensive instance type.',

        # Ami ID (E.g.: ami-fb665f8f)
        'ami': ami['ubuntu-10.04-lts'],

        # One of: m1.small, m1.large, m1.xlarge, c1.medium, c1.xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cc1.4xlarge, t1.micro
        'instance_type': 't1.micro',

        # List of security groups
        'security_groups': ['allowssh'],

        # Use the ``list_regions`` task to see all available regions
        'region': DEFAULT_REGION,

        # The name of the key pair to use for instances (See http://console.aws.amazon.com -> EC2 -> Key Pairs)
        'key_name': 'awstestkey',

        # The availability zone in which to launch the instances. This is
        # automatically prefixed by ``region``.
        'availability_zone': 'b',

        # Tags to add to the instances. You can use the ``ec2_*_tag`` tasks or
        # the management interface to manage tags. Special tags:
        #   - Name: Should not be in this dict. It is specified when launching
        #           an instance (needs to be unique for each instance).
        #   - awsfab-ssh-user: The ``awsfab`` tasks use this user to log into your instance.
        'tags': {
            'awsfab-ssh-user': 'ubuntu'
        },
        'user_data': user_data_example
    }
}



######################################################
# Add your own settings here
######################################################

MYCOOLSTUFF_REMOTE_DIR = '/var/www/stuff'

Default settings

awsfabrictasks.default_settings.AUTH = {}

The AWS access key. Should look something like this:

AUTH = {'aws_access_key_id': 'XXXXXXXXXXXXXXXXX',
        'aws_secret_access_key': 'aaaaaaaaaaaa\BBBBBBBBB\dsaddad'}
awsfabrictasks.default_settings.DEFAULT_REGION = 'eu-west-1'

The default AWS region to use with the commands where REGION is supported.

awsfabrictasks.default_settings.EC2_INSTANCE_DEFAULT_SSHUSER = 'root'

Default ssh user if the awsfab-ssh-user tag is not set

awsfabrictasks.default_settings.EC2_LAUNCH_CONFIGS = {}

Configuration for ec2_launch_instance (see the docs)

awsfabrictasks.default_settings.EXTRA_SSH_ARGS = '-o StrictHostKeyChecking=no'

Extra SSH arguments. Used with ssh and rsync.

awsfabrictasks.default_settings.KEYPAIR_PATH = ['.', '~/.ssh/']

Directories to search for “<key_name>.pem”. These paths are filtered through os.path.expanduser, so paths like ~/.ssh/ works.

awsfabrictasks.default_settings.S3_BUCKET_PATTERN = '{bucketname}'

S3 bucket suffix. This is used for all tasks taking bucketname as parameter. The actual bucketname used become:

S3_BUCKET_PATTERN.format(bucketname=bucketname)

This is typically used to add your domain name or company name to all bucket names, but avoid having to type the entire name for each task. Examples:

S3_BUCKET_PATTERN = '{bucketname}.example.com'
S3_BUCKET_PATTERN = 'example.com.{bucketname}'

The default, "{bucketname}", uses the bucket name as provided by the user without any changes.

Read the Docs v: 1.1.1
Versions
latest
1.1.1
1.0.14
1.0.13
1.0.8
1.0.6
1.0.5
1.0.4
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.