networkinsights_start_analysis
Initiate Network Access Scope analysis to assess and document AWS network security configurations and permissions.
Instructions
Start a Network Access Scope analysis.
Parameters:
aws_region (str): AWS region - use 'us-east-1' if not specified.
scope_id (str): The NetworkInsightsAccessScopeId to analyze.
dry_run (bool): If True, checks permissions without starting.
tag_specifications (list): TagSpecification dicts for annotating the analysis.
client_token (str): Idempotency token for the request.
Returns:
str: JSON representation of the NetworkInsightsAccessScopeAnalysis object.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| aws_region | Yes | ||
| scope_id | Yes | ||
| dry_run | No | ||
| tag_specifications | No | ||
| client_token | No |
Implementation Reference
- server.py:891-926 (handler)This is the handler function for the 'networkinsights_start_analysis' tool. It uses the boto3 EC2 client to start a Network Insights Access Scope analysis, passing parameters like scope_id, dry_run, tags, and client_token. It returns the JSON of the created analysis object.@mcp.tool() async def networkinsights_start_analysis( aws_region: str, scope_id: str, dry_run: bool = False, tag_specifications: list[dict] = None, client_token: str = None ) -> str: """ Start a Network Access Scope analysis. Parameters: aws_region (str): AWS region - use 'us-east-1' if not specified. scope_id (str): The NetworkInsightsAccessScopeId to analyze. dry_run (bool): If True, checks permissions without starting. tag_specifications (list): TagSpecification dicts for annotating the analysis. client_token (str): Idempotency token for the request. Returns: str: JSON representation of the NetworkInsightsAccessScopeAnalysis object. """ client = boto3.client('ec2', region_name=aws_region) params = {'NetworkInsightsAccessScopeId': scope_id} if dry_run: params['DryRun'] = True if tag_specifications: params['TagSpecifications'] = [{ 'ResourceType': 'network-insights-access-scope-analysis', 'Tags': tag_specifications }] if client_token: params['ClientToken'] = client_token response = client.start_network_insights_access_scope_analysis(**params) analysis = response.get('NetworkInsightsAccessScopeAnalysis', {}) return json.dumps(analysis, indent=2, cls=DateTimeEncoder)