← Back to Blog
Header image for blog post: How to run the Claude Code AI coding agent securely in the cloud
Deborah Emeni
Published 21st September 2026

How to run the Claude Code AI coding agent securely in the cloud

Running Claude Code securely in the cloud means giving it an isolated workspace and limiting access to files, credentials, and network connections. Claude Code is an AI coding agent that can edit files, run commands, and test changes. When enabled on a supported platform, Claude Code’s built-in Bash sandbox adds filesystem and network restrictions for sandboxed shell commands and their child processes.

This article shows you how to run Claude Code securely in the cloud with Northflank Cloud Harnesses, from setting up your workspace and configuring access to running your first task.

TL;DR: How to run Claude Code securely in the cloud

Use Northflank Cloud Harnesses to give Claude Code a remote workspace with your repository, development tools, and task-specific access. Create and authenticate the workspace first, then prepare your project, review permissions, and run a small task. Check the changes and test results before keeping the work, and pause or delete the workspace when finished.

  • Create a Cloud Harness, select Claude, and choose where the workspace runs.
  • Authenticate Claude, connect your repository and branch, and configure the runtime and storage.
  • Install the project dependencies and add only the development credentials it needs.
  • Review Claude Code's permissions, use Plan mode, then run your first task and inspect the changes and test results.
  • Configure application ports if needed, keeping public access limited to what you intend to expose.
  • Work through the browser or connect by SSH, monitor the workspace, then pause with persistent storage enabled or export your work and delete it.

Get started with Northflank Cloud Harnesses on a self-serve Pay As You Go plan and follow the Cloud Harness quickstart guide, or book a demo to see how Cloud Harnesses fit your team’s security and infrastructure requirements.

What is a Claude Code sandbox?

A Claude Code sandbox is an environment that restricts what the agent can access while it edits files, runs commands, and tests changes. A cloud sandbox lets you run that work remotely, with a workspace and credentials configured for the project.

Claude Code also includes a built-in Bash sandbox that restricts shell commands and their child processes. A cloud workspace and this command-level sandbox provide different controls; check each separately when configuring access.

How do you run Claude Code securely in the cloud?

Run Claude Code in an isolated cloud workspace with your repository, development tools, and only the credentials its task needs. Review its command permissions, control network access, and inspect the resulting code changes before merging them.

A cloud workspace gives Claude Code somewhere to edit files and run tests away from your laptop. Moving execution there changes which files and services it can reach, so keep production credentials and unrelated data outside that workspace.

Northflank is an AI-agent sandbox and workload platform for running untrusted code in isolated environments on managed infrastructure or in your own cloud. A Cloud Harness brings that infrastructure into an interactive coding workflow: you choose the environment, supply the repository, and work with the agent inside it.

In this tutorial, you will create that workspace with Northflank Cloud Harnesses. Northflank is the cloud platform that runs the workspace; a Cloud Harness brings together your coding agent, repository, runtime tools, and storage. You can use Northflank-managed infrastructure or your own cloud.

What do you need to run Claude Code on Northflank?

Before creating your Cloud Harness, have the following ready:

  • A Northflank account on a Pay As You Go plan.
  • A Claude account with Claude Code access, or an Anthropic API key, for agent authentication.
  • A Git integration if you want to connect an existing repository.

For this walkthrough, use a repository with a test suite, a development branch, and a small task such as fixing a login-form validation error. You can also create a new repository or continue without one during setup.

How do you create a Cloud Harness for Claude Code?

Create the workspace from the Northflank dashboard using the Cloud Harness quickstart.

  1. Create or open a project. A project groups related resources. To create a project, select Create project, enter a name, choose Northflank Cloud or Bring Your Own Cloud under Deployment target, select a region, and create the project. Then open Harnesses.
  2. Select Claude as the coding agent.
  3. Name the Cloud Harness, for example claude-login-fix.
  4. Select the environment where it should run.
  5. Choose authentication. Under Authentication, select an API key or a linked account.
  6. Choose a repository. Under Repository, select an existing repository and branch, create a new repository, or continue without one.
  7. Review Advanced options if needed. You can configure runtime variables, the runtime image, resources, and workspace storage.
  8. Select Create Harness. Northflank opens the terminal. Complete the agent sign-in if prompted.

claude-code-create.png

The workspace is now ready for you to use Claude Code. The sections below cover working on a task and managing access and workspace lifetime after setup.

How do you prepare your project for Claude Code?

Prepare the project inside your Cloud Harness by installing its dependencies, adding any required development configuration, and running its existing tests. Follow your repository's setup instructions, and configure the services and credentials the tests require before running them.

Read installation scripts before running them, especially in an unfamiliar repository. They execute code with access to the credentials available in their environment.

Open Environment variables in the workspace's right sidebar and select Edit. Add the runtime variables or secret files your application requires, then select Update & restart to apply them. These controls are part of Cloud Harness configuration.

env-harness.webp

Add only the development credentials your project needs. Before asking Claude to change code, run the project’s existing tests and keep the results so you can identify any new failures.

Which Claude Code controls should you check before running a task?

Inside your Cloud Harness, review Claude Code’s permission settings before giving it a task. Keep approval checks enabled for actions that need your review, and use Plan mode to inspect Claude’s proposed approach before allowing edits.

If you want to use Claude Code's additional Bash sandbox, run /sandbox inside Claude Code to check its availability and status. Enable it if you intend to rely on it, review its filesystem and network settings, and test a project command inside it. On Linux, confirm that bubblewrap and socat are installed and that the runtime supports sandboxing. Review unsandboxed fallback settings before treating it as an enforced boundary. See the Bash sandbox setup for configuration details.

How do you run and review a Claude Code task?

In your Northflank Cloud Harness, open the Claude Code session and give it a task with a clear stopping point. Adapt this prompt to the validation error in your repository:

Read the project instructions and identify the relevant test command.
Find the login form and investigate the validation error described below.
Explain the cause and propose the smallest relevant fix before editing files.
Do not change unrelated files or add dependencies without asking.

Validation error: <describe the behaviour and paste the failing test output>

Check the proposed files and approach. Then switch to an editing mode and ask Claude to implement the agreed change, add or update the relevant test, and run it. Ask it to show the command used and any failures that remain.

In the Cloud Harness’s shell, run these commands from the repository directory to inspect the changes:

git status --short --untracked-files=all
git diff --stat
git diff
git diff --cached

The status command lists changed and untracked files. The diff commands show a summary, unstaged changes, and staged changes. Open untracked files separately; they do not appear in git diff.

Run the relevant tests yourself and compare the result with the starting failure. Check that the change stays within the task, that dependency changes are necessary, and that no secrets or unrelated files have been added. A passing test helps validate the fix, but it does not replace reviewing the code.

If a command fails because a tool or service is missing, correct the runtime or development configuration and rerun it. Expand access only when you understand why the task needs it.

Complete any application preview checks needed for the task, then commit and push the reviewed changes through your normal pull-request process. Keep the task, starting commit, patch, and test results together so a reviewer can trace the work. Your AI-agent execution audit trail should connect that evidence to any later release.

How do you preview an application built with Claude Code?

To preview the application through Northflank, ask Claude Code to start the development server inside your Cloud Harness and identify its listening port. In the Northflank dashboard, open your Cloud Harness and select the Networking icon in the right sidebar:

  1. Select Add port.
  2. Enter the application's port and select the protocol.
  3. Enable Publicly expose only if the preview needs internet access.
  4. Select Save changes.

configure-harness.webp

The networking controls support private and public ports, with domains for publicly exposed ports. For a web preview, bind the application to 0.0.0.0 so Northflank can route traffic to its listening port.

Before sharing a public preview, check for debug routes, sensitive data, and missing authentication. Remove public access when the review is complete.

Port exposure controls incoming connections. If you also need outbound restrictions on your own cluster, configure BYOC network policies; without egress rules, outbound traffic is allowed.

How do you access your Claude Code workspace through SSH?

You can use Northflank’s SSH access to connect to your Cloud Harness from your local terminal while Claude Code runs in the cloud, or continue working in the browser terminal.

Install and authenticate the Northflank command-line interface (CLI). To connect to your Cloud Harness locally, open its overview in the Northflank dashboard, select Connect under Local access, and copy the generated command. Run it in your local terminal. It has this form:

northflank dev ssh --projectId YOUR_PROJECT_ID --harnessId YOUR_HARNESS_ID

Use the dashboard-generated command, or replace both placeholders with your project and Cloud Harness IDs. This SSH connection gives you access to the existing workspace.

connect-harness.webp

How do you monitor CPU and memory usage in your Claude Code workspace?

You can use Northflank to see how much CPU and memory your Cloud Harness uses while Claude Code runs project commands, installs dependencies, or executes tests. These metrics show resource usage for the workspace, including the processes running inside it.

To monitor your Cloud Harness, open its overview in the Northflank dashboard and select the Observe icon in the right sidebar. Check CPU and memory usage while the slow or demanding task runs to understand whether resource limits may be contributing to the problem.

monitor-harness.webp

If the project needs more resources, select the Settings icon, adjust the resource configuration, and select Update options. Follow the Cloud Harness configuration instructions, then rerun the task and check its behaviour and resource usage again.

How do you pause or delete your Claude Code cloud workspace?

In Northflank, pause the Cloud Harness to return to the work later, or delete it after saving the files you need. An active Cloud Harness keeps running until you pause or delete it; closing your terminal does not stop it.

To pause your Cloud Harness, open its overview and select the Pause harness icon in the top-right corner. With persistent workspace storage enabled, files under /home/harness survive, while terminal sessions and running processes stop. Select Resume harness from the overview when you want to continue, then restart any development servers or other processes you need.

Persistent storage defaults to enabled at creation. If you disabled it, files are lost when the container restarts, is redeployed, or stops.

Before deleting, push your commits or export the files you want to keep. Open the three-dot menu in the top-right corner, select Delete harness, and confirm. Deleting a Cloud Harness permanently removes its associated workspace. Revoke temporary credentials at the services that issued them when they are no longer needed.

Give Claude a workspace for your next development task

Create a Cloud Harness, connect a development branch, and let Claude work on one change you can test and review. Once that workflow works for your project, reuse the environment with clear access and cleanup rules.

Get started with Northflank, or book a demo to discuss your team's infrastructure and security requirements.

Frequently asked questions about Claude Code in Cloud Harnesses

Is a Cloud Harness the same as Claude Code's built-in sandbox?

A Cloud Harness provides the cloud workspace where Claude Code runs. Claude Code's built-in Bash sandbox separately restricts shell commands and their child processes. Check its status with /sandbox inside Claude Code; workspace configuration and command sandboxing are separate controls.

Can I access the Claude Code workspace through SSH?

Yes. Use Local access → Connect to copy the SSH command, then run it with the Northflank CLI installed and authenticated. Claude Code continues working in the remote environment.

Can teammates work in the same workspace?

Yes. Multiple team members can work in the same Northflank Cloud Harness simultaneously. Share access with collaborators authorised to use the repository and development credentials.

Can I run Claude Code in my own cloud?

Yes. You can run Claude Code in your own cloud account using Northflank Cloud Harnesses with Northflank BYOC. Northflank provisions and manages the Kubernetes cluster, while your team owns the cloud account and underlying resources.

Can I keep workspace files between Claude Code sessions?

Yes. You can keep files between Claude Code sessions in a Northflank Cloud Harness with persistent workspace storage enabled. Files under /home/harness survive pause and resume, but terminal sessions and processes stop. Restart the processes you need after resuming, and export any files you want to keep before deleting the Cloud Harness.

Continue with the infrastructure and release controls around your coding workspace:

Share this article with your network
X