Documentation

Configuring actions and methods

Now that we have designed an automation process, we can start configuring its actions and their methods. Once you have defined the order of steps to be executed within your pipeline, make sure you connect the lines between the actions. This ensures a functional flow and allows you to pass or transform data between actions.

Each plugin comes with a set of Methods which are the actual actions that the plugin will run. For example, the AWS EC2 plugin offers Methods to Create, Reboot, Terminate instances, among many other options.

To start the configuration process, select the first action from within your pipeline. In this example, the AmazonEC2 action allows you to configure the following fields as seen below.

Configure tab

The Configure tab displays different plugin parameters that are either mandatory or optional in order to run an action based on a chosen method.

Just as you would normally do when creating a new EC2 instance through AWS Management Console, you need to configure multiple instance details – such as methods, parameters, or functions. These fields can be manually filled in or dynamically generated at the time of the execution by using the Code fields.

  • Action ID : This field allows you to access the status, inputs and outputs of the action.
  • Display Name : Choose a name that will be displayed in the Design layer.
  • Description : Enter an optional description of the action.
  • Method : Choose the method that will be used when executing the action – in this case, select Create Instance.
  • Access Key & Secret Key : Enter the key IDs used to authenticate to AWS for this request. You can also create vault items to store your keys, tokens, passwords, or other secrets in the Kaholo Vault for ease of access. See Creating Vault Items for more details.
  • Region : Select the region you want the request to be executed in.
  • Image ID : Fill in the Amazon Machine Image (AMI) required to launch an instance.
  • Instance Type : Fill in the machine type you want to launch.
  • Key name : If specified, encrypt the volume created for this instance using the specified Key pair.
  • Security Groups IDs : This field allows you to connect this instance to a security group. You will have to use a code or configuration to transfer the array to the API.
  • User Data : This option allows you to pass user data to the instance that can be used to perform common automated configuration tasks and even run scripts after the instance starts.
  • Minimum/Maximum Of Instances : The minimum/maximum number of instances to launch. By default, the value is set to 1 for both.
  • Subnet ID : You can specify a subnet ID to host the instance.
  • Tags Specification : Specify tags to apply to the resources during the launch.

Advanced tab

The Advanced tab allows you to add conditional statements when running a certain action.

  • Timeout : In this field, you may define the timeout period for the action runtime.
  • Retries : In this field, you may define the amount of retries of the action if it fails.
  • Conditions : In this field, you may determine if the action should execute. Returns a boolean value. You can reference code within the pipeline code layer.
  • Hooks : In this field, the function will run with an agent context before or after the action is executed. The result will be added to the context

For example, you may want to upload your repository on the EC2 server only when the instance has been created and made available. To do this, follow the steps below:

  1. Select the Upload Repo to Instance action from the Design layer.
  2. In the Advanced tab under Conditions, enter the conditional code that will determine if the EC2 instance is available and if the action should be executed: isAvailable.

Code fields

An alternative to manually filling in plugin parameters is enabling the Code option by switching on the toggle above the parameter field. This way, parameter values can be dynamically generated at the time of execution.

For example, when configuring the new Amazon EC2 instance, you can dynamically get access to the auto-assigned IP address of the Host URL. To generate this value dynamically at the time of execution, you can use the following structure directly in a plugin parameter field that has the code option turned on:

actions.ec2NewInstance.result.PublicIpAddress

The ec2NewInstance serves as the Action ID, which is used to access the status, inputs and outputs of this action from any code field or from the Code layer.

Page Contents