To create an experiment template, you must define one or more actions. For a list of predefined actions provided by AWS FIS, see Actions reference.
You can run an action only once during an experiment. To run the same AWS FIS action more than once in the same experiment, add it to the template multiple times using different names.
Action syntaxThe following is the syntax for an action.
{
"actions": {
"action_name
": {
"actionId": "aws:service
:action-type
",
"description": "string
",
"parameters": {
"name
": "value
"
},
"startAfter": ["action_name
", ...],
"targets": {
"ResourceType
": "target_name
"
}
}
}
}
When you define an action, you provide the following:
action_name
A name for the action.
The action identifier.
An optional description.
Any action parameters.
Any actions that must complete before this action can start. Otherwise, the action runs at the start of the experiment.
Any action targets.
For examples, see Example actions.
Action identifiersEach AWS FIS action has an identifier with the following format:
aws:service-name
:action-type
For example, the following action stops the target Amazon EC2 instances:
aws:ec2:stop-instances
For a complete list of actions, see the AWS FIS Actions reference.
Action parametersSome AWS FIS actions have additional parameters that are specific to the action. These parameters are used to pass information to AWS FIS when the action is run.
AWS FIS supports custom fault types using the aws:ssm:send-command
action, which uses the SSM Agent and an SSM command document to create the fault condition on the targeted instances. The aws:ssm:send-command
action includes a documentArn
parameter that takes the Amazon Resource Name (ARN) of an SSM document as a value. You specify values for parameters when you add the action to your experiment template.
For more information about specifying parameters for the aws:ssm:send-command
action, see Use the aws:ssm:send-command action.
Where possible, you can input a rollback configuration (also referred to as a post action) within the action parameters. A post action returns the target to the state that it was in before the action was run. The post action runs after the time specified in the action duration. Not all actions can support post actions. For example, if the action terminates an Amazon EC2 instance, you cannot recover the instance after it has been terminated.
Action targetsAn action runs on the target resources that you specify. After you define a target, you can specify its name when you define an action.
"targets": {
"ResourceType
": "resource_name
"
}
AWS FIS actions support the following resource types for action targets:
AutoScalingGroups â Amazon EC2 Auto Scaling groups
Buckets â Amazon S3 buckets
Cluster â Amazon EKS clusters
Clusters â Amazon ECS clusters or Amazon Aurora DB clusters
DBInstances â Amazon RDS DB instances
Functions â AWS Lambda functions
Instances â Amazon EC2 instances
ManagedResources â Amazon EKS clusters, Amazon EC2 Application and Network Load Balancers, and Amazon EC2 Auto Scaling groups that are enabled for ARC zonal shift.
MultiRegionClusters â Amazon MemoryDB multi-Region clusters
Nodegroups â Amazon EKS node groups
Pods â Kubernetes pods on Amazon EKS
ReplicationGroups â ElastiCache Replication Groups
Roles â IAM roles
SpotInstances â Amazon EC2 Spot Instances
Subnets â VPC subnets
Tables â Amazon DynamoDB multi-Region eventually consistent global tables
Tasks â Amazon ECS tasks
TransitGateways â Transit gateways
Volumes â Amazon EBS volumes
For examples, see Example actions.
Action durationIf an action includes a parameter that you can use to specify the duration of the action, by default, the action is considered complete only after the specified duration has elapsed. If you have set the emptyTargetResolutionMode
experiment option to skip
, then the action will complete immediately with status 'skipped' when no targets were resolved. For example, if you specify a duration of 5 minutes, AWS FIS considers the action complete after 5 minutes. It then starts the next action, until all actions are complete.
Duration can be either the length of time that an action condition is maintained or the length of time for which metrics are monitored. For example, latency is injected for the duration of time specified. For near instantaneous action types, such as terminating an instance, stop conditions are monitored for the duration of time specified.
If an action includes a post action within the action parameters, the post action runs after the action completes. The time it takes to complete the post action might cause a delay between the specified action duration and the beginning of the next action (or the end of the experiment, if all other actions are complete).
Example actionsThe following are example actions.
Example: Stop EC2 instancesThe following action stops the EC2 instances identified using the target named targetInstances
. After two minutes, it restarts the target instances.
"actions": {
"stopInstances
": {
"actionId": "aws:ec2:stop-instances",
"parameters": {
"startInstancesAfterDuration": "PT2M
"
},
"targets": {
"Instances": "targetInstances
"
}
}
}
Example: Interrupt Spot Instances
The following action stops the Spot Instances identified using the target named targetSpotInstances
. It waits two minutes before interrupting the Spot Instance.
"actions": {
"interruptSpotInstances
": {
"actionId": "aws:ec2:send-spot-instance-interruptions",
"parameters": {
"durationBeforeInterruption": "PT2M
"
},
"targets": {
"SpotInstances": "targetSpotInstances
"
}
}
}
Example: Disrupt network traffic
The following action denies traffic between the target subnets and subnets in other Availability Zones.
"actions": {
"disruptAZConnectivity
": {
"actionId": "aws:network:disrupt-connectivity",
"parameters": {
"scope": "availability-zone",
"duration": "PT5M
"
},
"targets": {
"Subnets": "targetSubnets
"
}
}
}
Example: Terminate EKS workers
The following action terminates 50% of the EC2 instances in the EKS cluster identified using the target named targetNodeGroups
.
"actions": {
"terminateWorkers
": {
"actionId": "aws:eks:terminate-nodegroup-instances",
"parameters": {
"instanceTerminationPercentage": "50
"
},
"targets": {
"Nodegroups": "targetNodeGroups
"
}
}
}
Example: Start ARC zonal autoshift
The following action starts an ARC Zonal autoshift that shifts managed resources away from az-in-parameters
for duration-in-parameteres
. The resource type ManagedResources
is used as a key for the target name in AWS FIS experiment template.
{
"description": "aaa",
"targets": {
"ManagedResources-Target-1": {
"resourceType": "aws:arc:zonal-shift-managed-resource",
"resourceArns": [
"arn:aws:elasticloadbalancing:us-east-1:0124567890:loadbalancer/app/application/11223312312516",
],
"selectionMode": "ALL"
}
},
"actions": {
"arc": {
"actionId": "aws:arc:start-zonal-autoshift",
"parameters": {
"availabilityZoneIdentifier": "us-east-1a",
"duration": "PT1M"
},
"targets": {
"ManagedResources": "ManagedResources-Target-1"
}
}
},
"stopConditions": [
{
"source": "none"
}
],
"roleArn": "arn:aws:iam::718579638765:role/fis",
"tags": {},
"experimentOptions": {
"accountTargeting": "single-account",
"emptyTargetResolutionMode": "fail"
}
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4