awsfabrictasks uses a settings system similar to the Django settings module. You add your settings to awsfab_settings.py.
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/.
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).
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).
# 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'
}
###########################################################
# Configuration for ec2_launch_instance
###########################################################
EC2_LAUNCH_CONFIGS = {
'ubuntu-10.04-lts-micro': {
# 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'
}
}
}
######################################################
# Add your own settings here
######################################################
MYCOOLSTUFF_REMOTE_DIR = '/var/www/stuff'
The AWS access key. Should look something like this:
AUTH = {'aws_access_key_id': 'XXXXXXXXXXXXXXXXX',
'aws_secret_access_key': 'aaaaaaaaaaaa\BBBBBBBBB\dsaddad'}
The default AWS region to use with the commands where REGION is supported.
Default ssh user if the awsfab-ssh-user tag is not set
Configuration for ec2_launch_instance (see the docs)
Extra SSH arguments. Used with ssh and rsync.
Directories to search for “<key_name>.pem”. These paths are filtered through os.path.expanduser, so paths like ~/.ssh/ works.