Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Deploy an MCP Server on ECS Fargate with CDK: Connect Claude Through Bedrock

A practical guide to the AWS CDK/Fargate pattern for MCP tools, including Bedrock-based Claude access, deployment prerequisites, networking, and security.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can deploy MCP tools on ECS Fargate with AWS CDK, but the AWS Samples design behind this guide does not run Claude inside a container. It runs an agent service that accesses Claude Sonnet 4 through Amazon Bedrock, alongside two separate MCP server services. That distinction matters: a Claude remote custom connector uses a different network path and requires a publicly reachable MCP endpoint.

Choose how Claude will reach your MCP tools

This guide follows the AWS Samples CDK architecture: an agent service calls Claude Sonnet 4 through Bedrock and communicates with MCP servers running as ECS services. ECS Service Connect handles service-to-service communication. The model is hosted through Bedrock; it is not deployed in your Fargate task.

As an Amazon Associate I earn from qualifying purchases.

Design Where Claude runs Network path to the MCP server When to use it
Agent using Claude through Bedrock Claude Sonnet 4 is accessed as a Bedrock-hosted model by the agent service. The agent and MCP services can communicate inside the VPC using ECS Service Connect; public ingress is not inherently required for that internal connection. Use this for the AWS CDK/Fargate pattern described in this guide.
Claude remote custom connector Claude runs in Anthropic’s hosted client environment and connects to your remote server. The MCP endpoint must be publicly reachable from Anthropic’s cloud infrastructure and its IP ranges. A private-VPC-only endpoint will not work for this connector flow. Use this when configuring a remote custom connector in a hosted Claude client, not as a private-only service-to-service setup.

Anthropic states: “When you add a custom connector, Claude connects to your remote MCP server from Anthropic’s cloud infrastructure, rather than from your local device.” Its connector guidance also describes authentication options such as sign-in modes and fixed request headers; check Anthropic’s current requirements and published IP ranges when setting up that separate design.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the CDK deployment contains

The AWS Samples project is the closest documented match for CDK, Fargate, Claude, and MCP. Its example includes an Application Load Balancer, an AI service, a custom Python MCP server, and an AWS API MCP server. The AI service is configured for Claude Sonnet 4 through Bedrock; ECS Service Connect supports communication among services. In the example, the AWS API MCP server is restricted to listing S3 buckets. That permission scope and the sample’s API-key arrangement are example choices, not defaults every deployment should copy.

AWS also describes a separate ECS walkthrough with a Gradio UI, a Bedrock-backed agent, and a FastMCP server. In that topology, the UI is exposed through an Application Load Balancer while the agent and MCP server communicate within the VPC, and the server reads catalog data from S3. It is useful as an architecture reference, but it uses CloudFormation and Amazon Nova 2 Lite rather than the CDK/Claude combination in this guide.

Prerequisites for the AWS Samples CDK example

  • Node.js 20 or later.
  • Docker.
  • A configured AWS CLI and credentials for the AWS account and region where you will deploy.
  • Access to the Claude Sonnet 4 model in Amazon Bedrock in the target environment.
  • Permission to bootstrap CDK resources and deploy the required AWS services.

These are the CDK sample’s documented prerequisites, not universal requirements for every MCP deployment on Fargate. The separate AWS ECS walkthrough specifies AWS CLI v2.32.0 or later, Docker 20.10 or later with buildx, Git, jq, Bash, and Bedrock access to Nova 2 Lite; those version and tool requirements belong to that walkthrough, not this CDK sample.

Deploy the CDK and Fargate sample

  1. Review the AWS Samples repository and its README. Confirm the current stack configuration, IAM permissions, model identifier and region support, container definitions, and ingress rules before deploying. The repository is a starting point; inspect its code rather than treating sample settings as production defaults.
  2. Install the project dependencies. Use the dependency installation instructions in the repository README. The available deployment instructions establish that dependencies must be installed, but do not specify a single command here.
  3. Authenticate Docker to public ECR. Follow the repository’s stated login instructions before the image build or deployment. Docker is needed for the container images.
  4. Configure and bootstrap CDK. Ensure the AWS CLI is using the intended account and region, then bootstrap that AWS environment as directed by the README. Bootstrapping prepares the account and region for CDK deployments.
  5. Deploy the stack. From the project directory, run npm run cdk deploy, the deployment command named in the README. Review the proposed changes and approve the deployment when prompted.
  6. Check the deployed resources and access path. Confirm that the expected ECS services, load balancer, service discovery/connectivity, IAM roles, secrets, and networking were created. Validate that the agent can reach its MCP services and that the Bedrock model access is configured for the deployed region.

The README’s sample output reports 362.32 seconds, but that is repository-provided example output with no established measurement date; it is not a benchmark or a deployment-time promise. A separate AWS ECS article estimates 30–40 minutes for its own CloudFormation/Nova walkthrough, not for this CDK deployment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Adapt the sample safely for your tools

Define each tool’s downstream permissions

Give each MCP server only the AWS permissions its tools require. The example’s bucket-list-only AWS API permissions are deliberately narrower than broad account access; do not expand that scope without a specific need. If a tool reads or writes other resources, scope its task role to the required actions and resources, and consider separating tools with materially different privileges into distinct services or roles.

Secure both sides of the MCP boundary

There are two authorization questions: which client or agent may call an MCP tool, and what the MCP server may do against downstream systems. An API key in an x-api-key header is one mechanism used by the sample’s load-balancer example, not a complete authorization policy. For a public remote connector, protect the HTTPS endpoint with a suitable authentication method, authorize individual tools and operations, and account for tenant separation. For the Bedrock agent design, restrict service access within the VPC and avoid assuming that private networking alone provides application-level authorization.

Keep direct AWS access in scope

If the agent or its user can also run shell commands or AWS CLI calls, those calls can reach AWS APIs without passing through MCP. MCP-specific controls therefore do not replace least-privilege IAM roles or broader AWS account and organization guardrails.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose networking and session behavior deliberately

For an agent and MCP server that are both intended to run inside the VPC, private service-to-service communication can be appropriate. AWS’s ECS walkthrough demonstrates that pattern with the UI exposed and the agent-to-MCP traffic kept within the VPC. By contrast, a Claude remote custom connector must reach a public HTTPS endpoint from Anthropic’s infrastructure. Do not make that connector depend on a private-only service address.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For horizontally replicated servers, stateless Streamable HTTP can avoid dependence on session affinity. If a workflow is stateful and uses an Mcp-Session-Id, decide how sessions are maintained and routed before adding replicas; the session behavior must match the load-balancing and scaling design.

Other ways to connect Claude and ECS

If the goal is for Claude Code or another assistant to inspect and troubleshoot ECS itself, AWS documents a managed Amazon ECS MCP server. The documented service is in preview and subject to change; it uses AWS IAM permissions and MCP Proxy for AWS to sign requests with SigV4. It is an alternative for ECS operations, not a self-built MCP server deployed to Fargate with CDK.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.