Work with AWS FIS experiment templates - AWS Fault Injection Service

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. (Optional) For Account targeting, choose Multiple accounts to configure a multi-account experiment template.

  5. For Account targeting, choose Confirm.

  6. For Description and name, enter a description and a name for the template.

  7. 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 must be unique in this template.

    • (Optional) For Description, enter a description for the action. The maximum length is 512 characters.

    • (Optional) For Start after, select another action defined in this template that must be completed before the current action starts. Otherwise, the action runs at the start of the experiment.

    • For Action type, choose the AWS FIS action.

    • For Target, choose a target that you defined in the Targets section. If you haven't defined a target for this action yet, AWS FIS creates a new target for you.

    • For Action parameters, specify the parameters for the action. This section appears only if the AWS FIS action has parameters.

    • Choose Save.

  8. For Targets, define the target resources on which to carry out the actions. You must specify at least one resource ID or one resource tag as a target. Choose Edit to edit the target that AWS FIS created for you in the previous step, 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 must be unique in this template.

    • For Resource type, choose a resource type that is supported for the action.

    • For Target method, do one of the following:

      • Choose Resource IDs and then choose or add the resource IDs.

      • Choose Resource tags, filters, and parameters and then add the tags and filters that you need. For more information, see Identify target resources.

    • For Selection mode, choose Count to run the action on the specified number of identified targets or choose Percent to run the action on the specified percentage of identified targets. By default, the action runs on all identified targets.

    • Choose Save.

  9. To update an action with the target that you created, find the action under Actions, choose Edit, and then update Target. You can use the same target for multiple actions.

  10. (Multi-account experiments only) For Target account configurations, add a Role ARN and optional description for each target account. To upload the target account role ARNs with a CSV file, choose Upload role ARNs for all target accounts and then choose Choose .CSV file

  11. For Service Access, choose Use an existing IAM role, and then choose the IAM role that you created as described in the prerequisites for this tutorial. If your role is not displayed, verify that it has the required trust relationship. For more information, see IAM roles for AWS FIS experiments.

  12. (Optional) For Stop conditions, select the Amazon CloudWatch alarms for the stop conditions. For more information, see Stop conditions for AWS FIS.

  13. (Optional) For Logs, configure the destination option. To send logs to an S3 bucket, choose Send to an Amazon S3 bucket and enter the bucket name and prefix. To send logs to CloudWatch Logs, choose Send to CloudWatch Logs and enter the log group.

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

  15. Choose Create experiment template. When prompted for confirmation, enter create and 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.

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 Service.

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 Start experiment.

  4. (Optional) To add a tag to your experiment, choose Add new tag and enter a tag key and a tag value.

  5. Choose Start experiment. When prompted for confirmation, 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. When prompted for confirmation, enter delete and choose Delete experiment template.

To delete an experiment template using the CLI

Use the delete-experiment-template command.