Guide · Amazon S3 · Storage Cost Optimization

S3 Intelligent-Tiering for MCP Servers — Automatic Cost Optimization for Stored Artifacts

MCP servers frequently accumulate large volumes of stored objects: cached LLM responses, pre-computed embeddings, model checkpoints, training datasets, audit logs, and schema snapshots. Most of these objects have an access pattern that front-loads reads shortly after creation and then rarely gets touched again — exactly the pattern S3 Intelligent-Tiering is designed for. Intelligent-Tiering monitors each object's access frequency and automatically moves it through storage tiers (Frequent Access → Infrequent Access → Archive Instant Access → optional deep archive tiers), cutting storage costs by up to 68% for cold objects with zero retrieval fees on the three automatic tiers and no need for lifecycle rules per prefix. This guide explains how to configure Intelligent-Tiering in an MCP server's Node.js tooling, which tiers exist and when to use each, how to activate the optional archive tiers, and how to monitor tier distribution via CloudWatch and S3 Storage Lens.

TL;DR

Set StorageClass: 'INTELLIGENT_TIERING' on every PutObject call that stores MCP artifacts >128 KB. Enable the Archive Instant Access tier at bucket level (90-day activation, millisecond retrieval, 68% cheaper than Frequent Access) unless you need sub-second access for objects older than 90 days. Skip the deep Archive and Deep Archive tiers for MCP runtime data — their hours-long retrieval time is incompatible with real-time tool responses. Monitor tier distribution using the AWS/S3 CloudWatch metric BucketSizeBytes grouped by StorageType: IntelligentTieringFAStorage, IntelligentTieringIAStorage, and IntelligentTieringAIAStorage. Objects smaller than 128 KB are billed as Frequent Access regardless of tier — do not store many small objects in Intelligent-Tiering buckets.

Intelligent-Tiering tiers and pricing

Intelligent-Tiering has five tiers, three of which are automatic and two optional (must be explicitly activated):

TierActivationRetrieval timeRetrieval feeStorage rate (us-east-1)
Frequent Access (FA)Default; all objects start hereMillisecondsNone$0.023/GB/mo (same as S3 Standard)
Infrequent Access (IA)Automatic after 30 days no accessMillisecondsNone$0.0125/GB/mo (45% cheaper)
Archive Instant Access (AIA)Automatic after 90 days no access if AIA activatedMillisecondsNone$0.004/GB/mo (83% cheaper)
ArchiveOpt-in; 90–730 day threshold3–5 hours (Expedited: 1–5 min)$0.01–0.03/GB$0.0036/GB/mo
Deep ArchiveOpt-in; 180–730 day threshold12 hours (Bulk: 48 hours)$0.0025/GB$0.00099/GB/mo

Key rules:

Putting objects with Intelligent-Tiering in Node.js

Setting Intelligent-Tiering is a single field on PutObjectCommand:

import { S3Client, PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";

const s3 = new S3Client({ region: "us-east-1" });
const BUCKET = "mcp-artifacts";

// Store a pre-computed embedding — will auto-tier as access frequency drops
export async function storeEmbedding(id: string, embedding: Float32Array): Promise<void> {
  const buffer = Buffer.from(embedding.buffer);

  await s3.send(new PutObjectCommand({
    Bucket: BUCKET,
    Key: `embeddings/${id}.bin`,
    Body: buffer,
    ContentType: "application/octet-stream",
    StorageClass: "INTELLIGENT_TIERING",
    // Optional: tag for cost allocation and S3 Storage Lens grouping
    Tagging: "project=mcp&type=embedding",
  }));
}

// Retrieve an embedding — if in IA or AIA, retrieval is still milliseconds
// No code change needed: GetObject works identically across all three auto tiers
export async function getEmbedding(id: string): Promise<Float32Array> {
  const response = await s3.send(new GetObjectCommand({
    Bucket: BUCKET,
    Key: `embeddings/${id}.bin`,
  }));

  const buffer = await response.Body!.transformToByteArray();
  return new Float32Array(buffer.buffer);
}

For MCP tool handlers that cache serialized tool responses:

import { createHash } from "crypto";
import { GetObjectCommand, PutObjectCommand, NoSuchKey } from "@aws-sdk/client-s3";

const CACHE_BUCKET = "mcp-response-cache";
const TTL_SECONDS = 7 * 24 * 60 * 60; // 7 days

function cacheKey(toolName: string, params: unknown): string {
  const hash = createHash("sha256")
    .update(toolName + JSON.stringify(params))
    .digest("hex");
  return `cache/${toolName}/${hash}.json`;
}

export async function getCachedResponse(toolName: string, params: unknown): Promise<unknown | null> {
  try {
    const response = await s3.send(new GetObjectCommand({
      Bucket: CACHE_BUCKET,
      Key: cacheKey(toolName, params),
    }));

    // Check custom expiry header
    const expiresAt = response.Metadata?.["expires-at"];
    if (expiresAt && Date.now() > parseInt(expiresAt, 10)) {
      return null; // Logically expired — let caller re-compute
    }

    const body = await response.Body!.transformToString();
    return JSON.parse(body);
  } catch (err: any) {
    if (err.name === "NoSuchKey") return null;
    throw err;
  }
}

export async function setCachedResponse(
  toolName: string,
  params: unknown,
  result: unknown,
): Promise<void> {
  await s3.send(new PutObjectCommand({
    Bucket: CACHE_BUCKET,
    Key: cacheKey(toolName, params),
    Body: JSON.stringify(result),
    ContentType: "application/json",
    StorageClass: "INTELLIGENT_TIERING",
    Metadata: {
      "tool-name": toolName,
      "cached-at": Date.now().toString(),
      "expires-at": (Date.now() + TTL_SECONDS * 1000).toString(),
    },
  }));
}

Cached tool responses are a perfect fit for Intelligent-Tiering: a cache entry is read frequently right after creation (the first few identical tool calls benefit from cache hits), then access drops off as the cache entry ages, and eventually it moves to the IA or AIA tier at a fraction of the original cost — without any lifecycle rule management.

Activating the Archive Instant Access tier

The Archive Instant Access tier (AIA) reduces costs to $0.004/GB — an 83% reduction from Standard — while maintaining millisecond retrieval. For MCP server artifacts that are accessed rarely but cannot tolerate multi-hour retrieval delays, AIA is the optimal archive tier.

Activate AIA at the bucket level using PutBucketIntelligentTieringConfiguration:

import {
  S3Client,
  PutBucketIntelligentTieringConfigurationCommand,
  IntelligentTieringStatus,
  IntelligentTieringAccessTier,
} from "@aws-sdk/client-s3";

const s3 = new S3Client({ region: "us-east-1" });

await s3.send(new PutBucketIntelligentTieringConfigurationCommand({
  Bucket: "mcp-artifacts",
  Id: "enable-aia",
  IntelligentTieringConfiguration: {
    Id: "enable-aia",
    Status: IntelligentTieringStatus.Enabled,
    // No filter = applies to ALL Intelligent-Tiering objects in the bucket
    Tierings: [
      {
        AccessTier: IntelligentTieringAccessTier.ARCHIVE_INSTANT_ACCESS,
        Days: 90, // Objects not accessed for 90 days move to AIA
      },
    ],
  },
}));

After activation, any object in the bucket using INTELLIGENT_TIERING storage class that hasn't been accessed in 90 days will move to the Archive Instant Access tier automatically. Access it normally with GetObjectCommand — no restore step needed, response begins within milliseconds.

To add scope to only specific object prefixes:

await s3.send(new PutBucketIntelligentTieringConfigurationCommand({
  Bucket: "mcp-artifacts",
  Id: "aia-embeddings-only",
  IntelligentTieringConfiguration: {
    Id: "aia-embeddings-only",
    Status: IntelligentTieringStatus.Enabled,
    Filter: {
      Prefix: "embeddings/",  // Only apply to embedding objects
    },
    Tierings: [
      {
        AccessTier: IntelligentTieringAccessTier.ARCHIVE_INSTANT_ACCESS,
        Days: 90,
      },
    ],
  },
}));

You can have up to 1,000 Intelligent-Tiering configurations per bucket. Each configuration applies to its own prefix/tag filter independently.

Do not activate the deep Archive or Deep Archive tiers for objects that MCP tool handlers may need to read at request time. If a tool calls GetObjectCommand on a Deep Archive object, it receives InvalidObjectState (HTTP 403) until the restore completes — which takes up to 12 hours. Reserve deep tiers for backup-only objects (compliance snapshots, cold audit logs) that your MCP tools will never read in real time.

Bucket configuration for MCP artifacts

When setting up an S3 bucket dedicated to MCP server artifacts, combine Intelligent-Tiering with lifecycle rules that handle objects too small to benefit from tiering:

import {
  CreateBucketCommand,
  PutBucketLifecycleConfigurationCommand,
  PutBucketEncryptionCommand,
  PutPublicAccessBlockCommand,
  ServerSideEncryptionAlgorithm,
} from "@aws-sdk/client-s3";

const BUCKET = "mcp-artifacts";
const REGION = "us-east-1";

// 1. Create bucket
await s3.send(new CreateBucketCommand({
  Bucket: BUCKET,
  // us-east-1 does NOT use CreateBucketConfiguration; other regions do
}));

// 2. Block all public access
await s3.send(new PutPublicAccessBlockCommand({
  Bucket: BUCKET,
  PublicAccessBlockConfiguration: {
    BlockPublicAcls: true,
    IgnorePublicAcls: true,
    BlockPublicPolicy: true,
    RestrictPublicBuckets: true,
  },
}));

// 3. Enable default encryption (SSE-S3; use SSE-KMS if you need key audit trail)
await s3.send(new PutBucketEncryptionCommand({
  Bucket: BUCKET,
  ServerSideEncryptionConfiguration: {
    Rules: [{
      ApplyServerSideEncryptionByDefault: {
        SSEAlgorithm: ServerSideEncryptionAlgorithm.AES256,
      },
      BucketKeyEnabled: true, // Reduces KMS API calls if you later switch to SSE-KMS
    }],
  },
}));

// 4. Lifecycle rules for small objects and expired cache entries
await s3.send(new PutBucketLifecycleConfigurationCommand({
  Bucket: BUCKET,
  LifecycleConfiguration: {
    Rules: [
      {
        ID: "expire-cache-entries",
        Status: "Enabled",
        Filter: { Prefix: "cache/" },
        Expiration: { Days: 30 }, // Hard delete after 30 days regardless of access
      },
      {
        ID: "expire-temp-uploads",
        Status: "Enabled",
        Filter: { Prefix: "tmp/" },
        Expiration: { Days: 1 },
      },
      {
        ID: "cleanup-incomplete-multipart",
        Status: "Enabled",
        Filter: { Prefix: "" }, // Applies to all prefixes
        AbortIncompleteMultipartUpload: { DaysAfterInitiation: 7 },
      },
    ],
  },
}));

Monitoring tier distribution

Track how your objects are distributed across Intelligent-Tiering tiers using CloudWatch and S3 Storage Lens.

CloudWatch bucket metrics

Enable CloudWatch request metrics per prefix to see per-tier storage bytes. The BucketSizeBytes metric includes a StorageType dimension with Intelligent-Tiering sub-types:

import { CloudWatchClient, GetMetricStatisticsCommand } from "@aws-sdk/client-cloudwatch";

const cw = new CloudWatchClient({ region: "us-east-1" });

async function getIntelligentTieringDistribution(bucketName: string) {
  const tiers = [
    "IntelligentTieringFAStorage",   // Frequent Access
    "IntelligentTieringIAStorage",   // Infrequent Access
    "IntelligentTieringAIAStorage",  // Archive Instant Access
  ] as const;

  const now = new Date();
  const yesterday = new Date(now.getTime() - 86_400_000);

  const results = await Promise.all(tiers.map(tier =>
    cw.send(new GetMetricStatisticsCommand({
      Namespace: "AWS/S3",
      MetricName: "BucketSizeBytes",
      Dimensions: [
        { Name: "BucketName", Value: bucketName },
        { Name: "StorageType", Value: tier },
      ],
      StartTime: yesterday,
      EndTime: now,
      Period: 86400,
      Statistics: ["Average"],
    }))
  ));

  return Object.fromEntries(tiers.map((tier, i) => [
    tier,
    results[i].Datapoints?.[0]?.Average ?? 0,
  ]));
}

// Example output:
// {
//   IntelligentTieringFAStorage: 1_073_741_824,   // 1 GB hot
//   IntelligentTieringIAStorage: 5_368_709_120,   // 5 GB warm
//   IntelligentTieringAIAStorage: 42_949_672_960, // 40 GB cold
// }

CloudWatch S3 storage metrics are daily and reported at midnight UTC. They are not real-time. Use them for weekly cost reporting and trend analysis, not operational alerting.

S3 Storage Lens

S3 Storage Lens provides bucket-level insights aggregated across your account including cost efficiency scores that flag objects in Standard storage that could benefit from tiering, and activity heat maps showing access frequency per prefix. Enable the free-tier dashboard via the S3 console or API — it requires no additional S3 object configuration.

import { S3ControlClient, PutStorageLensConfigurationCommand } from "@aws-sdk/client-s3-control";
import { STSClient, GetCallerIdentityCommand } from "@aws-sdk/client-sts";

const sts = new STSClient({ region: "us-east-1" });
const { Account } = await sts.send(new GetCallerIdentityCommand({}));

const control = new S3ControlClient({ region: "us-east-1" });
await control.send(new PutStorageLensConfigurationCommand({
  AccountId: Account!,
  ConfigId: "mcp-storage-lens",
  StorageLensConfiguration: {
    Id: "mcp-storage-lens",
    IsEnabled: true,
    AccountLevel: {
      BucketLevel: {
        ActivityMetrics: { IsEnabled: true },
        PrefixLevel: {
          StorageMetrics: {
            IsEnabled: true,
            SelectionCriteria: {
              MaxDepth: 2,       // e.g., embeddings/, cache/, logs/
              Delimiter: "/",
            },
          },
        },
      },
    },
  },
}));

When to use Intelligent-Tiering vs other storage classes

ScenarioRecommended classReason
Embeddings >128 KB, accessed after creation then rarelyINTELLIGENT_TIERINGAutomatic cost reduction as access drops; millisecond retrieval always
Cached tool responses, 7–30 day TTLINTELLIGENT_TIERINGCache hits concentrated at creation; older entries auto-move to IA
Model artifacts that never change, accessed infrequently but on-demandSTANDARD_IAKnown infrequent access pattern; predictable cost; no monitoring fee
Audit logs written once, never read unless compliance checkGLACIER_IR or S3 Object Lock + GLACIERKnown access pattern (rarely or never); lower cost than AIA; pair with Object Lock for WORM
Temporary upload scratch space, deleted <24hSTANDARD + lifecycle ExpirationToo short-lived for tiering to help; lifecycle does the cleanup
Thousands of tiny objects (<128 KB each)STANDARDTiering monitoring fee ($0.0025/1K objects) exceeds savings on small objects

IAM permissions

Your MCP server's execution role needs standard S3 permissions. For configuring Intelligent-Tiering at bucket level, the deployment role (not the runtime role) needs the management actions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "MCPRuntimeS3",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject",
        "s3:HeadObject"
      ],
      "Resource": "arn:aws:s3:::mcp-artifacts/*"
    },
    {
      "Sid": "MCPDeployS3Tiering",
      "Effect": "Allow",
      "Action": [
        "s3:PutBucketIntelligentTieringConfiguration",
        "s3:GetBucketIntelligentTieringConfiguration",
        "s3:ListBucketIntelligentTieringConfigurations",
        "s3:PutLifecycleConfiguration",
        "s3:GetLifecycleConfiguration"
      ],
      "Resource": "arn:aws:s3:::mcp-artifacts"
    }
  ]
}

The runtime role does not need PutBucketIntelligentTieringConfiguration — that is a bucket-level administrative action done once during deployment, not per-request.

Common errors and fixes

ErrorCauseFix
InvalidObjectState (403) on GetObjectObject is in Archive or Deep Archive tier and hasn't been restoredOnly AIA, IA, and FA tiers support immediate GetObject. For Archive tiers, call RestoreObjectCommand first (1–5 min Expedited, 3–5 hr Standard)
No cost reduction after 30+ daysObjects <128 KB do not transition — billing stays at FA rateUse Standard-IA lifecycle rules for uniform small objects; Intelligent-Tiering only helps objects ≥128 KB
AIA tier activation not taking effectPutBucketIntelligentTieringConfiguration not called, or configuration is Disabled, or object is not using INTELLIGENT_TIERING storage classVerify with GetBucketIntelligentTieringConfiguration; ensure objects were PUT with StorageClass: 'INTELLIGENT_TIERING'
High monitoring fees despite few objectsLarge number of small objects (<128 KB) incurring per-object monitoring fee with no savingsFilter Intelligent-Tiering configuration to Filter.ObjectSizeGreaterThan: 131072 to skip small objects from tiering entirely
InvalidArgument on PutBucketIntelligentTieringConfigurationArchive tier Days value conflict (Deep Archive must be > Archive days if both specified)Archive minimum 90 days; Deep Archive minimum 180 days and must be strictly greater than Archive Days value

Related guides