Using AI assistants with S3 Storage Lens tables - Amazon Simple Storage Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Using AI assistants with S3 Storage Lens tables

You can use AI assistants and conversational AI tools to interact with your S3 Storage Lens data exported to S3 Tables using natural language. By leveraging the Model Context Protocol (MCP) and the MCP Server for Amazon S3 Tables, you can query, analyze, and gain insights from your storage data without writing SQL queries.

Overview

Model Context Protocol (MCP) is a standardized way for AI applications to access and utilize contextual information. The MCP Server for Amazon S3 Tables provides tools that enable AI assistants to interact with your S3 Tables data using natural language interfaces. This democratizes data access and enables individuals across technical skill levels to work with S3 Storage Lens metrics.

With the MCP Server for S3 Tables, you can use natural language to:

  • List S3 table buckets, namespaces, and tables

  • Query S3 Storage Lens metrics and get insights

  • Analyze storage trends and patterns

  • Identify cost optimization opportunities

  • Generate reports and visualizations

Supported AI assistants

The MCP Server for S3 Tables works with various AI assistants that support the Model Context Protocol, including:

  • Kiro - An AI coding assistant with built-in MCP support

  • Amazon Q Developer - Amazon's AI-powered assistant for developers

  • Cline - An AI coding assistant with MCP integration

  • Claude Desktop - Anthropic's desktop application with MCP support

  • Cursor - An AI-powered code editor

Important

AI-generated SQL queries and recommendations should be reviewed and validated before use. Verify that queries are appropriate for your data structure, use case, and performance requirements. Always test recommendations in a non-production environment before implementing them in production.

Setting up Kiro with S3 Storage Lens tables

Kiro is an AI coding assistant that provides seamless integration with S3 Tables through the MCP Server. Kiro can help you install and configure the MCP Server directly through its interface, simplifying the setup process.

For more information about Kiro, see Kiro AI.

Prerequisites

Before you begin, ensure that you have:

  • Kiro installed on your system. Download from https://kiro.ai/

  • Amazon CLI configured with appropriate credentials

  • An S3 Storage Lens configuration with S3 Tables export enabled

  • Permissions to query S3 Tables. For more information, see Permissions for S3 Storage Lens tables.

Step 1: Install the S3 Tables MCP Server

You can install the S3 Tables MCP Server in two ways:

Option 1: Using Kiro's built-in MCP server management

Kiro can help you discover and install MCP servers directly through its interface:

  1. Open Kiro

  2. Access the MCP server management interface (typically through settings or command palette)

  3. Search for "S3 Tables" or "awslabs.s3-tables-mcp-server"

  4. Follow Kiro's prompts to install and configure the server

Option 2: Manual installation using uvx

Alternatively, you can manually install the MCP Server using uvx, a Python package runner:

uvx awslabs.s3-tables-mcp-server@latest

For more information about installing the MCP Server, see the Amazon S3 Tables MCP Server documentation.

Step 2: Configure Kiro MCP settings

Create or update your Kiro MCP configuration file at ~/.kiro/settings/mcp.json with the following content:

{ "mcpServers": { "awslabs.s3-tables-mcp-server": { "command": "uvx", "args": ["awslabs.s3-tables-mcp-server@latest"], "env": { "AWS_PROFILE": "your-aws-profile", "AWS_REGION": "us-east-1" } } } }

Replace your-aws-profile with your Amazon CLI profile name and us-east-1 with your Amazon Region.

Step 3: Verify the configuration

After configuring the MCP Server, restart Kiro and verify that the S3 Tables tools are available. You can check the available MCP servers in Kiro's settings or by asking Kiro to list available tools.

Example use cases with AI assistants

The following examples demonstrate how to use natural language prompts with AI assistants to interact with S3 Storage Lens data.

Example 1: Query top storage consumers

Prompt: "Show me the top 10 buckets by storage consumption from my S3 Storage Lens data."

The AI assistant will use the MCP Server to query your S3 Storage Lens tables and return the results, including bucket names, storage classes, and storage amounts.

Example 2: Analyze storage growth

Prompt: "Analyze my storage growth over the last 30 days and show me the trend."

The AI assistant will query the storage metrics table, calculate daily storage totals, and present the growth trend.

Example 3: Identify cost optimization opportunities

Prompt: "Find buckets with incomplete multipart uploads older than 7 days that are wasting storage."

The AI assistant will query the storage metrics table for incomplete multipart uploads and provide a list of buckets with potential cost savings.

Example 4: Find cold data candidates

Prompt: "Identify prefixes with no activity in the last 100 days that are stored in hot storage tiers."

The AI assistant will analyze both storage and activity metrics to identify data that could be moved to colder storage tiers for cost optimization.

Example 5: Generate storage reports

Prompt: "Create a summary report of my S3 storage showing total storage, object counts, and request patterns for the last week."

The AI assistant will query multiple tables, aggregate the data, and generate a comprehensive report.

Best practices for using AI assistants

Follow these best practices when using AI assistants with S3 Storage Lens data:

  • Be specific in your prompts - Provide clear, specific instructions about what data you want to analyze and what insights you're looking for.

  • Verify AI-generated queries - Always review and validate the SQL queries and recommendations that the AI assistant generates before executing them or taking action. AI assistants may occasionally produce incorrect queries or recommendations that need to be verified against your specific use case and data.

  • Use appropriate permissions - Ensure that the IAM credentials used by the AI assistant have only the necessary permissions. For read-only analysis, grant only SELECT permissions.

  • Monitor usage - Track the queries executed by AI assistants using Amazon CloudTrail to maintain audit trails.

  • Start with simple queries - Begin with straightforward queries to understand how the AI assistant interprets your prompts, then progress to more complex analysis.

Logging and traceability

When using the S3 Tables MCP Server with AI assistants, you have multiple ways to audit operations:

  • Local logs - The MCP Server logs requests and responses locally. You can specify a log directory using the --log-dir configuration option.

  • Amazon CloudTrail - All S3 Tables operations via the MCP Server using PyIceberg will have awslabs/mcp/s3-tables-mcp-server/<version> as the user agent string. You can filter CloudTrail logs by this user agent to trace actions performed by AI assistants.

  • AI assistant history - AI assistants like Kiro and Cline maintain history logs that record natural language requests, LLM responses, and instructions provided to the MCP Server.

Security considerations

When using AI assistants with S3 Storage Lens data, follow these security best practices:

  • Use least privilege access - Grant AI assistants only the minimum permissions required for their tasks.

  • Enable MFA - Use multi-factor authentication for Amazon accounts that AI assistants access.

  • Review permissions regularly - Periodically audit the permissions granted to AI assistants and revoke unnecessary access.

  • Use separate credentials - Consider using separate Amazon credentials for AI assistant access to facilitate tracking and auditing.

  • Avoid sharing sensitive data - Be cautious about sharing sensitive information in prompts to AI assistants, especially when using cloud-based AI services.

Troubleshooting

AI assistant cannot connect to S3 Tables

Problem: The AI assistant reports that it cannot connect to S3 Tables or the MCP Server is not responding.

Solution:

  • Verify that the MCP Server is correctly installed using uvx awslabs.s3-tables-mcp-server@latest --version

  • Check that your Amazon credentials are configured correctly

  • Ensure that the MCP configuration file has the correct Amazon profile and region

Access denied errors

Problem: The AI assistant receives access denied errors when querying S3 Storage Lens tables.

Solution:

  • Verify that analytics integration is enabled on the aws-s3 table bucket

  • Check that Lake Formation permissions are correctly configured

  • Ensure that the Amazon credentials have the necessary IAM permissions

Incorrect or unexpected results

Problem: The AI assistant returns incorrect or unexpected results.

Solution:

  • Review the SQL query generated by the AI assistant

  • Verify that you're using the correct namespace name for your Storage Lens configuration

  • Check that data is available by querying the latest report_time

  • Refine your prompt to be more specific about what you want to analyze

Additional resources

For more information about using AI assistants with S3 Tables, see the following resources: