CreateExperimentTemplate - AWS Fault Injection Simulator


Creates an experiment template.

An experiment template includes the following components:

  • Targets: A target can be a specific resource in your AWS 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 AWS Fault Injection Simulator User Guide.

Request Syntax

POST /experimentTemplates HTTP/1.1 Content-type: application/json { "actions": { "string" : { "actionId": "string", "description": "string", "parameters": { "string" : "string" }, "startAfter": [ "string" ], "targets": { "string" : "string" } } }, "clientToken": "string", "description": "string", "logConfiguration": { "cloudWatchLogsConfiguration": { "logGroupArn": "string" }, "logSchemaVersion": number, "s3Configuration": { "bucketName": "string", "prefix": "string" } }, "roleArn": "string", "stopConditions": [ { "source": "string", "value": "string" } ], "tags": { "string" : "string" }, "targets": { "string" : { "filters": [ { "path": "string", "values": [ "string" ] } ], "parameters": { "string" : "string" }, "resourceArns": [ "string" ], "resourceTags": { "string" : "string" }, "resourceType": "string", "selectionMode": "string" } } }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.


The actions for the experiment.

Type: String to CreateExperimentTemplateActionInput object map

Key Length Constraints: Maximum length of 64.

Key Pattern: [\S]+

Required: Yes


Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: [\S]+

Required: Yes


A description for the experiment template.

Type: String

Length Constraints: Maximum length of 512.

Pattern: [\s\S]+

Required: Yes


The configuration for experiment logging.

Type: CreateExperimentTemplateLogConfigurationInput object

Required: No


The Amazon Resource Name (ARN) of an IAM role that grants the AWS FIS service permission to perform service actions on your behalf.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: [\S]+

Required: Yes


The stop conditions.

Type: Array of CreateExperimentTemplateStopConditionInput objects

Required: Yes


The tags to apply to the experiment template.

Type: String to string map

Map Entries: Maximum number of 50 items.

Key Length Constraints: Maximum length of 128.

Key Pattern: [\s\S]+

Value Length Constraints: Maximum length of 256.

Value Pattern: [\s\S]*

Required: No


The targets for the experiment.

Type: String to CreateExperimentTemplateTargetInput object map

Key Length Constraints: Maximum length of 64.

Key Pattern: [\S]+

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "experimentTemplate": { "actions": { "string" : { "actionId": "string", "description": "string", "parameters": { "string" : "string" }, "startAfter": [ "string" ], "targets": { "string" : "string" } } }, "creationTime": number, "description": "string", "id": "string", "lastUpdateTime": number, "logConfiguration": { "cloudWatchLogsConfiguration": { "logGroupArn": "string" }, "logSchemaVersion": number, "s3Configuration": { "bucketName": "string", "prefix": "string" } }, "roleArn": "string", "stopConditions": [ { "source": "string", "value": "string" } ], "tags": { "string" : "string" }, "targets": { "string" : { "filters": [ { "path": "string", "values": [ "string" ] } ], "parameters": { "string" : "string" }, "resourceArns": [ "string" ], "resourceTags": { "string" : "string" }, "resourceType": "string", "selectionMode": "string" } } } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


Information about the experiment template.

Type: ExperimentTemplate object


For information about the errors that are common to all actions, see Common Errors.


The request could not be processed because of a conflict.

HTTP Status Code: 409


The specified resource cannot be found.

HTTP Status Code: 404


You have exceeded your service quota.

HTTP Status Code: 402


The specified input is not valid, or fails to satisfy the constraints for the request.

HTTP Status Code: 400


Terminate EC2 instances

The following example terminates three instances in the specified VPC with the tag env=test.

Sample Request

{ "description": "Test instance termination", "targets": { "to-terminate": { "resourceType": "aws:ec2:instance", "resourceTags": { "env": "test" }, "filters": [ "path": "VpcId", "values": [ "vpc-1234567890abcdef0" ] ], "selectionMode": "COUNT(3)" } }, "actions": { "TerminateInstances": { "actionId": "aws:ec2-terminate-instances", "description": "terminate instances", "targets": { "Instances": "to-terminate" } } }, "stopConditions": [ { "source": "none" } ], "roleArn": "arn:aws:iam:123456789012:role/ExperimentRole", }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: