Skip to main content
Glama

generate_template_example

Create AWS FIS experiment templates for chaos engineering by specifying target resources and actions to test system resilience.

Instructions

Generate an example AWS FIS experiment template for a given target and action type. Args: target_type: Target resource type (default: aws:ec2:instance) action_type: Action type to perform (default: aws:ec2:stop-instances) region: AWS region to use (default: us-east-1) Returns: JSON string containing an example template configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_typeNoaws:ec2:instance
action_typeNoaws:ec2:stop-instances
regionNous-east-1

Implementation Reference

  • The handler function that implements the 'generate_template_example' tool logic, creating a sample AWS FIS experiment template JSON with placeholders for resources and role.
    def generate_template_example( target_type: str = "aws:ec2:instance", action_type: str = "aws:ec2:stop-instances", region: str = "us-east-1" ) -> str: """ Generate an example AWS FIS experiment template for a given target and action type. Args: target_type: Target resource type (default: aws:ec2:instance) action_type: Action type to perform (default: aws:ec2:stop-instances) region: AWS region to use (default: us-east-1) Returns: JSON string containing an example template configuration """ try: # Example template structure template = { "description": f"Example experiment template for {action_type} on {target_type}", "targets": { "MyTargets": { "resourceType": target_type, "resourceArns": ["REPLACE_WITH_ACTUAL_RESOURCE_ARN"], "selectionMode": "ALL" } }, "actions": { "MyAction": { "actionId": action_type, "parameters": {}, "targets": { "Instances": "MyTargets" } } }, "stopConditions": [ { "source": "none" } ], "roleArn": "REPLACE_WITH_ACTUAL_ROLE_ARN", "tags": { "Name": f"Example-{target_type}-{action_type}" } } # Add common parameters based on action type if action_type == "aws:ec2:stop-instances": template["actions"]["MyAction"]["parameters"] = { "startAfter": "PT0M" } elif action_type == "aws:ec2:reboot-instances": template["actions"]["MyAction"]["parameters"] = { "startAfter": "PT0M" } return json.dumps(template, indent=2) except Exception as e: return f"Error generating template example: {str(e)}"
  • Registration of the 'generate_template_example' tool using the FastMCP app.tool() decorator.
    app.tool()(generate_template_example)
  • Import of the 'generate_template_example' function from tools.py, necessary 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, )

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