instances module

Fabric tasks

django_fabfile.instances.create_ami()[source]

Creates AMI image from given snapshot.

Force option removes prompt request and creates new instance from created ami image.

region, snap_id
specify snapshot to be processed. Snapshot description in json format will be used to restore instance with same parameters. Will automaticaly process snapshots for same instance with near time (10 minutes or shorter), but for other devices (/dev/sdb, /dev/sdc, etc);
force
Run instance from ami after creation without confirmation. To enable set value to “RUN”;
default_arch
architecture to use if not mentioned in snapshot description;
default_type
instance type to use if not mentioned in snapshot description. Used only if force is “RUN”;
security_groups
list of AWS Security Groups names formatted as string separated with semicolon ‘;’. Used only if force is “RUN”.
django_fabfile.instances.create_encrypted_instance()[source]

Creates ubuntu instance with luks-encryted root volume.

region_name
Region where you want to create instance;
release
Ubuntu release name (lucid or natty). “lucid” by default;
volume_size
Size of volume in Gb (always remember, that script creates boot volume with size 1Gb, so minimal size of whole volume is 3Gb (1Gb for /boot 2Gb for /)). 8 by default;
architecture
“i386” or “x86_64”.
type
Type of instance. ‘t1.micro’ by default;
name
Name of luks encrypted volume. ‘encr_root’ by default;
pw1, pw2
You can specify passwords in parameters to suppress password prompt;
security_groups
List of AWS Security Groups names formatted as string separated with semicolon ‘;’.

To unlock go to https://ip_address_of_instance (only after reboot or shutdown). You can set up to 8 passwords. Defaut boot.key and boot.crt created for .amazonaws.com so must work for all instances. Process of creation is about 20 minutes long.

django_fabfile.instances.create_instance()[source]

Create AWS EC2 instance.

Return created instance.

region_name
by default will be created in the us-east-1 region;
zone_name
string-formatted name, may be omitted;
key_pair
name of key_pair to be granted access. Will be fetched from config by default, may be configured per region;
security_groups
list of AWS Security Groups names formatted as string separated with semicolon ‘;’;
architecture
“i386” or “x86_64”;
inst_type
by default will be fetched from AMI description or used ‘t1.micro’ if not mentioned in the description.
django_fabfile.instances.launch_instance_from_ami()[source]

Create instance from specified AMI.

region_name
location of the AMI and new instance;
ami_id
“ami-...”
inst_type
by default will be fetched from AMI description or used ‘t1.micro’ if not mentioned in the description;
security_groups
list of AWS Security Groups names formatted as string separated with semicolon ‘;’
key_pair
name of key_pair to be granted access. Will be fetched from config by default, may be configured per region;
zone_name
in string format;
user_data
string with OS configuration commands.
django_fabfile.instances.modify_instance_termination()[source]

Mark production instnaces as uneligible for termination.

region
name of region where instance is located;
instance_id
instance to be updated;

You must change value of preconfigured tag_name and run this command before terminating production instance via API.

django_fabfile.instances.modify_kernel()[source]

Modify old kernel for stopped instance (needed for make pv-grub working)

Note

install grub-legacy-ec2 and upgrades before run this.

region
specify instance region;
instance_id
specify instance id for kernel change
Kernels list:
ap-southeast-1 x86_64 aki-11d5aa43 ap-southeast-1 i386 aki-13d5aa41 eu-west-1 x86_64 aki-4feec43b eu-west-1 i386 aki-4deec439 us-east-1 x86_64 aki-427d952b us-east-1 i386 aki-407d9529 us-west-1 x86_64 aki-9ba0f1de us-west-1 i386 aki-99a0f1dc
django_fabfile.instances.mount_snapshot()[source]

Mount snapshot to temporary created instance or inst_id.

region_name, snap_id
specify snapshot.
inst_id
attach to existing instance. Will be created temporary if None.

Internals

Check Fabric tasks for Django and Amazon Web Services or django_fabfile.utils.Config docstring for setup instructions.

django_fabfile.instances.attach_snapshot(*args, **kwds)[source]

Attach snap to inst or to new temporary instance.

security_groups
list of AWS Security Groups names formatted as string separated with semicolon ‘;’

Yield volume, created from the snap and its mountpoint.

Create temporary instance if inst not provided. Provide access to newly created temporary instance for key_pair and with security_groups.

django_fabfile.instances.create_ami[source]

Creates AMI image from given snapshot.

Force option removes prompt request and creates new instance from created ami image.

region, snap_id
specify snapshot to be processed. Snapshot description in json format will be used to restore instance with same parameters. Will automaticaly process snapshots for same instance with near time (10 minutes or shorter), but for other devices (/dev/sdb, /dev/sdc, etc);
force
Run instance from ami after creation without confirmation. To enable set value to “RUN”;
default_arch
architecture to use if not mentioned in snapshot description;
default_type
instance type to use if not mentioned in snapshot description. Used only if force is “RUN”;
security_groups
list of AWS Security Groups names formatted as string separated with semicolon ‘;’. Used only if force is “RUN”.
django_fabfile.instances.create_and_distribute_ami[source]

Creates AMI image from given snapshot.

Force option removes prompt request and creates new instance from created ami image.

region, snap_id
specify snapshot to be processed. Snapshot description in json format will be used to restore instance with same parameters. Will automaticaly process snapshots for same instance with near time (10 minutes or shorter), but for other devices (/dev/sdb, /dev/sdc, etc);
default_arch
architecture to use if not mentioned in snapshot description;
django_fabfile.instances.create_encrypted_instance[source]

Creates ubuntu instance with luks-encryted root volume.

region_name
Region where you want to create instance;
release
Ubuntu release name (lucid or natty). “lucid” by default;
volume_size
Size of volume in Gb (always remember, that script creates boot volume with size 1Gb, so minimal size of whole volume is 3Gb (1Gb for /boot 2Gb for /)). 8 by default;
architecture
“i386” or “x86_64”.
type
Type of instance. ‘t1.micro’ by default;
name
Name of luks encrypted volume. ‘encr_root’ by default;
pw1, pw2
You can specify passwords in parameters to suppress password prompt;
security_groups
List of AWS Security Groups names formatted as string separated with semicolon ‘;’.

To unlock go to https://ip_address_of_instance (only after reboot or shutdown). You can set up to 8 passwords. Defaut boot.key and boot.crt created for .amazonaws.com so must work for all instances. Process of creation is about 20 minutes long.

django_fabfile.instances.create_instance[source]

Create AWS EC2 instance.

Return created instance.

region_name
by default will be created in the us-east-1 region;
zone_name
string-formatted name, may be omitted;
key_pair
name of key_pair to be granted access. Will be fetched from config by default, may be configured per region;
security_groups
list of AWS Security Groups names formatted as string separated with semicolon ‘;’;
architecture
“i386” or “x86_64”;
inst_type
by default will be fetched from AMI description or used ‘t1.micro’ if not mentioned in the description.
django_fabfile.instances.get_avail_dev(inst)[source]

Return next unused device name.

django_fabfile.instances.get_avail_dev_encr(instance)[source]

Return next unused device name.

django_fabfile.instances.get_vol_dev(vol)[source]

Return OS-specific volume representation as attached device.

django_fabfile.instances.launch_instance_from_ami[source]

Create instance from specified AMI.

region_name
location of the AMI and new instance;
ami_id
“ami-...”
inst_type
by default will be fetched from AMI description or used ‘t1.micro’ if not mentioned in the description;
security_groups
list of AWS Security Groups names formatted as string separated with semicolon ‘;’
key_pair
name of key_pair to be granted access. Will be fetched from config by default, may be configured per region;
zone_name
in string format;
user_data
string with OS configuration commands.
django_fabfile.instances.modify_instance_termination[source]

Mark production instnaces as uneligible for termination.

region
name of region where instance is located;
instance_id
instance to be updated;

You must change value of preconfigured tag_name and run this command before terminating production instance via API.

django_fabfile.instances.modify_kernel[source]

Modify old kernel for stopped instance (needed for make pv-grub working)

Note

install grub-legacy-ec2 and upgrades before run this.

region
specify instance region;
instance_id
specify instance id for kernel change
Kernels list:
ap-southeast-1 x86_64 aki-11d5aa43 ap-southeast-1 i386 aki-13d5aa41 eu-west-1 x86_64 aki-4feec43b eu-west-1 i386 aki-4deec439 us-east-1 x86_64 aki-427d952b us-east-1 i386 aki-407d9529 us-west-1 x86_64 aki-9ba0f1de us-west-1 i386 aki-99a0f1dc
django_fabfile.instances.mount_snapshot[source]

Mount snapshot to temporary created instance or inst_id.

region_name, snap_id
specify snapshot.
inst_id
attach to existing instance. Will be created temporary if None.
django_fabfile.instances.mount_volume(vol, mkfs=False)[source]

Mount the device by SSH. Return mountpoint on success.

vol
volume to be mounted on the instance it is attached to.

Table Of Contents

Previous topic

backup module

Next topic

security_groups module

This Page