Skip to content

From Dev to Production: Deployment and Administration

From Dev to Production: Deployment and Administration

Section titled “From Dev to Production: Deployment and Administration”

Taking your AI-powered solutions from your local machine to a scalable, secure production environment is a critical step. This chapter covers the essentials of deploying, managing, and monitoring Claude Code in a professional setting.

Running Claude Code through dedicated cloud services like Amazon Bedrock and Google Vertex AI offers significant advantages in terms of scalability, security, and manageability.

Amazon Bedrock provides a fully managed service to access foundation models. To use Claude Code with Bedrock, you first need to request model access in the AWS console. Then, configure your environment to use AWS credentials instead of a direct Anthropic API key.

  • Authentication: Claude Code will automatically use the standard AWS credential chain (environment variables, .aws/credentials file, IAM roles). The /login and /logout commands are disabled as auth is managed via AWS.
  • Configuration: You must set the AWS_REGION environment variable. You can also specify an AWS_PROFILE if you have multiple configurations.
  • Token Management: Bedrock has specific throttling logic. It’s recommended to set CLAUDE_CODE_MAX_OUTPUT_TOKENS to at least 4096 in your configuration to avoid premature task failures.

Similarly, Google’s Vertex AI provides access to Claude models within the Google Cloud ecosystem. Deployment involves authenticating your environment with Google Cloud credentials and configuring Claude Code to route its requests through the Vertex AI API.

  • Authentication: Use the gcloud auth application-default login command to authenticate your environment. Claude Code will then pick up these credentials automatically.
  • Project Configuration: You’ll need to set your Google Cloud Project ID and the appropriate location (region) in your environment for Claude Code to connect successfully.
Section titled “Navigating Corporate Proxies and LLM Gateways”

In many corporate environments, direct internet access is restricted. To use Claude Code, you’ll need to configure it to work with your company’s network infrastructure.

  • Corporate Proxies: If your network routes traffic through an HTTP/S proxy, you must set the standard HTTP_PROXY and HTTPS_PROXY environment variables. Claude Code will respect these settings for all its network requests.
  • LLM Gateways: An LLM Gateway is a specialized proxy that sits between your application and the AI model provider. It provides centralized control over security, cost management, and observability. To use Claude Code with a gateway, you typically configure the API endpoint in your settings file to point to the gateway’s URL instead of the default Anthropic API endpoint.

When deploying on AWS or Google Cloud, use their native IAM services to enforce the principle of least privilege. Create dedicated IAM roles or service accounts for your Claude Code applications with policies that grant only the necessary permissions (e.g., bedrock:InvokeModel) to interact with the Claude models. Avoid using root user credentials or overly permissive policies in production.

Security is paramount. Follow these guidelines to protect your applications:

  • Key Management: Never hardcode API keys or credentials in your source code. Use a secrets management service like AWS Secrets Manager, Google Secret Manager, or GitHub Secrets.
  • Sandbox Execution: Claude Code operates within the boundaries of the project folder you run it in. Be cautious when granting it access to sensitive directories. Always review code or commands that modify the file system.
  • Input Validation: Sanitize and validate any user-provided input that is passed into a prompt to mitigate the risk of prompt injection attacks.

Understanding your usage is key to managing costs and performance.

  • Data Usage: Be aware of Anthropic’s data usage policies. Data sent to the API is not used to train their foundational models unless you opt-in to submit it for that purpose.
  • Monitoring: Use cloud-native monitoring tools (like Amazon CloudWatch or Google Cloud Monitoring) to track API latency, error rates, and token counts. Third-party services like Datadog also offer integrations for detailed cost and usage breakdowns.
  • Cost Analysis: Costs are primarily driven by the number of input and output tokens processed. Use the most cost-effective model that meets your needs (e.g., use Sonnet for simpler tasks and Opus for complex reasoning). Implement caching strategies for repeated queries and set usage alerts to avoid unexpected bills.