Skip to main content
Glama

ec2_describe_flow_logs

Retrieve VPC Flow Logs to monitor network traffic patterns and troubleshoot connectivity issues in AWS environments.

Instructions

Describe one or more VPC Flow Logs. If no filter is provided, returns all Flow Logs in the region. Parameters: aws_region (str): The AWS region - use 'us-east-1' if not specified. flow_log_ids (list[str], optional): List of Flow Log IDs to describe. resource_ids (list[str], optional): List of resource IDs to filter by. resource_type (str, optional): Type of resource to filter by (e.g. 'VPC', 'NetworkInterface', 'Subnet'). max_results (int, optional): Maximum number of results to return. Returns: str: JSON-formatted list of Flow Logs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aws_regionYes
flow_log_idsNo
resource_idsNo
resource_typeNo
max_resultsNo

Implementation Reference

  • The core handler function implementing the 'ec2_describe_flow_logs' tool. It accepts parameters for filtering flow logs by ID, resource ID, type, and max results, uses boto3 EC2 client to call describe_flow_logs API, and returns JSON-formatted results.
    async def ec2_describe_flow_logs( aws_region: str, flow_log_ids: list[str] = None, resource_ids: list[str] = None, resource_type: str = None, max_results: int = 10 ) -> str: """ Describe one or more VPC Flow Logs. If no filter is provided, returns all Flow Logs in the region. Parameters: aws_region (str): The AWS region - use 'us-east-1' if not specified. flow_log_ids (list[str], optional): List of Flow Log IDs to describe. resource_ids (list[str], optional): List of resource IDs to filter by. resource_type (str, optional): Type of resource to filter by (e.g. 'VPC', 'NetworkInterface', 'Subnet'). max_results (int, optional): Maximum number of results to return. Returns: str: JSON-formatted list of Flow Logs. """ client = boto3.client('ec2', region_name=aws_region) params = {} if flow_log_ids: params["FlowLogIds"] = flow_log_ids if resource_ids: params["Filter"] = params.get("Filter", []) + [{ "Name": "resource-id", "Values": resource_ids, "MaxResults": max_results }] if resource_type: params["Filter"] = params.get("Filter", []) + [{ "Name": "resource-type", "Values": [resource_type] }] resp = client.describe_flow_logs(**params) return json.dumps(resp.get("FlowLogs", []), indent=2, cls=DateTimeEncoder)
  • server.py:505-505 (registration)
    The @mcp.tool() decorator registers the ec2_describe_flow_logs function as an MCP tool, making it available for invocation.
    @mcp.tool()
  • Type annotations in the function signature define the input schema for the tool parameters, including AWS region and optional filters.
    aws_region: str, flow_log_ids: list[str] = None, resource_ids: list[str] = None, resource_type: str = None, max_results: int = 10

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/Brucedh/aws-ireveal-mcp'

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