Skip to main content
Glama

config_get_resource_config_history

Retrieve AWS resource configuration snapshots within a specified time range. Input AWS region, resource type, ID, start and end timestamps, and limit to fetch historical configurations.

Instructions

Fetch configuration snapshots for a resource between two ISO timestamps. Parameters: aws_region (str): The AWS region - use 'us-east-1' if not specified. resource_type (str): e.g. 'AWS::S3::Bucket'. resource_id (str): the resource's ARN or ID. start_time (str): ISO timestamp, e.g. '2025-04-01T00:00:00Z'. end_time (str): ISO timestamp. limit (int): Maximum number of configuration items to return. Returns: JSON list of ConfigurationItem objects.

Input Schema

NameRequiredDescriptionDefault
aws_regionYes
end_timeYes
limitNo
resource_idYes
resource_typeYes
start_timeYes

Input Schema (JSON Schema)

{ "properties": { "aws_region": { "title": "Aws Region", "type": "string" }, "end_time": { "title": "End Time", "type": "string" }, "limit": { "default": 10, "title": "Limit", "type": "integer" }, "resource_id": { "title": "Resource Id", "type": "string" }, "resource_type": { "title": "Resource Type", "type": "string" }, "start_time": { "title": "Start Time", "type": "string" } }, "required": [ "aws_region", "resource_type", "resource_id", "start_time", "end_time" ], "title": "config_get_resource_config_historyArguments", "type": "object" }

Implementation Reference

  • The handler function decorated with @mcp.tool() implements the 'config_get_resource_config_history' tool. It uses the AWS Config boto3 client to retrieve the configuration history for a specified resource between given timestamps, parses the timestamps, handles errors, and returns JSON-serialized configuration items using a custom DateTimeEncoder.
    @mcp.tool() def config_get_resource_config_history( aws_region: str, resource_type: str, resource_id: str, start_time: str, end_time: str, limit: int = 10 ) -> str: """ Fetch configuration snapshots for a resource between two ISO timestamps. Parameters: aws_region (str): The AWS region - use 'us-east-1' if not specified. resource_type (str): e.g. 'AWS::S3::Bucket'. resource_id (str): the resource's ARN or ID. start_time (str): ISO timestamp, e.g. '2025-04-01T00:00:00Z'. end_time (str): ISO timestamp. limit (int): Maximum number of configuration items to return. Returns: JSON list of ConfigurationItem objects. """ client = boto3.client('config', region_name=aws_region) # Parse ISO timestamps into datetime (with UTC) try: start_dt = datetime.datetime.fromisoformat(start_time.replace('Z', '+00:00')) end_dt = datetime.datetime.fromisoformat(end_time.replace('Z', '+00:00')) except Exception as e: return f"Error parsing timestamps: {e}" resp = client.get_resource_config_history( resourceType=resource_type, resourceId=resource_id, earlierTime=start_dt, laterTime=end_dt, limit=limit ) items = resp.get("configurationItems", []) return json.dumps(items, indent=2, cls=DateTimeEncoder)
  • Custom JSON encoder class used by the tool to properly serialize datetime objects in the response JSON.
    class DateTimeEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, datetime.datetime): return o.isoformat() # Convert datetime to ISO-format string. return super().default(o)

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