Skip to main content
Glama

create_experiment_template

Define AWS Fault Injection Service experiment templates to configure chaos engineering tests with targets, actions, and stop conditions.

Instructions

Create a new AWS FIS experiment template. Args: name: Name for the experiment template description: Description of the experiment template targets: Dictionary of targets configuration actions: Dictionary of actions configuration role_arn: ARN of the IAM role to use for the experiment stop_conditions: List of stop conditions region: AWS region to use (default: us-east-1) Returns: JSON string containing the created template information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
descriptionYes
targetsYes
actionsYes
role_arnYes
stop_conditionsYes
regionNous-east-1

Implementation Reference

  • The handler function that implements the core logic of the 'create_experiment_template' tool. It uses the AWS FIS boto3 client to create a new experiment template, handles serialization, and requires write mode to be enabled.
    @require_write_mode def create_experiment_template( name: str, description: str, targets: Dict[str, Dict[str, Any]], actions: Dict[str, Dict[str, Any]], role_arn: str, stop_conditions: List[Dict[str, Any]], region: str = "us-east-1" ) -> str: """ Create a new AWS FIS experiment template. Args: name: Name for the experiment template description: Description of the experiment template targets: Dictionary of targets configuration actions: Dictionary of actions configuration role_arn: ARN of the IAM role to use for the experiment stop_conditions: List of stop conditions region: AWS region to use (default: us-east-1) Returns: JSON string containing the created template information """ try: fis = boto3.client('fis', region_name=region) response = fis.create_experiment_template( clientToken=str(uuid.uuid4()), description=description, targets=targets, actions=actions, stopConditions=stop_conditions, roleArn=role_arn, tags={'Name': name} ) # Format the response for better readability template = response.get('experimentTemplate', {}) formatted_template = { 'id': template.get('id'), 'description': template.get('description'), 'creationTime': template.get('creationTime').isoformat() if template.get('creationTime') else None, 'tags': template.get('tags', {}) } return json.dumps(formatted_template, indent=2) except Exception as e: return f"Error creating experiment template: {str(e)}"
  • The line where the create_experiment_template tool is registered with the FastMCP server application using the @tool decorator.
    app.tool()(create_experiment_template)
  • Import statement in server.py that brings in the create_experiment_template function from the tools module for registration.
    from aws_fis_mcp.tools import ( list_experiment_templates, get_experiment_template, list_experiments, get_experiment, start_experiment, stop_experiment, create_experiment_template, delete_experiment_template, list_action_types, generate_template_example, set_write_mode, )
  • The require_write_mode decorator applied to the handler, which enforces that write operations are only allowed when explicitly enabled.
    def require_write_mode(func): """Decorator to require write mode for destructive operations.""" @wraps(func) def wrapper(*args, **kwargs): if not _WRITE_MODE_ENABLED: return json.dumps({ "error": "Write operations are disabled", "message": f"The '{func.__name__}' operation requires write mode. Please restart the server with --allow-writes flag to enable write operations.", "operation": func.__name__, "read_only_mode": True }, indent=2) return func(*args, **kwargs) return wrapper

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RadiumGu/aws-fis-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server