Welcome to 0.8.6! This is an exciting release, especially for EC2 users. To see what new features are available, read on.
The documentation for Salt Cloud can be found on Read the Docs: https://salt-cloud.readthedocs.io
Salt Cloud can be downloaded and install via pypi:
Some packages have been made available for salt-cloud and more on their way. Packages for Arch and FreeBSD are being made available thanks to the work of Christer Edwards, and packages for RHEL and Fedora are being created by Clint Savage. The Ubuntu PPA is being managed by Sean Channel. Package availability will be announced on the salt mailing list.
This version of Salt Cloud now depends upon libcloud version 0.12.1. Be sure to update your packages accordingly.
Previously, output from Salt Cloud was a mix of log output and print statements, while the Salt outputter system has grown into a beautiful, configurable tool. This release of Salt Cloud now takes advantage of the Salt outputter system, making the output from the salt-cloud command much more beautiful, easy to read, and usable from other scripts.
A new driver has been introduced for Amazon EC2, to potentially replace the existing AWS driver. This driver contains several optimizations which have been found to greatly improve instance creation and deployment. They also allow for extra functionality to be added, which is not currently available in the AWS driver. However, it should be noted that the EC2 driver is currently considered to be experiemental. While existing AWS usage should not currently differ, it should be expected to change between versions until it is declared stable.
Many of the features of this release are specific to the EC2 driver. Please check the AWS documentation for configuration and usage of the EC2 driver.
When instances on AWS are destroyed, there will be a lag between the time that the action is sent, and the time that Amazon cleans up the instance. During this time, the instance still retails a Name tag, which will cause a collision if the creation of an instance with the same name is attempted before the cleanup occurs. In order to avoid such collisions, Salt Cloud can be configured to rename instances when they are destroyed. The new name will look something like:
In order to enable this, add AWS.rename_on_destroy line to the main configuration file:
This action is a thin wrapper around --full-query, which displays details on a single instance only. In an environment with several machines, this will save a user from having to sort through all instance data, just to examine a single instance.
$ salt-cloud -a show_instance myinstance
Salt Cloud 0.8.3 introduced the concept of provider-specific actions. However, these actions were designed to operate on specific instances within a provider. In order to perform calls on a provider, but not on specific instances, functions have been added. Currently, only EC2 takes advantage of these.
This is a function that describes an AMI on EC2. This will give insight as to the defaults that will be applied to an instance using a particular AMI.
$ salt-cloud -f show_image ec2 image=ami-fd20ad94
This argument overrides the default DeleteOnTermination setting in the AMI for the root EBS volume for an instance. Many AMIs contain 'false' as a default, resulting in orphaned volumes in the EC2 account, which may unknowingly be charged to the account. This setting can be added to the profile or map file for an instance.
This can also be set as a global setting in the EC2 cloud configuration:
The setting for this may be changed on an existing instance using one of the following commands:
salt-cloud -a delvol_on_destroy myinstance
salt-cloud -a keepvol_on_destroy myinstance
AWS allows the user to enable and disable termination protection on a specific instance. An instance with this protection enabled cannot be destroyed. The EC2 driver adds a show_term_protect action to the regular AWS functionality.
salt-cloud -a show_term_protect mymachine
salt-cloud -a enable_term_protect mymachine
salt-cloud -a disable_term_protect mymachine
Normally, ec2 endpoints are build using the region and the service_url. The resulting endpoint would follow this pattern:
This results in an endpoint that looks like:
There are other projects that support an EC2 compatibility layer, which this scheme does not account for. This can be overridden by specifying the endpoint directly in the main cloud configuration file:
The EC2 driver has several functions and actions for management of EBS volumes.
A volume may be created, independent of an instance. A zone must be specified. A size or a snapshot may be specified (in GiB). If neither is given, a default size of 10 GiB will be used. If a snapshot is given, the size of the snapshot will be used.
salt-cloud -f create_volume ec2 zone=us-east-1b
salt-cloud -f create_volume ec2 zone=us-east-1b size=10
salt-cloud -f create_volume ec2 zone=us-east-1b snapshot=snap12345678
Unattached volumes may be attached to an instance. The following values are required: name or instance_id, volume_id, and device.
salt-cloud -a attach_volume myinstance volume_id=vol-12345 device=/dev/sdb1
The details about an existing volume may be retrieved.
salt-cloud -a show_volume myinstance volume_id=vol-12345
salt-cloud -f show_volume ec2 volume_id=vol-12345
An existing volume may be detached from an instance.
salt-cloud -a detach_volume myinstance volume_id=vol-12345
A volume that is not attached to an instance may be deleted.
salt-cloud -f delete_volume ec2 volume_id=vol-12345
The EC2 driver has the ability to manage key pairs.
A key pair is required in order to create an instance. When creating a key pair with this function, the return data will contain a copy of the private key. This private key is not stored by Amazon, and will not be obtainable past this point, and should be stored immediately.
salt-cloud -f create_keypair ec2 keyname=mykeypair
This function will show the details related to a key pair, not including the private key itself (which is not stored by Amazon).
salt-cloud -f delete_keypair ec2 keyname=mykeypair
This function removes the key pair from Amazon.
salt-cloud -f delete_keypair ec2 keyname=mykeypair