kill

Usage

fugue [global options] kill [options] <alias | FID>

Options

Global options are detailed here.

--dry-run
Execute a “dry-run” of a process kill (output plan of operations). The dry-run flag allows you to see how AWS will provision your infrastructure in a composition using run, update, resume, or kill without actually executing the command. The Fugue CLI outputs a JSON document of the create, modify, and delete actions that would be executed on your infrastructure, allowing you to preview the changes before you make them.
--json
Emit output as JSON. The JSON flag displays command output in JSON format, which is useful for automation.
-y | --yes
Suppress confirmation dialogs. The yes flag suppresses confirmation dialogs and bypasses interactive prompts by providing input to aid scripting.
-h | --help
Show help text. The help flag is available throughout the CLI in both an application-level and command-level context. It enables a user to view help text for any command within the Fugue CLI.

Definition

The kill command ends automatic maintenance and enforcement of the resources that represent a single running instance of a composition, or process, and then it destroys those resources (and only those resources).

When you run a composition, Fugue uses the AWS API to launch the composition’s declared resources and automatically maintains and enforces them. These resources collectively represent a single running instance of the composition, which is called a process. This process is assigned a unique identifier called a Fugue ID, or FID and can also be assigned an alias, created by the user.

When you kill a single running instance of a composition (the process) by executing fugue kill [FID or alias], Fugue first stops automatically maintaining and enforcing the process’s resources, and then it deletes the process’s resources.

The length of time it takes Fugue to fully kill a process depends on the number of resources that the process created. Fugue deletes the resources in an order that satisfies their dependencies.

The kill command closes once the command to kill a process has been accepted by the Fugue Conductor. The actual process kill activities do take some time in most cases. To check the status of a process killing operation, use the status command. If a FID’s state is reported as “Killing,” then the kill command is still in progress. If the FID is no longer listed in the status table, then kill has successfully completed.

Killing one running instance of a composition (“process”) does not affect any other processes, even if the other processes are instantiations of the same original composition. However, if resources in another process are dependent on infrastructure in the killed process, that dependency may be unmet.

The kill command does not stop the Fugue Conductor or destroy its infrastructure. If you want to terminate your Fugue Conductor, see the uninstall command.

Examples

Using Suspend to Cancel a Kill

You may cancel a kill by first suspending the desired process and then resuming it.

To suspend the kill:

  1. Execute fugue suspend -y TARGET as soon as possible, where TARGET is the FID or alias of the desired process.
  2. Confirm that the process is in Suspended state by executing fugue status.

From here, you have two options:

  • To cancel the kill and return the process to Running state:

Execute fugue resume -y TARGET.

  • To continue the kill and return the process to Killing state:

Execute fugue kill -y TARGET.

Note: The -y flag is included in this example to save time by suppressing warnings.

Using --dry-run To Preview kill Changes To Your Infrastructure

In Fugue, a dry-run attempts to test an action through progressive parts of the system, returning either failures encountered, or the expected results of success. This allows you to see how Fugue will provision your infrastructure in a composition using run, update, resume, or kill without actually executing the command. You can see this in the output of a dry-run, which is a JSON document describing the create, modify, and delete actions that would be executed on your infrastructure.

Some update operations are mutative, meaning the resource can be changed with “modify” actions, and some update operations are destructive, meaning the resource must be destroyed and created anew with “delete” and “create” actions. You can often determine whether an update is mutative or destructive based on the RequestType in the dry-run document.

Say you have a running instance of the vpc-only.lw composition:

composition

import Fugue.Core.AWS.Common as AWS
       Fugue.Core.AWS.EC2 as EC2

#########################
# NETWORKS
#########################
my-example-vpc: EC2.Vpc({
  cidrBlock: "10.0.0.0/16",
  tags: [],
  instanceTenancy: EC2.DefaultTenancy,
  region: AWS.Us-west-2,
  dhcpOptions: None
})

You can use the --dry-run flag with the kill command to see what AWS resources would be destroyed.

$ fugue kill [FID] --dry-run

The CLI asks Fugue to dry-run the kill command on the running composition, and then returns raw JSON that looks something like this:

{"job_id": "1467396972",
    "requests": [
        {
            "params": {
                "VpcId": "vpc-58d9ab3c"
            },
            "guid": "feccc550-c6e1-49a8-bbcf-16a92e7dba2b.688a4642-4413-551d-ac9b-d134c3cb4900",
            "region": "us-west-2",
            "request_type": "aws.ec2.delete_vpc"
        }
    ],
    "fid": "feccc550-c6e1-49a8-bbcf-16a92e7dba2b"
}

The request_type field describes each AWS API call the Conductor would make if the kill command was executed without --dry-run.

JSON Object Fields in a Dry-Run

job_id
Unique ID for the dry-run operation
requests
Array of params, guid, guidMap, region, request_type per each API request in the dry-run operation
params
Dictionary of arguments passed to the AWS API in order to create, modify, or delete the resources
guid
Globally unique ID for the resource being acted upon. NOTE: guid is not unique for resource properties (e.g., tags, security group rules, routes)
guidMap
A unique token that maps to the guid and resource reference string
region
AWS region; see list of valid codes in AWS docs
request_type
Type of request for an AWS API action in aws.service.action_resource format
fid
Fugue ID, or the process’s unique identifier

Using kill On A Nonexistent FID or Alias

If you run fugue kill <alias | FID> but the provided FID or alias does not match a currently running process Fugue displays an error message indicating that the alias does not exist and recommends running fugue status to view the available Fugue processes.

$ fugue kill 19X6f116-474a-41ed-81e7-5c5dbd0fe24d

[ fugue kill ] Killing  process with Alias:19X6f116-474a-41ed-81e7-5c5dbd0fe24d

[ Error ] No process with Alias: 19X6f116-474a-41ed-81e7-5c5dbd0fe24d could be found. Run the 'fugue status' command to view available Fugue processes.