Sélectionner vos préférences de cookies

Nous utilisons des cookies essentiels et des outils similaires qui sont nécessaires au fonctionnement de notre site et à la fourniture de nos services. Nous utilisons des cookies de performance pour collecter des statistiques anonymes afin de comprendre comment les clients utilisent notre site et d’apporter des améliorations. Les cookies essentiels ne peuvent pas être désactivés, mais vous pouvez cliquer sur « Personnaliser » ou « Refuser » pour refuser les cookies de performance.

Si vous êtes d’accord, AWS et les tiers approuvés utiliseront également des cookies pour fournir des fonctionnalités utiles au site, mémoriser vos préférences et afficher du contenu pertinent, y compris des publicités pertinentes. Pour accepter ou refuser tous les cookies non essentiels, cliquez sur « Accepter » ou « Refuser ». Pour effectuer des choix plus détaillés, cliquez sur « Personnaliser ».

CreateExperimentTemplate

Mode de mise au point
CreateExperimentTemplate - AWS Fault Injection Service
Cette page n'a pas été traduite dans votre langue. Demande de traduction

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 Service 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", "experimentOptions": { "accountTargeting": "string", "emptyTargetResolutionMode": "string" }, "experimentReportConfiguration": { "dataSources": { "cloudWatchDashboards": [ { "dashboardIdentifier": "string" } ] }, "outputs": { "s3Configuration": { "bucketName": "string", "prefix": "string" } }, "postExperimentDuration": "string", "preExperimentDuration": "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.

actions

The actions for the experiment.

Type: String to CreateExperimentTemplateActionInput object map

Key Length Constraints: Maximum length of 64.

Key Pattern: [\S]+

Required: Yes

clientToken

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

description

A description for the experiment template.

Type: String

Length Constraints: Maximum length of 512.

Pattern: [\s\S]+

Required: Yes

experimentOptions

The experiment options for the experiment template.

Type: CreateExperimentTemplateExperimentOptionsInput object

Required: No

experimentReportConfiguration

The experiment report configuration for the experiment template.

Type: CreateExperimentTemplateReportConfigurationInput object

Required: No

logConfiguration

The configuration for experiment logging.

Type: CreateExperimentTemplateLogConfigurationInput object

Required: No

roleArn

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

stopConditions

The stop conditions.

Type: Array of CreateExperimentTemplateStopConditionInput objects

Required: Yes

tags

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

targets

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" } } }, "arn": "string", "creationTime": number, "description": "string", "experimentOptions": { "accountTargeting": "string", "emptyTargetResolutionMode": "string" }, "experimentReportConfiguration": { "dataSources": { "cloudWatchDashboards": [ { "dashboardIdentifier": "string" } ] }, "outputs": { "s3Configuration": { "bucketName": "string", "prefix": "string" } }, "postExperimentDuration": "string", "preExperimentDuration": "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" }, "targetAccountConfigurationsCount": number, "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.

experimentTemplate

Information about the experiment template.

Type: ExperimentTemplate object

Errors

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

ConflictException

The request could not be processed because of a conflict.

HTTP Status Code: 409

ResourceNotFoundException

The specified resource cannot be found.

HTTP Status Code: 404

ServiceQuotaExceededException

You have exceeded your service quota.

HTTP Status Code: 402

ValidationException

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

HTTP Status Code: 400

Examples

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:

Rubrique précédente :

Actions
ConfidentialitéConditions d'utilisation du sitePréférences de cookies
© 2025, Amazon Web Services, Inc. ou ses affiliés. Tous droits réservés.