Work with AWS FIS experiment templates - AWS Fault Injection Simulator

Work with AWS FIS experiment templates

You can create and manage experiment templates using the AWS FIS console or the command line After you create an experiment template, you can use it to run an experiment.

Create an experiment template

Before you begin, complete the following tasks:

To create an experiment template using the console

  1. Open the AWS FIS console at https://console.aws.amazon.com/fis/.

  2. In the navigation pane, choose Experiment templates.

  3. Choose Create experiment template.

  4. Enter a description for the template.

  5. For IAM role, select an IAM role that grants AWS FIS permission to perform actions on your behalf. If your role is not displayed, verify that it has the required trust relationship. For more information, see the example trust policy.

  6. For Actions, specify the set of actions for the template. For each action, choose Add action and complete the following:

    • For Name, enter a name for the action.

      Allowed characters are alphanumeric characters, hyphens (-), and underscores(_). The name must start with a letter. No spaces are allowed. Each action name in the template must be unique.

    • (Optional) For Description, enter a description for the action. Up to 512 characters are allowed.

    • For Action type, select the action.

    • (Optional) For Start after, select another action in the template that must be completed before the current action starts. The other action must already be specified in your template. To run the action at the start of the experiment, leave the default value. For more information, see Action set for AWS FIS.

    • For Target, select a target that you defined in the Targets section. If you have not defined a target for this action yet, AWS FIS creates a new target for you.

    • For Duration, enter the number of minutes to run the action.

    • (Optional) For Action parameters, specify any additional parameter values for the action. Fields for additional parameter values are only available if the selected AWS FIS action has them.

    • Choose Save.

  7. For Targets, define the target resources on which to carry out the actions. Choose Edit to edit the target that AWS FIS created for you (step 6), or choose Add target. For each target, do the following:

    • For Name, enter a name for the target.

      Allowed characters are alphanumeric characters, hyphens (-), and underscores(_). The name must start with a letter. No spaces are allowed. Each target name in the template must be unique.

    • For Resource type, select a supported resource type for the action.

    • For Target method, select one of the following:

      • Resource IDs: Specify one or more Resource IDs.

      • Resource tags and filters: For Resource filters, specify one or more filters to apply to the output of an API action that describes the resource type. For more information, see Resource filters. For Resource tags, specify the tags of the target resources.

      Note

      You must specify at least one resource ID or at least one resource tag for a target. For more information about the target options, see Targets for AWS FIS.

    • For Selection mode, choose whether to narrow down the identified resources to a specific count at random, or a percentage. By default, all identified resources are included in the target.

    • Choose Save.

  8. If required, return to the Actions section, and update an action with the target that you created. Choose Edit, and for Target, select the target name. You can use the same target for multiple actions.

  9. For Stop conditions, select one or more Amazon CloudWatch alarms for the stop conditions. For more information, see Stop conditions for AWS FIS.

  10. (Optional) For Tags, choose Add new tag and specify a tag key and tag value. Tags you add are applied to your experiment template, not the experiments that are run using the template.

  11. Choose Create experiment template.

To create an experiment template using the CLI

Use the create-experiment-template command.

You can load an experiment template from a JSON file.

Use the --cli-input-json parameter.

aws fis create-experiment-template --cli-input-json fileb://<path-to-json-file>

For more information, see Generating a CLI skeleton template in the AWS Command Line Interface User Guide. For example templates, see Example AWS FIS experiment templates.

View experiment templates

You can view the experiment templates that you created.

To view an experiment template using the console

  1. Open the AWS FIS console at https://console.aws.amazon.com/fis/.

  2. In the navigation pane, choose Experiment templates.

  3. To view information about a specific template, select the Experiment template ID.

  4. In the Details section, you can view the description and stop conditions for the template.

  5. To view the actions for the experiment template, choose Actions.

  6. To view the targets for the experiment template, choose Targets.

  7. To view the tags for the experiment template, choose Tags.

To view an experiment template using the CLI

Use the list-experiment-templates command to get a list of experiment templates, and use the get-experiment-template command to get information about a specific experiment template.

Start an experiment from a template

After you have created an experiment template, you can start experiments using that template.

When you start an experiment, we create a snapshot of the specified template and use that snapshot to run the experiment. Therefore, if the experiment template is updated or deleted while the experiment is running, those changes have no impact on the running experiment.

Note

When you start an experiment, AWS FIS creates a service-linked role on your behalf. For more information, see Use service-linked roles for AWS Fault Injection Simulator.

After you start the experiment, you can stop it at any time. For more information, see Stop an experiment.

To start an experiment using the console

  1. Open the AWS FIS console at https://console.aws.amazon.com/fis/.

  2. In the navigation pane, choose Experiment templates.

  3. Select the experiment template, and choose Actions, Start experiment.

  4. (Optional) To add a tag, choose Add new tag, and specify a key and value. To remove a tag, choose Remove.

  5. Choose Start experiment. When prompted, enter start and choose Start experiment.

To start an experiment using the CLI

Use the start-experiment command.

Update an experiment template

You can update an existing experiment template. When you update an experiment template, the changes do not affect any running experiments that use the template.

To update an experiment template using the console

  1. Open the AWS FIS console at https://console.aws.amazon.com/fis/.

  2. In the navigation pane, choose Experiment templates.

  3. Select the experiment template, and choose Actions, Update experiment template.

  4. Modify the template details as needed, and choose Update experiment template.

To update an experiment template using the CLI

Use the update-experiment-template command.

Tag experiment templates

You can apply your own tags to experiment templates to help you organize them. You can also implement tag-based IAM policies to control access to experiment templates.

To tag an experiment template using the console

  1. Open the AWS FIS console at https://console.aws.amazon.com/fis/.

  2. In the navigation pane, choose Experiment templates.

  3. Select the experiment template and choose Actions, Manage tags.

  4. To add a new tag, choose Add new tag, and then specify a key and value.

    To remove a tag, choose Remove for the tag.

  5. Choose Save.

To tag an experiment template using the CLI

Use the tag-resource command.

Delete an experiment template

If you no longer need an experiment template, you can delete it. When you delete an experiment template, any running experiments that use the template are not affected. The experiment continues to run until completed or stopped. However, experiment templates that are deleted are not available for viewing from the Experiments page in the console.

To delete an experiment template using the console

  1. Open the AWS FIS console at https://console.aws.amazon.com/fis/.

  2. In the navigation pane, choose Experiment templates.

  3. Select the experiment template, and choose Actions, Delete experiment template.

  4. Enter delete when prompted for confirmation, and then choose Delete experiment template.

To delete an experiment template using the CLI

Use the delete-experiment-template command.