AWS::FIS::ExperimentTemplate - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


Specifies an experiment template.

An experiment template includes the following components:

  • Targets: A target can be a specific resource in your Amazon environment, or one or more resources that match criteria that you specify, for example, resources that have specific tags.

  • Actions: The actions to carry out on the target. You can specify multiple actions, the duration of each action, and when to start each action during an experiment.

  • Stop conditions: If a stop condition is triggered while an experiment is running, the experiment is automatically stopped. You can define a stop condition as a CloudWatch alarm.

For more information, see Experiment templates in the Amazon Fault Injection Service User Guide.


To declare this entity in your Amazon CloudFormation template, use the following syntax:


{ "Type" : "AWS::FIS::ExperimentTemplate", "Properties" : { "Actions" : {Key: Value, ...}, "Description" : String, "ExperimentOptions" : ExperimentTemplateExperimentOptions, "LogConfiguration" : ExperimentTemplateLogConfiguration, "RoleArn" : String, "StopConditions" : [ ExperimentTemplateStopCondition, ... ], "Tags" : {Key: Value, ...}, "Targets" : {Key: Value, ...} } }



The actions for the experiment.

Required: No

Type: Object of ExperimentTemplateAction

Update requires: No interruption


The description for the experiment template.

Required: Yes

Type: String

Maximum: 512

Update requires: No interruption


The experiment options for an experiment template.

Required: No

Type: ExperimentTemplateExperimentOptions

Update requires: No interruption


The configuration for experiment logging.

Required: No

Type: ExperimentTemplateLogConfiguration

Update requires: No interruption


The Amazon Resource Name (ARN) of an IAM role.

Required: Yes

Type: String

Maximum: 1224

Update requires: No interruption


The stop conditions for the experiment.

Required: Yes

Type: Array of ExperimentTemplateStopCondition

Update requires: No interruption


The tags for the experiment template.

Required: Yes

Type: Object of String

Pattern: .{1,128}

Maximum: 256

Update requires: Replacement


The targets for the experiment.

Required: Yes

Type: Object of ExperimentTemplateTarget

Update requires: No interruption

Return values


When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the experiment template ID.

For more information about using the Ref function, see Ref.


The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.


The ID of the experiment template.


Stop and start an instance based on a tag

The following example creates an experiment template that stops and starts one instance with the tag env=prod, chosen at random.


Resources: ExperimentTemplate: Type: 'AWS::FIS::ExperimentTemplate' Properties: Description: 'stop an instance based on a tag' Actions: stopInstances: ActionId: 'aws:ec2:stop-instances' Parameters: startInstancesAfterDuration: 'PT2M' Targets: Instances: oneRandomInstance Targets: oneRandomInstance: ResourceTags: 'env': 'prod' ResourceType: 'aws:ec2:instance' SelectionMode: 'COUNT(1)' StopConditions: - Source: 'none' Tags: Name: 'fisStopInstances' RoleArn: !GetAtt FISRole.Arn FISRole: Type: 'AWS::IAM::Role' Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Service: '' Action: 'sts:AssumeRole' Policies: - PolicyName: 'FISRoleEC2Actions' PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: - 'ec2:RebootInstances' - 'ec2:StopInstances' - 'ec2:StartInstances' - 'ec2:TerminateInstances' Resource: 'arn:aws:ec2:*:*:instance/*'


{ "Resources": { "ExperimentTemplate": { "Type": "AWS::FIS::ExperimentTemplate", "DeletionPolicy": "Retain", "Properties": { "Description": "stop an instance based on a tag", "Actions": { "stopInstances": { "ActionId": "aws:ec2:stop-instances", "Parameters": { "startInstancesAfterDuration": "PT2M" }, "Targets": { "Instances": "oneRandomInstance" } } }, "Targets": { "oneRandomInstance": { "ResourceTags": { "env": "prod" }, "ResourceType": "aws:ec2:instance", "SelectionMode": "COUNT(1)" } }, "StopConditions": [ { "Source": "none" } ], "Tags": { "Name": "fisStopInstancesJson" }, "RoleArn": { "Fn::GetAtt": ["FISRole", "Arn"] } } }, "FISRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "" }, "Action": "sts:AssumeRole" } ] }, "Policies": [ { "PolicyName": "FISRoleEC2Actions", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:RebootInstances", "ec2:StopInstances", "ec2:StartInstances", "ec2:TerminateInstances" ], "Resource": "arn:aws:ec2:*:*:instance/*" } ] } } ] } } } }