Tasks¶
awsfabrictasks.ec2.tasks¶
General tasks for AWS management.
-
awsfabrictasks.ec2.tasks.
ec2_add_tag
[source]¶ Add tag to EC2 instance. Fails if tag already exists.
Parameters: - tagname – Name of the tag to set (required).
- value – Value to set the tag to. Default to empty string.
-
awsfabrictasks.ec2.tasks.
ec2_set_tag
[source]¶ Set tag on EC2 instance. Overwrites value if tag exists.
Parameters: - tagname – Name of the tag to set (required).
- value – Value to set the tag to. Default to empty string.
-
awsfabrictasks.ec2.tasks.
ec2_remove_tag
[source]¶ Remove tag from EC2 instance. Fails if tag does not exist.
Parameters: tagname – Name of the tag to remove (required).
-
awsfabrictasks.ec2.tasks.
ec2_launch_instance
[source]¶ Launch new EC2 instance.
Parameters: - name – The name to tag the EC2 instance with (required)
- configname – Name of the configuration in
awsfab_settings.EC2_LAUNCH_CONFIGS
. Prompts for input if not provided as an argument.
-
awsfabrictasks.ec2.tasks.
ec2_start_instance
[source]¶ Start EC2 instance.
Parameters: nowait – Set to True
to let the EC2 instance start in the background instead of waiting for it to start. Defaults toFalse
.
-
awsfabrictasks.ec2.tasks.
ec2_stop_instance
[source]¶ Stop EC2 instance.
Parameters: nowait – Set to True
to let the EC2 instance stop in the background instead of waiting for it to start. Defaults toFalse
.
-
awsfabrictasks.ec2.tasks.
ec2_list_instances
[source]¶ List EC2 instances in a region (defaults to awsfab_settings.DEFAULT_REGION).
Parameters: - region – The region to list instances in. Defaults to ``awsfab_settings.DEFAULT_REGION.
- full – Print all attributes, or just the most useful ones? Defaults
to
False
.
-
awsfabrictasks.ec2.tasks.
ec2_print_instance
[source]¶ Print EC2 instance info.
Parameters: full – Print all attributes, or just the most useful ones? Defaults to False
.
-
awsfabrictasks.ec2.tasks.
ec2_login
[source]¶ Log into the host specified by –hosts, –ec2names or –ec2ids.
Aborts if more than one host is specified.
-
awsfabrictasks.ec2.tasks.
ec2_rsync_download_dir
[source]¶ Sync the contents of
remote_dir
intolocal_dir
. E.g.: ifremote_dir
is/etc
, andlocal_dir
is/tmp
, the/tmp/etc
will be created on the local host, and filled with all files in/etc
on the EC2 instance.Parameters: - remote_dir – The remote directory to download into local_dir.
- local_dir – The local directory.
- rsync_args – Arguments for
rsync
. Defaults to-av
. - noconfirm – If this is
True
, we will not ask for confirmation before proceeding with the operation. Defaults toFalse
.
-
awsfabrictasks.ec2.tasks.
ec2_rsync_upload_dir
[source]¶ Sync the contents of
local_dir
intoremote_dir
on the EC2 instance. E.g.: iflocal_dir
is/etc
, andremote_dir
is/tmp
, the/tmp/etc
will be created on the EC2 instance, and filled with all files in/etc
on the local host.Parameters: - local_dir – The local directory to upload to the EC2 instance.
- remote_dir – The remote directory to upload local_dir into.
- rsync_args – Arguments for
rsync
. Defaults to-av
. - noconfirm – If this is
True
, we will not ask for confirmation before proceeding with the operation. Defaults toFalse
.