id
stringlengths
36
36
document
stringlengths
3
3k
metadata
stringlengths
23
69
embeddings
listlengths
384
384
c27023ad-0ab5-4c8e-906a-3bf85f91f1fd
Using several discrete yet overlapping data systems in a machine learning pipeline may introduce an unnecessary, and often costly, overhead of shipping data around from one to another. A great illustration of this tradeoff is the vector database. Vector databases are designed for the hyper-specific machine learning task of storing and searching across vectors. While this may be the right choice in some architectures, a vector database may be an unnecessary new addition to the tech stack in others, as it is yet another system to integrate with, manage, and ship data to and from. Most modern general-purpose databases come with vector support out-of-the-box (or through a plugin) and have more extensive and cross-cutting capabilities. In other words, there may be no need for a net new database to specifically handle vectors in those architectures at all. The importance boils down to whether the vector-specific convenience features (e.g. inbuilt embedding models) are mission-critical and worth the cost. Data exploration {#data-exploration} After defining the machine learning problem, goals, and success criteria, a common first step is to explore the relevant data that will be used for model training and evaluation. During this step, data is analyzed to understand its characteristics, distributions, and relationships. This process of evaluation and understanding is an iterative one, often resulting in a series of ad-hoc queries being executed across datasets, where query responsiveness is critical (along with other factors such as cost-efficiency and accuracy). As companies store increasing amounts of data to leverage for machine learning purposes, the problem of examining the data you have becomes harder. This is because analytics and evaluation queries often become tediously or prohibitively slow at scale with traditional data systems. Some of the big players impose significantly increased costs to bring down query times, and discourage ad-hoc evaluation by way of charging per query or by number of bytes scanned. Engineers may resort to pulling subsets of data down to their local machines as a compromise for these limitations. ClickHouse, on the other hand, is a real-time data warehouse, so users benefit from industry-leading query speeds for analytical computations. Further, ClickHouse delivers high performance from the start, and doesn’t gate critical query-accelerating features behind higher pricing tiers. ClickHouse can also query data directly from object storage or data lakes, with support for common formats such as Iceberg, Delta Lake, and Hudi. This means that no matter where your data lives, ClickHouse can serve as a unifying access and computation layer for your machine learning workloads.
{"source_file": "01_machine_learning.md"}
[ -0.013637298718094826, -0.06687142699956894, -0.0023670520167797804, 0.015007670037448406, 0.021364668384194374, -0.02686675265431404, -0.060998715460300446, -0.03796939179301262, -0.0504889078438282, -0.03468446061015129, -0.07957156747579575, 0.006634314078837633, 0.02540505677461624, 0....
6269d079-317c-4d5e-a7ac-e074d0c7f2e1
ClickHouse also has an extensive suite of pre-built statistical and aggregation functions that scale over petabytes of data, making it easy to write and maintain simple SQL that executes complex computations. With support for the most granular precision data types and codecs, you don't need to worry about reducing the granularity of your data. While users can transform data directly in ClickHouse or prior to insertion using SQL queries, ClickHouse can also be used in programming environments such as Python via chDB . This allows embedded ClickHouse to be exposed as a Python module and used to transform and manipulate large data frames within notebooks. Data engineers can therefore perform transformation work to be performed client-side, with results potentially materialized as feature tables in a centralized ClickHouse instance. Data preparation and feature extraction {#data-preparation-and-feature-extraction} Data is then prepared: cleaned, transformed, and used to extract the features by which the model will be trained and evaluated. This component is sometimes called a feature generation or extraction pipeline, and is another slice of the machine learning data layer where new tools are often introduced. MLOps players like Neptune and Hopsworks provide examples of the host of different data transformation products that are used to orchestrate pipelines like these. However, because they’re separate tools from the database they’re operating on, they can be brittle, and can cause disruptions that need to be manually rectified. In contrast, data transformations are easily accomplished directly in ClickHouse through materialized views . These are automatically triggered when new data is inserted into ClickHouse source tables and are used to easily extract, transform, and modify data as it arrives - eliminating the need to build and monitor bespoke pipelines yourself. When these transformations require aggregations over a complete dataset that may not fit into memory, leveraging ClickHouse ensures you don’t have to try and retrofit this step to work with data frames on your local machine. For those datasets that are more convenient to evaluate locally, ClickHouse local is a great alternative, along with chDB , that allow users to leverage ClickHouse with standard Python data libraries like Pandas. Training and evaluation {#training-and-evaluation} At this point, features will have been split into training, validation, and test sets. These data sets are versioned, and then utilized by their respective stages.
{"source_file": "01_machine_learning.md"}
[ -0.044019218534231186, -0.024549057707190514, 0.0008167890482582152, 0.02201198972761631, -0.058428555727005005, -0.11231739073991776, -0.028611496090888977, -0.000189643120393157, -0.05656491219997406, -0.030073843896389008, -0.024741280823946, 0.0011103433789685369, 0.03503956273198128, ...
59a015fb-7857-46e5-bea7-9dfee557c593
At this point, features will have been split into training, validation, and test sets. These data sets are versioned, and then utilized by their respective stages. It is common in this phase of the pipeline to introduce yet another specialized tool to the machine learning data layer - the feature store. A feature store is most commonly a layer of abstraction around a database that provides convenience features specific to managing data for model training, inference, and evaluation. Examples of these convenience features include versioning, access management, and automatically translating the definition of features to SQL statements. For feature stores, ClickHouse can act as a: Data source - With the ability to query or ingest data in over 70 different file formats, including data lake formats such as Iceberg and Delta Lake, ClickHouse makes an ideal long-term store holding or querying data. By separating storage and compute using object storage, ClickHouse Cloud additionally allows data to be held indefinitely - with compute scaled down or made completely idle to minimize costs. Flexible codecs, coupled with column-oriented storage and ordering of data on disk, maximize compression rates, thus minimizing the required storage. Users can easily combine ClickHouse with data lakes, with built-in functions to query data in place on object storage. Transformation engine - SQL provides a natural means of declaring data transformations. When extended with ClickHouse’s analytical and statistical functions, these transformations become succinct and optimized. As well as applying to either ClickHouse tables, in cases where ClickHouse is used as a data store, table functions allow SQL queries to be written against data stored in formats such as Parquet, on-disk or object storage, or even other data stores such as Postgres and MySQL. A completely parallelization query execution engine, combined with a column-oriented storage format, allows ClickHouse to perform aggregations over PBs of data in seconds - unlike transformations on in memory data frames, users are not memory-bound. Furthermore, materialized views allow data to be transformed at insert time, thus overloading compute to data load time from query time. These views can exploit the same range of analytical and statistical functions ideal for data analysis and summarization. Should any of ClickHouse’s existing analytical functions be insufficient or custom libraries need to be integrated, users can also utilize User Defined Functions (UDFs). Offline feature store {#offline-feature-store} An offline feature store is used for model training. This generally means that the features themselves are produced through batch-process data transformation pipelines (as described in the above section), and there are typically no strict latency requirements on the availability of those features.
{"source_file": "01_machine_learning.md"}
[ -0.056912198662757874, -0.00011906771396752447, -0.026118364185094833, 0.06803859770298004, 0.0183323435485363, -0.0009375234949402511, 0.0023814705200493336, -0.01438484899699688, -0.07090345025062561, 0.01716511882841587, 0.013293731026351452, 0.008275188505649567, 0.01796361245214939, -...
0950d781-65ee-4efd-864f-2cd914a9e22c
With capabilities to read data from multiple sources and apply transformations via SQL queries, the results of these queries can also be persisted in ClickHouse via INSERT INTO SELECT statements. With transformations often grouped by an entity ID and returning a number of columns as results, ClickHouse’s schema inference can automatically detect the required types from these results and produce an appropriate table schema to store them. Functions for generating random numbers and statistical sampling allow data to be efficiently iterated and scaled at millions or rows per second for feeding to model training pipelines. Often, features are represented in tables with a timestamp indicating the value for an entity and feature at a specific point in time. As described earlier, training pipelines often need the state of features at specific points in time and in groups. ClickHouse’s sparse indices allow fast filtering of data to satisfy point-in-time queries and feature selection filters. While other technologies such as Spark, Redshift, and BigQuery rely on slow stateful windowed approaches to identify the state of features at a specific point in time, ClickHouse supports the ASOF (as-of-this-time) LEFT JOIN query and argMax function. In addition to simplifying syntax, this approach is highly performant on large datasets through the use of a sort and merge algorithm. This allows feature groups to be built quickly, reducing data preparation time prior to training. Online feature store {#online-feature-store} Online feature stores are used to store the latest version of features used for inference and are applied in real-time. This means that these features need to be calculated with minimal latency, as they’re used as part of a real-time machine learning service. As a real-time analytics database, ClickHouse can serve highly concurrent query workloads at low latency. While this requires data to be typically denormalized, this aligns with the storage of feature groups used at both training and inference time. Importantly, ClickHouse is able to deliver this query performance while being subject to high write workloads thanks to its log-structured merge tree. These properties are required in an online store to keep features up-to-date. Since the features are already available within the offline store, they can easily be materialized to new tables within either the same ClickHouse cluster or a different instance via existing capabilities, e.g. remoteSecure . Integrations with Kafka, through either an exactly-once Kafka Connect offering or via ClickPipes in ClickHouse Cloud, also make consuming streaming data from streaming sources simple and reliable.
{"source_file": "01_machine_learning.md"}
[ -0.041846733540296555, -0.007871013134717941, -0.008379541337490082, 0.06712929904460907, 0.04454904794692993, -0.024550389498472214, 0.024649541825056076, -0.057128772139549255, -0.013089009560644627, -0.06031478941440582, -0.049052320420742035, -0.015597782097756863, -0.021596945822238922,...
1aa668ac-101a-4700-96a5-a4542409678a
Many modern systems require both offline and online stores, and it is easy to jump to the conclusion that two specialized feature stores are required here. However, this introduces the additional complexity of keeping both of these stores in sync, which of course also includes the cost of replicating data between them. A real-time data warehouse like ClickHouse is a single system that can power both offline and online feature management. ClickHouse efficiently processes streaming and historical data, and has the unlimited scale, performance, and concurrency needed to be relied upon when serving features for real-time inference and offline training. In considering the tradeoffs between using a feature store product in this stage versus leveraging a real-time data warehouse directly, it’s worth emphasizing that convenience features such as versioning can be achieved through age-old database paradigms such as table or schema design. Other functionality, such as converting feature definitions to SQL statements, may provide greater flexibility as part of the application or business logic, rather than existing in an opinionated layer of abstraction. Inference {#inference} Model inference is the process of running a trained model to receive an output. When inference is triggered by database actions - for instance, inserting a new record, or querying records - the inference step could be managed via bespoke jobs or application code. On the other hand, it could be managed in the data layer itself. ClickHouse User Defined Functions (UDFs) , give users the ability to invoke a model directly from ClickHouse at insert or query time. This provides the ability to pass incoming data to a model, receive the output, and store these results along with the ingested data automatically - all without having to spin up other processes or jobs. This also provides a single interface, SQL, by which to manage this step. Vector store {#vector-store} A vector store is a specific type of database that is optimized for storing and retrieving vectors, typically embeddings of a piece of data (such as text or images) that numerically capture their underlying meaning. Vectors are at the core of today’s generative AI wave and are used in countless applications. The primary operation in a vector database is a “similarity search” to find the vectors that are “closest” to one another according to a mathematical measure. Vector databases have become popular because they employ specific tactics intended to make this examination - vector comparisons - as fast as possible. These techniques generally mean that they approximate the vector comparisons, instead of comparing the input vector to every vector stored.
{"source_file": "01_machine_learning.md"}
[ -0.04446566477417946, -0.04461483284831047, -0.05615945905447006, 0.08714223653078079, 0.04255688562989235, -0.013204825110733509, -0.07008913159370422, 0.0010087545961141586, -0.018613703548908234, -0.006092760246247053, 0.02581171691417694, 0.014859567396342754, 0.037942852824926376, -0....
891b15c8-8cc9-4ea4-9161-0388dd451010
The issue with this new class of tools is that many general-purpose databases, including ClickHouse, provide vector support out-of-the-box, and also often have implementations of those approximate approaches built-in. ClickHouse, in particular, is designed for high-performance large-scale analytics - allowing you to perform non-approximate vector comparisons very effectively. This means that you can achieve precise results, rather than having to rely on approximations, all without sacrificing speed. Observability {#observability} Once your machine learning application is live, it will generate data, including logs and tracing data, that offer valuable insights into model behavior, performance, and potential areas for improvement. SQL-based observability is another key use case for ClickHouse, where ClickHouse has been found to be 10-100x more cost-effective than alternatives. In fact, many observability products are themselves built with ClickHouse under-the-hood. With best-in-class ingestion rates and compression ratios, ClickHouse provides cost-efficiency and blazing speed to power machine learning observability at any scale.
{"source_file": "01_machine_learning.md"}
[ -0.06506728380918503, -0.02828143909573555, -0.03737080097198486, 0.07742936164140701, 0.0447830930352211, -0.10350459814071655, -0.027988407760858536, -0.04149951785802841, -0.10674278438091278, 0.004140464123338461, -0.059950634837150574, 0.03924797847867012, 0.019825078547000885, -0.010...
38ca7e58-d36f-46aa-ae5b-253af6a72da2
slug: /cloud/get-started/cloud/use-cases/AI_ML/agent_facing_analytics title: 'Agent facing analytics' description: 'Build agent-facing analytics systems with ClickHouse Cloud for AI agents and autonomous systems requiring real-time data access' keywords: ['use cases', 'Machine Learning', 'Generative AI', 'agent facing analytics', 'agents'] sidebar_label: 'Agent facing analytics' doc_type: 'guide' import Image from '@theme/IdealImage'; import ml_ai_05 from '@site/static/images/cloud/onboard/discover/use_cases/ml_ai_05.png'; import ml_ai_06 from '@site/static/images/cloud/onboard/discover/use_cases/ml_ai_06.png'; import ml_ai_07 from '@site/static/images/cloud/onboard/discover/use_cases/ml_ai_07.png'; import ml_ai_08 from '@site/static/images/cloud/onboard/discover/use_cases/ml_ai_08.png'; import ml_ai_09 from '@site/static/images/cloud/onboard/discover/use_cases/ml_ai_09.png'; Agent-facing analytics concepts {#agent-facing-analytics} What are "agents"? {#agents} One can think of AI agents as digital assistants that have evolved beyond simple task execution (or function calling): they can understand context, make decisions, and take meaningful actions toward specific goals. They operate in a "sense-think-act" loop (see ReAct agents), processing various inputs (text, media, data), analyzing situations, and then doing something useful with that information. Most importantly, depending on the application domain, they can theoretically operate at various levels of autonomy, requiring or not human supervision. The game changer here has been the advent of Large Language Models (LLMs). While we had the notion of AI agents for quite a while, LLMs like the GPT series have given them a massive upgrade in their ability to "understand" and communicate. It's as if they've suddenly become more fluent in "human" aka. able to grasp requests and respond with relevant contextual information drawn from the model's training. AI agents superpowers: “Tools” {#tools} These agents really shine through their access to “tools”. Tools enhance AI agents by giving them abilities to perform tasks. Rather than just being conversational interfaces, they can now get things done whether it’s crunching numbers, searching for information, or managing customer communications. Think of it as the difference between having someone who can describe how to solve a problem and someone who can actually solve it. For example, ChatGPT is now shipped by default with a search tool. This integration with search providers allows the model to pull current information from the web during conversations. This means it can fact-check responses, access recent events and data, and provide up-to-date information rather than relying solely on its training data.
{"source_file": "02_agent_facing_analytics.md"}
[ -0.03526052460074425, 0.008023706264793873, -0.09000753611326218, 0.05140344426035881, 0.0945749282836914, -0.04322637617588043, 0.07923722267150879, 0.0004189193423371762, -0.057516466826200485, 0.03772798553109169, 0.06499025970697403, -0.045759622007608414, 0.0972723513841629, -0.001327...
24e6a0b2-f2de-4bfa-a1a0-df937efe2ee2
Tools can also be used to simplify the implementation of Retrieval-Augmented Generation (RAG) pipelines. Instead of relying only on what an AI model learned during training, RAG lets the model pull in relevant information before formulating a response. Here's an example: Using an AI assistant to help with customer support (e.g. Salesforce AgentForce, ServiceNow AI Agents). Without RAG, it would only use its general training to answer questions. But with RAG, when a customer asks about the latest product feature, the system retrieves the most recent documentation, release notes, and historical support tickets before crafting its response. This means that answers are now grounded in the latest information available to the AI model. Reasoning models {#reasoning-models} Another development in the AI space, and perhaps one of the most interesting, is the emergence of reasoning models. Systems like OpenAI o1, Anthropic Claude, or DeepSeek-R1 take a more methodical approach by introducing a "thinking" step before responding to a prompt. Instead of generating the answer straightaway, reasoning models use prompting techniques like Chain-of-Thought (CoT) to analyze problems from multiple angles, break them down into steps, and use the tools available to them to gather contextual information when needed. This represents a shift toward more capable systems that can handle more complex tasks through a combination of reasoning and practical tools. One of the latest examples in this area is the introduction of OpenAI's deep research, an agent that can autonomously conduct complex multi-step research tasks online. It processes and synthesizes information from various sources, including text, images, and PDFs, to generate comprehensive reports within five to thirty minutes, a task that would traditionally take a human several hours. Real-time analytics for AI agents {#real-time-analytics-for-ai-agents} Let's take the case of an agentic AI assistant with access to a real-time analytics database containing the company's CRM data. When a user asks about the latest (up-to-the-minute) sales trends, the AI assistant queries the connected data source. It iteratively analyzes the data to identify meaningful patterns and trends, such as month-over-month growth, seasonal variations, or emerging product categories. Finally, it generates a natural language response explaining key findings, often with supporting visualizations. When the main interface is chat-based like in this case, performance matters since these iterative explorations trigger a series of queries that can scan large amounts of data to extract relevant insights.
{"source_file": "02_agent_facing_analytics.md"}
[ -0.09904567152261734, -0.016779938712716103, 0.0019094239687547088, 0.03944588080048561, 0.03521839529275894, 0.014533496461808681, -0.018365591764450073, 0.08796299993991852, 0.05982838571071625, -0.015676889568567276, -0.03428742289543152, 0.03031996823847294, 0.03464934974908829, -0.004...
385a6158-3c72-4024-abcf-8bcbc44f53a0
Some properties make real-time databases especially suitable for such workloads. For example, real-time analytics databases are designed to work with near real-time data, allowing them to process and deliver insights almost immediately as new data arrives. This is crucial for AI agents, as they can require up-to-date information to make (or help make) timely and relevant decisions. The core analytical capabilities are also important. Real-time analytics databases shine in performing complex aggregations and pattern detection across large datasets. Unlike operational databases focusing primarily on raw data storage or retrieval, these systems are optimized for analyzing vast amounts of information. This makes them particularly well-suited for AI agents that need to uncover trends, detect anomalies, and derive actionable insights. Real-time analytics databases are also expected to deliver fast performance for interactive querying, essential for chat-based interaction and high-frequency explorative workloads. They ensure consistent performance even with large data volumes and high query concurrency, enabling responsive dialogues and a smoother user experience. Finally, real-time analytics databases often serve as the ultimate "data sinks" effectively consolidating valuable domain-specific data in a single location. By co-locating essential data across different sources and formats under the same tent, these databases ensure that AI agents have access to a unified view of the domain information, decoupled from operational systems. These properties already empower real-time databases to play a vital role in serving AI data retrieval use cases at scale (e.g. OpenAI's acquisition of Rockset). They can also enable AI agents to provide fast data-driven responses while offloading the heavy computational work. It positions the real-time analytics database as a preferred "context provider" for AI agents when it comes to insights. AI agents as an emerging user persona {#ai-agents-as-an-emerging-user-persona} A useful way to think about AI agents leveraging real-time analytics databases is to perceive them as a new category of users, or in product manager speak: a user persona. From the database perspective, we can expect a potentially unlimited number of AI agents, concurrently running a large number of queries on behalf of users, or in autonomy, to perform investigations, refine iterative research and insights, and execute tasks.
{"source_file": "02_agent_facing_analytics.md"}
[ -0.05495226010680199, -0.031331516802310944, -0.07413146644830704, 0.08102239668369293, 0.003571628127247095, -0.04442596808075905, 0.036697808653116226, -0.01083613745868206, 0.010257961228489876, -0.009633672423660755, -0.05234817788004875, -0.01380749698728323, 0.019915906712412834, 0.0...
3417854c-91f7-4f96-9c12-540f5a14268a
Over the years, real-time databases have had the time to adapt to human interactive users, directly connected to the system or via a middleware application layer. Classic personas examples include database administrators, business analysts, data scientists, or software developers building applications on top of the database. The industry has progressively learned their usage patterns and requirements and organically, provided the interfaces, the operators, the UIs, the formats, the clients, and the performance to satisfy their various use cases. The question now becomes, are we ready to accommodate the AI agent's workloads? What specific features do we need to re-think or create from scratch for these usage patterns? ClickHouse is rapidly providing answers to some of these questions through a host of features aimed at providing a feature-complete AI experience. ClickHouse.ai {#clickhouse-ai} For more information about features coming soon to ClickHouse Cloud, see ClickHouse.ai .
{"source_file": "02_agent_facing_analytics.md"}
[ -0.041545264422893524, -0.0871778056025505, -0.016954971477389336, 0.02760135568678379, -0.02003241889178753, -0.00787471141666174, 0.02044145204126835, 0.016269268468022346, -0.07753220945596695, -0.028079291805624962, -0.1017155647277832, -0.016344474628567696, -0.0021811884362250566, 0....
e770267a-2292-43e3-8763-6bb9d5211f71
slug: /cloud/guides/data-masking sidebar_label: 'Data masking' title: 'Data masking in ClickHouse' description: 'A guide to data masking in ClickHouse' keywords: ['data masking'] doc_type: 'guide' Data masking in ClickHouse Data masking is a technique used for data protection, in which the original data is replaced with a version of the data which maintains its format and structure while removing any personally identifiable information (PII) or sensitive information. This guide shows you how you can mask data in ClickHouse. Use string replacement functions {#using-string-functions} For basic data masking use cases, the replace family of functions offers a convenient way to mask data: | Function | Description | |------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | replaceOne | Replaces the first occurrence of a pattern in a haystack string with the provided replacement string. | | replaceAll | Replaces all occurrences of a pattern in a haystack string with the provided replacement string. | | replaceRegexpOne | Replaces the first occurrence of a substring matching a regular expression pattern (in re2 syntax) in a haystack with the provided replacement string. | | replaceRegexpAll | Replaces all occurrences of a substring matching a regular expression pattern (in re2 syntax) in a haystack with the provided replacement string. | For example, you can replace the name "John Smith" with a placeholder [CUSTOMER_NAME] using the replaceOne function: sql title="Query" SELECT replaceOne( 'Customer John Smith called about his account', 'John Smith', '[CUSTOMER_NAME]' ) AS anonymized_text; response title="Response" ┌─anonymized_text───────────────────────────────────┐ │ Customer [CUSTOMER_NAME] called about his account │ └───────────────────────────────────────────────────┘ More generically, you can use the replaceRegexpOne to replace any customer name: sql title="Query" SELECT replaceRegexpAll( 'Customer John Smith called. Later, Mary Johnson and Bob Wilson also called.', '\\b[A-Z][a-z]+ [A-Z][a-z]+\\b', '[CUSTOMER_NAME]' ) AS anonymized_text; response title="Response" ┌─anonymized_text───────────────────────────────────────────────────────────────────────┐ │ [CUSTOMER_NAME] Smith called. Later, [CUSTOMER_NAME] and [CUSTOMER_NAME] also called. │ └───────────────────────────────────────────────────────────────────────────────────────┘
{"source_file": "03_data-masking.md"}
[ -0.0459730327129364, 0.11419463902711868, 0.05046756565570831, 0.04455622658133507, 0.02799900248646736, -0.053531501442193985, 0.02387356013059616, -0.07560735195875168, 0.0039796121418476105, -0.012795478105545044, 0.044533055275678635, 0.008734175004065037, 0.08405355364084244, -0.09781...
9100288e-9609-480c-8ef7-567f9c8faef9
Or you could mask a social security number, leaving only the last 4 digits using the replaceRegexpAll function. sql title="Query" SELECT replaceRegexpAll( 'SSN: 123-45-6789', '(\d{3})-(\d{2})-(\d{4})', 'XXX-XX-\3' ) AS masked_ssn; In the query above \3 is used to substitute the third capture group into the resulting string, which produces: response title="Response" ┌─masked_ssn───────┐ │ SSN: XXX-XX-6789 │ └──────────────────┘ Create masked VIEW s {#masked-views} A VIEW can be used in conjunction with the aforementioned string functions to apply transformations to columns containing sensitive data, before they are presented to the user. In this way, the original data remains unchanged, and users querying the view see only the masked data. To demonstrate, let's imagine that we have a table which stores records of customer orders. We want to make sure that a group of employees can view the information, but we don't want them to see the full information of the customers. Run the query below to create an example table orders and insert some fictional customer order records into it: ```sql CREATE TABLE orders ( user_id UInt32, name String, email String, phone String, total_amount Decimal(10,2), order_date Date, shipping_address String ) ENGINE = MergeTree() ORDER BY user_id; INSERT INTO orders VALUES (1001, 'John Smith', 'john.smith@gmail.com', '555-123-4567', 299.99, '2024-01-15', '123 Main St, New York, NY 10001'), (1002, 'Sarah Johnson', 'sarah.johnson@outlook.com', '555-987-6543', 149.50, '2024-01-16', '456 Oak Ave, Los Angeles, CA 90210'), (1003, 'Michael Brown', 'mbrown@company.com', '555-456-7890', 599.00, '2024-01-17', '789 Pine Rd, Chicago, IL 60601'), (1004, 'Emily Rogers', 'emily.rogers@yahoo.com', '555-321-0987', 89.99, '2024-01-18', '321 Elm St, Houston, TX 77001'), (1005, 'David Wilson', 'dwilson@email.net', '555-654-3210', 449.75, '2024-01-19', '654 Cedar Blvd, Phoenix, AZ 85001'); ``` Create a view called masked_orders : sql CREATE VIEW masked_orders AS SELECT user_id, replaceRegexpOne(name, '^([A-Za-z]+)\\s+(.*)$', '\\1 ****') AS name, replaceRegexpOne(email, '^(.{0})[^@]*(@.*)$', '\\1****\\2') AS email, replaceRegexpOne(phone, '^(\\d{3})-(\\d{3})-(\\d{4})$', '\\1-***-\\3') AS phone, total_amount, order_date, replaceRegexpOne(shipping_address, '^[^,]+,\\s*(.*)$', '*** \\1') AS shipping_address FROM orders; In the SELECT clause of the view creation query above, we define transformations using the replaceRegexpOne on the name , email , phone and shipping_address fields, which are the fields containing sensitive information that we wish to partially mask. Select the data from the view: sql title="Query" SELECT * FROM masked_orders
{"source_file": "03_data-masking.md"}
[ -0.09056103974580765, 0.06478957831859589, -0.03543134406208992, 0.04421896114945412, -0.08933409303426743, 0.059145115315914154, 0.07835406810045242, -0.09638851881027222, 0.03500455245375633, -0.08741088211536407, 0.02617621049284935, -0.01820114441215992, 0.10337936133146286, -0.0688757...
0e638caf-91ee-43da-83ad-f55c9c0382cc
Select the data from the view: sql title="Query" SELECT * FROM masked_orders response title="Response" ┌─user_id─┬─name─────────┬─email──────────────┬─phone────────┬─total_amount─┬─order_date─┬─shipping_address──────────┐ │ 1001 │ John **** │ jo****@gmail.com │ 555-***-4567 │ 299.99 │ 2024-01-15 │ *** New York, NY 10001 │ │ 1002 │ Sarah **** │ sa****@outlook.com │ 555-***-6543 │ 149.5 │ 2024-01-16 │ *** Los Angeles, CA 90210 │ │ 1003 │ Michael **** │ mb****@company.com │ 555-***-7890 │ 599 │ 2024-01-17 │ *** Chicago, IL 60601 │ │ 1004 │ Emily **** │ em****@yahoo.com │ 555-***-0987 │ 89.99 │ 2024-01-18 │ *** Houston, TX 77001 │ │ 1005 │ David **** │ dw****@email.net │ 555-***-3210 │ 449.75 │ 2024-01-19 │ *** Phoenix, AZ 85001 │ └─────────┴──────────────┴────────────────────┴──────────────┴──────────────┴────────────┴───────────────────────────┘ Notice that the data returned from the view is partially masked, obfuscating the sensitive information. You can also create multiple views, with differing levels of obfuscation depending on the level of privileged access to information the viewer has. To ensure that users are only able to access the view returning the masked data, and not the table with the original unmasked data, you should use Role Based Access Control to ensure that specific roles only have grants to select from the view. First create the role: sql CREATE ROLE masked_orders_viewer; Next grant SELECT privileges on the view to the role: sql GRANT SELECT ON masked_orders TO masked_orders_viewer; Because ClickHouse roles are additive, you must ensure that users who should only see the masked view do not have any SELECT privilege on the base table via any role. As such, you should explicitly revoke base-table access to be safe: sql REVOKE SELECT ON orders FROM masked_orders_viewer; Finally, assign the role to the appropriate users: sql GRANT masked_orders_viewer TO your_user; This ensures that users with the masked_orders_viewer role are only able to see the masked data from the view and not the original unmasked data from the table. Use MATERIALIZED columns and column-level access restrictions {#materialized-ephemeral-column-restrictions} In cases where you don't want to create a separate view, you can store masked versions of your data alongside the original data. To do so, you can use materialized columns . Values of such columns are automatically calculated according to the specified materialized expression when rows are inserted, and we can use them to create new columns with masked versions of the data. Taking the example before, instead of creating a separate VIEW for the masked data, we'll now create masked columns using MATERIALIZED :
{"source_file": "03_data-masking.md"}
[ 0.003862421726807952, -0.03186384215950966, 0.0714469701051712, 0.10002386569976807, -0.030992621555924416, -0.03741604834794998, 0.04618270322680473, -0.12683290243148804, 0.06323862075805664, -0.013803011737763882, 0.06382225453853607, -0.07647483050823212, 0.0034580836072564125, -0.0630...
58a1815a-c7d4-4abb-80fc-ef7153f5b928
Taking the example before, instead of creating a separate VIEW for the masked data, we'll now create masked columns using MATERIALIZED : ```sql DROP TABLE IF EXISTS orders; CREATE TABLE orders ( user_id UInt32, name String, name_masked String MATERIALIZED replaceRegexpOne(name, '^([A-Za-z]+)\s+(. )$', '\1 '), email String, email_masked String MATERIALIZED replaceRegexpOne(email, '^(.{0})[^@] (@.*)$', '\1 \2'), phone String, phone_masked String MATERIALIZED replaceRegexpOne(phone, '^(\d{3})-(\d{3})-(\d{4})$', '\1- -\3'), total_amount Decimal(10,2), order_date Date, shipping_address String, shipping_address_masked String MATERIALIZED replaceRegexpOne(shipping_address, '^[^,]+,\s (. )$', ' ** \1') ) ENGINE = MergeTree() ORDER BY user_id; INSERT INTO orders VALUES (1001, 'John Smith', 'john.smith@gmail.com', '555-123-4567', 299.99, '2024-01-15', '123 Main St, New York, NY 10001'), (1002, 'Sarah Johnson', 'sarah.johnson@outlook.com', '555-987-6543', 149.50, '2024-01-16', '456 Oak Ave, Los Angeles, CA 90210'), (1003, 'Michael Brown', 'mbrown@company.com', '555-456-7890', 599.00, '2024-01-17', '789 Pine Rd, Chicago, IL 60601'), (1004, 'Emily Rogers', 'emily.rogers@yahoo.com', '555-321-0987', 89.99, '2024-01-18', '321 Elm St, Houston, TX 77001'), (1005, 'David Wilson', 'dwilson@email.net', '555-654-3210', 449.75, '2024-01-19', '654 Cedar Blvd, Phoenix, AZ 85001'); ``` If you now run the following select query, you will see that the masked data is 'materialized' at insert time and stored alongside the original, unmasked data. It is necessary to explicitly select the masked columns as ClickHouse doesn't automatically include materialized columns in SELECT * queries by default. sql title="Query" SELECT *, name_masked, email_masked, phone_masked, shipping_address_masked FROM orders ORDER BY user_id ASC
{"source_file": "03_data-masking.md"}
[ -0.04767750948667526, 0.019604679197072983, 0.06888362020254135, 0.02631344459950924, -0.08363726735115051, -0.04923532158136368, 0.028335291892290115, -0.06501641124486923, -0.0067492215894162655, 0.006786898709833622, 0.037196721881628036, -0.11500703543424606, 0.0318077988922596, -0.084...
c43ad6b5-dd43-4bf4-9cbd-e9280295c019
sql title="Query" SELECT *, name_masked, email_masked, phone_masked, shipping_address_masked FROM orders ORDER BY user_id ASC response title="Response" ┌─user_id─┬─name──────────┬─email─────────────────────┬─phone────────┬─total_amount─┬─order_date─┬─shipping_address───────────────────┬─name_masked──┬─email_masked───────┬─phone_masked─┬─shipping_address_masked────┐ 1. │ 1001 │ John Smith │ john.smith@gmail.com │ 555-123-4567 │ 299.99 │ 2024-01-15 │ 123 Main St, New York, NY 10001 │ John **** │ jo****@gmail.com │ 555-***-4567 │ **** New York, NY 10001 │ 2. │ 1002 │ Sarah Johnson │ sarah.johnson@outlook.com │ 555-987-6543 │ 149.5 │ 2024-01-16 │ 456 Oak Ave, Los Angeles, CA 90210 │ Sarah **** │ sa****@outlook.com │ 555-***-6543 │ **** Los Angeles, CA 90210 │ 3. │ 1003 │ Michael Brown │ mbrown@company.com │ 555-456-7890 │ 599 │ 2024-01-17 │ 789 Pine Rd, Chicago, IL 60601 │ Michael **** │ mb****@company.com │ 555-***-7890 │ **** Chicago, IL 60601 │ 4. │ 1004 │ Emily Rogers │ emily.rogers@yahoo.com │ 555-321-0987 │ 89.99 │ 2024-01-18 │ 321 Elm St, Houston, TX 77001 │ Emily **** │ em****@yahoo.com │ 555-***-0987 │ **** Houston, TX 77001 │ 5. │ 1005 │ David Wilson │ dwilson@email.net │ 555-654-3210 │ 449.75 │ 2024-01-19 │ 654 Cedar Blvd, Phoenix, AZ 85001 │ David **** │ dw****@email.net │ 555-***-3210 │ **** Phoenix, AZ 85001 │ └─────────┴───────────────┴───────────────────────────┴──────────────┴──────────────┴────────────┴────────────────────────────────────┴──────────────┴────────────────────┴──────────────┴────────────────────────────┘ To ensure that users are only able to access columns containing the masked data, you can again use Role Based Access Control to ensure that specific roles only have grants to select on masked columns from orders . Recreate the role that we made previously: sql DROP ROLE IF EXISTS masked_order_viewer; CREATE ROLE masked_order_viewer; Next, grant SELECT permission to the orders table: sql GRANT SELECT ON orders TO masked_data_reader; Revoke access to any sensitive columns: sql REVOKE SELECT(name) ON orders FROM masked_data_reader; REVOKE SELECT(email) ON orders FROM masked_data_reader; REVOKE SELECT(phone) ON orders FROM masked_data_reader; REVOKE SELECT(shipping_address) ON orders FROM masked_data_reader; Finally, assign the role to the appropriate users: sql GRANT masked_orders_viewer TO your_user; In the case where you want to store only the masked data in the orders table, you can mark the sensitive unmasked columns as EPHEMERAL , which will ensure that columns of this type are not stored in the table.
{"source_file": "03_data-masking.md"}
[ -0.03414351865649223, -0.05003258213400841, 0.09256611764431, 0.08861088752746582, -0.06695172935724258, -0.06396947056055069, 0.056644126772880554, -0.09951498359441757, 0.027283821254968643, -0.0031433040276169777, 0.062716044485569, -0.07982324063777924, 0.04099229350686073, -0.08829066...
f579445a-83e0-4504-98c7-6d9d32d9efd5
```sql DROP TABLE IF EXISTS orders; CREATE TABLE orders ( user_id UInt32, name String EPHEMERAL, name_masked String MATERIALIZED replaceRegexpOne(name, '^([A-Za-z]+)\s+(. )$', '\1 '), email String EPHEMERAL, email_masked String MATERIALIZED replaceRegexpOne(email, '^(.{2})[^@] (@.*)$', '\1 \2'), phone String EPHEMERAL, phone_masked String MATERIALIZED replaceRegexpOne(phone, '^(\d{3})-(\d{3})-(\d{4})$', '\1- -\3'), total_amount Decimal(10,2), order_date Date, shipping_address String EPHEMERAL, shipping_address_masked String MATERIALIZED replaceRegexpOne(shipping_address, '^([^,]+),\s (. )$', ' ** \2') ) ENGINE = MergeTree() ORDER BY user_id; INSERT INTO orders (user_id, name, email, phone, total_amount, order_date, shipping_address) VALUES (1001, 'John Smith', 'john.smith@gmail.com', '555-123-4567', 299.99, '2024-01-15', '123 Main St, New York, NY 10001'), (1002, 'Sarah Johnson', 'sarah.johnson@outlook.com', '555-987-6543', 149.50, '2024-01-16', '456 Oak Ave, Los Angeles, CA 90210'), (1003, 'Michael Brown', 'mbrown@company.com', '555-456-7890', 599.00, '2024-01-17', '789 Pine Rd, Chicago, IL 60601'), (1004, 'Emily Rogers', 'emily.rogers@yahoo.com', '555-321-0987', 89.99, '2024-01-18', '321 Elm St, Houston, TX 77001'), (1005, 'David Wilson', 'dwilson@email.net', '555-654-3210', 449.75, '2024-01-19', '654 Cedar Blvd, Phoenix, AZ 85001'); ``` If we run the same query as before, you'll now see that only the materialized masked data was inserted into the table: sql title="Query" SELECT *, name_masked, email_masked, phone_masked, shipping_address_masked FROM orders ORDER BY user_id ASC response title="Response" ┌─user_id─┬─total_amount─┬─order_date─┬─name_masked──┬─email_masked───────┬─phone_masked─┬─shipping_address_masked───┐ 1. │ 1001 │ 299.99 │ 2024-01-15 │ John **** │ jo****@gmail.com │ 555-***-4567 │ *** New York, NY 10001 │ 2. │ 1002 │ 149.5 │ 2024-01-16 │ Sarah **** │ sa****@outlook.com │ 555-***-6543 │ *** Los Angeles, CA 90210 │ 3. │ 1003 │ 599 │ 2024-01-17 │ Michael **** │ mb****@company.com │ 555-***-7890 │ *** Chicago, IL 60601 │ 4. │ 1004 │ 89.99 │ 2024-01-18 │ Emily **** │ em****@yahoo.com │ 555-***-0987 │ *** Houston, TX 77001 │ 5. │ 1005 │ 449.75 │ 2024-01-19 │ David **** │ dw****@email.net │ 555-***-3210 │ *** Phoenix, AZ 85001 │ └─────────┴──────────────┴────────────┴──────────────┴────────────────────┴──────────────┴───────────────────────────┘ Use query masking rules for log data {#use-query-masking-rules} For users of ClickHouse OSS wishing to mask log data specifically, you can make use of query masking rules (log masking) to mask data.
{"source_file": "03_data-masking.md"}
[ -0.002549362601712346, 0.07144150137901306, 0.09985502809286118, -0.01947708986699581, -0.10497716069221497, -0.028474021703004837, 0.06391264498233795, 0.004367843270301819, -0.021709691733121872, 0.06885833293199539, 0.05375799536705017, -0.08963170647621155, 0.06440751999616623, -0.1333...
9a6658e1-f892-40e3-b01e-41f1beeb2971
For users of ClickHouse OSS wishing to mask log data specifically, you can make use of query masking rules (log masking) to mask data. To do so, you can define regular expression-based masking rules in the server configuration. These rules are applied to queries and all log messages before they are stored in server logs or system tables (such as system.query_log , system.text_log , and system.processes ). This helps prevent sensitive data from leaking into logs only. Note that it does not mask data in query results. For example, to mask a social security number, you could add the following rule to your server configuration : yaml <query_masking_rules> <rule> <name>hide SSN</name> <regexp>(^|\D)\d{3}-\d{2}-\d{4}($|\D)</regexp> <replace>000-00-0000</replace> </rule> </query_masking_rules>
{"source_file": "03_data-masking.md"}
[ -0.007379018701612949, 0.07565329223871231, -0.024990199133753777, 0.02889268286526203, -0.0156975369900465, -0.04133191704750061, 0.08356190472841263, -0.10272891819477081, 0.031776368618011475, -0.027123423293232918, 0.010869933292269707, -0.009264699183404446, 0.09047672897577286, -0.02...
e66918fc-cdb4-4d0e-aac4-02465eb471da
sidebar_label: 'Data encryption' slug: /cloud/security/cmek title: 'Data encryption' description: 'Learn more about data encryption in ClickHouse Cloud' doc_type: 'guide' keywords: ['ClickHouse Cloud', 'encryption', 'CMEK', 'KMS key poller'] import Image from '@theme/IdealImage'; import EnterprisePlanFeatureBadge from '@theme/badges/EnterprisePlanFeatureBadge' import cmek_performance from '@site/static/images/_snippets/cmek-performance.png'; Data encryption Storage level encryption {#storage-encryption} ClickHouse Cloud is configured with encryption at rest by default utilizing cloud provider-managed AES 256 keys. For more information review: - AWS server-side encryption for S3 - GCP default encryption at rest - Azure storage encryption for data at rest Database level encryption {#database-encryption} Data at rest is encrypted by default using cloud provider-managed AES 256 keys. Customers may enable Transparent Data Encryption (TDE) to provide an additional layer of protection for service data or supply their own key to implement Customer Managed Encryption Keys (CMEK) for their service. Enhanced encryption is currently available in AWS and GCP services. Azure is coming soon. Transparent Data Encryption (TDE) {#transparent-data-encryption-tde} TDE must be enabled on service creation. Existing services cannot be encrypted after creation. Once TDE is enabled, it cannot be disabled. All data in the service will remain encrypted. If you want to disable TDE after it has been enabled, you must create a new service and migrate your data there. Select Create new service Name the service Select AWS or GCP as the cloud provider and the desired region from the drop-down Click the drop-down for Enterprise features and toggle Enable Transparent Data Encryption (TDE) Click Create service Customer Managed Encryption Keys (CMEK) {#customer-managed-encryption-keys-cmek} :::warning Deleting a KMS key used to encrypt a ClickHouse Cloud service will cause your ClickHouse service to be stopped and its data will be unretrievable, along with existing backups. To prevent accidental data loss when rotating keys you may wish to maintain old KMS keys for a period of time prior to deletion. ::: Once a service is encrypted with TDE, customers may update the key to enable CMEK. The service will automatically restart after updating the TDE setting. During this process, the old KMS key decrypts the data encrypting key (DEK), and the new KMS key re-encrypts the DEK. This ensures that the service on restart will use the new KMS key for encryption operations moving forward. This process may take several minutes. Enable CMEK with AWS KMS
{"source_file": "04_cmek.md"}
[ -0.04345319792628288, 0.03330978751182556, -0.0488436184823513, 0.002327089197933674, 0.03077569790184498, 0.033954448997974396, 0.0772729441523552, -0.021778743714094162, 0.055563051253557205, 0.05675893649458885, 0.0010776214767247438, 0.017485637217760086, 0.042040709406137466, -0.05976...
532571b1-88d2-4777-b78f-540e1abc5855
Enable CMEK with AWS KMS 1. In ClickHouse Cloud, select the encrypted service 2. Click on the Settings on the left 3. At the bottom of the screen, expand the Network security information 4. Copy the Encryption role ID (AWS) or Encryption Service Account (GCP) - you will need this in a future step 5. [Create a KMS key for AWS](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html) 6. Click the key 7. Update the AWS key policy as follows: ```json { "Sid": "Allow ClickHouse Access", "Effect": "Allow", "Principal": { "AWS": [ "Encryption role ID " ] }, "Action": [ "kms:Encrypt", "kms:Decrypt", "kms:ReEncrypt*", "kms:DescribeKey" ], "Resource": "*" } ``` 10. Save the Key policy 11. Copy the Key ARN 12. Return to ClickHouse Cloud and paste the Key ARN in the Transparent Data Encryption section of the Service Settings 13. Save the change Enable CMEK with GCP KMS 1. In ClickHouse Cloud, select the encrypted service 2. Click on the Settings on the left 3. At the bottom of the screen, expand the Network security information 4. Copy the Encryption Service Account (GCP) - you will need this in a future step 5. [Create a KMS key for GCP](https://cloud.google.com/kms/docs/create-key) 6. Click the key 7. Grant the following permissions to the GCP Encryption Service Account copied in step 4 above. - Cloud KMS CryptoKey Encrypter/Decrypter - Cloud KMS Viewer 10. Save the Key permission 11. Copy the Key Resource Path 12. Return to ClickHouse Cloud and paste the Key Resource Path in the Transparent Data Encryption section of the Service Settings 13. Save the change Key rotation {#key-rotation} Once you set up CMEK, rotate the key by following the procedures above for creating a new KMS key and granting permissions. Return to the service settings to paste the new ARN (AWS) or Key Resource Path (GCP) and save the settings. The service will restart to apply the new key. KMS key poller {#kms-key-poller} When using CMEK, the validity of the provided KMS key is checked every 10 minutes. If access to the KMS key is invalid, the ClickHouse service will stop. To resume service, restore access to the KMS key by following the steps in this guide, and then restart the service. Backup and restore {#backup-and-restore} Backups are encrypted using the same key as the associated service. When you restore an encrypted backup, it creates an encrypted instance that uses the same KMS key as the original instance. If needed, you can rotate the KMS key after restoration; see Key Rotation for more details. Performance {#performance}
{"source_file": "04_cmek.md"}
[ -0.01628800295293331, 0.029680470004677773, -0.016275320202112198, -0.006478568073362112, -0.0007003158680163324, 0.05708835646510124, 0.019497385248541832, -0.04524753987789154, 0.04288569837808609, 0.0940602496266365, -0.051628053188323975, -0.06427166610956192, 0.04934967681765556, -0.0...
608e8b5e-0a71-426a-9cf7-b917a6aa9716
Performance {#performance} Database encryption leverages ClickHouse's built-in Virtual File System for Data Encryption feature to encrypt and protect your data. The algorithm in use for this feature is AES_256_CTR , which is expected to have a performance penalty of 5-15% depending on the workload:
{"source_file": "04_cmek.md"}
[ -0.004491785075515509, 0.029935386031866074, -0.10488074272871017, 0.008164571598172188, 0.003810381516814232, -0.08766146749258041, 0.022302798926830292, -0.02355263940989971, 0.04105547070503235, 0.013818777166306973, -0.05546645075082779, 0.058481547981500626, 0.03622500225901604, -0.04...
decfa702-8e2b-4431-bf86-ec3c11e15655
slug: /cloud/guides/data-sources title: 'Data sources' hide_title: true description: 'Table of contents page for the ClickHouse Cloud guides section' doc_type: 'landing-page' keywords: ['cloud guides', 'documentation', 'how-to', 'cloud features', 'tutorials'] Cloud integrations {#cloud-integrations} This section contains guides and references for integrating ClickHouse Cloud with external data sources that require additional configuration. | Page | Description | |-----------------------------------------------------------------|-------------------------------------------------------------------------| | Cloud IP addresses | Networking information needed for some table functions and connections | | Accessing S3 data securely | Access external data sources in AWS S3 using role based access | Additional connections for external data sources {#additional-connections-for-external-data-sources} ClickPipes for data ingestion {#clickpipes-for-data-ingestion} ClickPipes allow customers to easily integrate streaming data from a number of sources. Refer to ClickPipes in our Integrations documentation for additional information. Table functions as external data sources {#table-functions-as-external-data-sources} ClickHouse supports a number of table functions to access external data sources. For more information, refer to table functions in the SQL reference section.
{"source_file": "index.md"}
[ -0.020096778869628906, -0.03129227086901665, 0.010865537449717522, 0.017413128167390823, 0.05779934674501419, -0.005979358218610287, 0.0003485368797555566, -0.06439533829689026, 0.009182633832097054, 0.013341869227588177, 0.021119561046361923, 0.011032945476472378, 0.05399994179606438, -0....
c6d676e4-ea73-4ee7-af26-b5f75e1e9735
slug: /manage/data-sources/cloud-endpoints-api sidebar_label: 'Cloud IP addresses' title: 'Cloud IP addresses' description: 'This page documents the Cloud Endpoints API security features within ClickHouse. It details how to secure your ClickHouse deployments by managing access through authentication and authorization mechanisms.' doc_type: 'reference' keywords: ['ClickHouse Cloud', 'static IP addresses', 'cloud endpoints', 'API', 'security', 'egress IPs', 'ingress IPs', 'firewall'] import Image from '@theme/IdealImage'; import aws_rds_mysql from '@site/static/images/_snippets/aws-rds-mysql.png'; import gcp_authorized_network from '@site/static/images/_snippets/gcp-authorized-network.png'; Static IPs API {#static-ips-api} If you need to fetch the list of static IPs, you can use the following ClickHouse Cloud API endpoint: https://api.clickhouse.cloud/static-ips.json . This API provides the endpoints for ClickHouse Cloud services, such as ingress/egress IPs and S3 endpoints per region and cloud. If you are using an integration like the MySQL or PostgreSQL Engine, it is possible that you need to authorize ClickHouse Cloud to access your instances. You can use this API to retrieve the public IPs and configure them in firewalls or Authorized networks in GCP or in Security Groups for Azure, AWS, or in any other infrastructure egress management system you are using. For example, to allow access from a ClickHouse Cloud service hosted on AWS in the region ap-south-1 , you can add the egress_ips addresses for that region: bash ❯ curl -s https://api.clickhouse.cloud/static-ips.json | jq '.' { "aws": [ { "egress_ips": [ "3.110.39.68", "15.206.7.77", "3.6.83.17" ], "ingress_ips": [ "15.206.78.111", "3.6.185.108", "43.204.6.248" ], "region": "ap-south-1", "s3_endpoints": "vpce-0a975c9130d07276d" }, ... For example, an AWS RDS instance running in us-east-2 that needs to connect to a ClickHouse cloud service should have the following Inbound security group rules: For the same ClickHouse Cloud service running in us-east-2 , but this time connected to an MySQL in GCP, the Authorized networks should look like this:
{"source_file": "01_cloud-endpoints-api.md"}
[ 0.02593284659087658, 0.04032788798213005, -0.023764388635754585, -0.027773117646574974, 0.0013605720596387982, -0.020968765020370483, 0.05124550685286522, -0.049528393894433975, -0.041182126849889755, 0.07349581271409988, 0.05324952304363251, -0.04237860441207886, 0.0989425778388977, -0.02...
2a8f19b4-e20a-4c62-9751-a72063251cda
slug: /cloud/data-sources/secure-s3 sidebar_label: 'Accessing S3 data securely' title: 'Accessing S3 data securely' description: 'This article demonstrates how ClickHouse Cloud customers can leverage role-based access to authenticate with Amazon Simple Storage Service(S3) and access their data securely.' keywords: ['RBAC', 'Amazon S3', 'authentication'] doc_type: 'guide' import Image from '@theme/IdealImage'; import secure_s3 from '@site/static/images/cloud/security/secures3.jpg'; import s3_info from '@site/static/images/cloud/security/secures3_arn.png'; import s3_output from '@site/static/images/cloud/security/secures3_output.jpg'; This article demonstrates how ClickHouse Cloud customers can leverage role-based access to authenticate with Amazon Simple Storage Service (S3) and access their data securely. Introduction {#introduction} Before diving into the setup for secure S3 access, it is important to understand how this works. Below is an overview of how ClickHouse services can access private S3 buckets by assuming into a role within customers' AWS account. This approach allows customers to manage all access to their S3 buckets in a single place (the IAM policy of the assumed-role) without having to go through all of their bucket policies to add or remove access. Setup {#setup} Obtaining the ClickHouse service IAM role ARN {#obtaining-the-clickhouse-service-iam-role-arn} 1 - Login to your ClickHouse cloud account. 2 - Select the ClickHouse service you want to create the integration 3 - Select the Settings tab 4 - Scroll down to the Network security information section at the bottom of the page 5 - Copy the Service role ID (IAM) value belong to the service as shown below. Setting up IAM assume role {#setting-up-iam-assume-role} Option 1: Deploying with CloudFormation stack {#option-1-deploying-with-cloudformation-stack} 1 - Login to your AWS Account in the web browser with an IAM user that has permission to create & manage IAM role. 2 - Visit this url to populate the CloudFormation stack. 3 - Enter (or paste) the IAM Role belong to the ClickHouse service 4 - Configure the CloudFormation stack. Below is additional information about these parameters.
{"source_file": "02_accessing-s3-data-securely.md"}
[ -0.05214160308241844, 0.05038296803832054, -0.09709127247333527, -0.034530021250247955, 0.048238180577754974, -0.005634882487356663, 0.08047907054424286, -0.022612934932112694, 0.021381450816988945, -0.005325921345502138, 0.039942845702171326, 0.05436628311872482, 0.14058397710323334, -0.0...
9990ec07-0823-4d8b-bdf0-da23b8f18df6
3 - Enter (or paste) the IAM Role belong to the ClickHouse service 4 - Configure the CloudFormation stack. Below is additional information about these parameters. | Parameter | Default Value | Description | | :--- | :----: | :---- | | RoleName | ClickHouseAccess-001 | The name of the new role that ClickHouse Cloud will use to access your S3 bucket | | Role Session Name | * | Role Session Name can be used as a shared secret to further protect your bucket. | | ClickHouse Instance Roles | | Comma separated list of ClickHouse service IAM roles that can use this Secure S3 integration. | | Bucket Access | Read | Sets the level of access for the provided buckets. | | Bucket Names | | Comma separated list of bucket names that this role will have access to. | Note : Do not put the full bucket Arn but instead just the bucket name only. 5 - Select the I acknowledge that AWS CloudFormation might create IAM resources with custom names. checkbox 6 - Click Create stack button at bottom right 7 - Make sure the CloudFormation stack completes with no error. 8 - Select the Outputs of the CloudFormation stack 9 - Copy the RoleArn value for this integration. This is what needed to access your S3 bucket. Option 2: Manually create IAM role {#option-2-manually-create-iam-role} 1 - Login to your AWS Account in the web browser with an IAM user that has permission to create & manage IAM role. 2 - Browse to IAM Service Console 3 - Create a new IAM role with the following IAM & Trust policy. Trust policy (Please replace {ClickHouse_IAM_ARN} with the IAM Role arn belong to your ClickHouse instance): json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "{ClickHouse_IAM_ARN}" }, "Action": "sts:AssumeRole" } ] } IAM policy (Please replace {BUCKET_NAME} with your bucket name): json { "Version": "2012-10-17", "Statement": [ { "Action": [ "s3:GetBucketLocation", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::{BUCKET_NAME}" ], "Effect": "Allow" }, { "Action": [ "s3:Get*", "s3:List*" ], "Resource": [ "arn:aws:s3:::{BUCKET_NAME}/*" ], "Effect": "Allow" } ] }
{"source_file": "02_accessing-s3-data-securely.md"}
[ -0.034498266875743866, -0.0712476298213005, -0.04020809009671211, -0.025053532794117928, -0.016661813482642174, 0.04301773011684418, 0.062321972101926804, -0.08148735016584396, 0.015627950429916382, 0.03515714034438133, -0.019698023796081543, -0.11249597370624542, 0.0864928662776947, -0.04...
6d13eb2b-283b-4d0e-9bd9-ed060e988044
4 - Copy the new IAM Role Arn after creation. This is what needed to access your S3 bucket. Access your S3 bucket with the ClickHouseAccess role {#access-your-s3-bucket-with-the-clickhouseaccess-role} ClickHouse Cloud has a new feature that allows you to specify extra_credentials as part of the S3 table function. Below is an example of how to run a query using the newly created role copied from above. sql DESCRIBE TABLE s3('https://s3.amazonaws.com/BUCKETNAME/BUCKETOBJECT.csv','CSVWithNames',extra_credentials(role_arn = 'arn:aws:iam::111111111111:role/ClickHouseAccessRole-001')) Below is an example query that uses the role_session_name as a shared secret to query data from a bucket. If the role_session_name is not correct, this operation will fail. sql DESCRIBE TABLE s3('https://s3.amazonaws.com/BUCKETNAME/BUCKETOBJECT.csv','CSVWithNames',extra_credentials(role_arn = 'arn:aws:iam::111111111111:role/ClickHouseAccessRole-001', role_session_name = 'secret-role-name')) :::note We recommend that your source S3 is in the same region as your ClickHouse Cloud Service to reduce on data transfer costs. For more information, refer to S3 pricing :::
{"source_file": "02_accessing-s3-data-securely.md"}
[ -0.006669558584690094, -0.0403919517993927, -0.08631214499473572, 0.0038567695301026106, -0.044901568442583084, 0.008989470079541206, 0.0593610480427742, -0.04118446633219719, 0.028438745066523552, 0.01730727031826973, -0.003549314336851239, -0.12330256402492523, 0.10812026262283325, -0.06...
8ca794bd-d99d-4e05-91d2-3ae03c6fff8e
sidebar_title: 'Query API Endpoints' slug: /cloud/get-started/query-endpoints description: 'Easily spin up REST API endpoints from your saved queries' keywords: ['api', 'query api endpoints', 'query endpoints', 'query rest api'] title: 'Query API Endpoints' doc_type: 'guide' import Image from '@theme/IdealImage'; import endpoints_testquery from '@site/static/images/cloud/sqlconsole/endpoints-testquery.png'; import endpoints_savequery from '@site/static/images/cloud/sqlconsole/endpoints-savequery.png'; import endpoints_configure from '@site/static/images/cloud/sqlconsole/endpoints-configure.png'; import endpoints_completed from '@site/static/images/cloud/sqlconsole/endpoints-completed.png'; import endpoints_curltest from '@site/static/images/cloud/sqlconsole/endpoints-curltest.png'; import endpoints_monitoring from '@site/static/images/cloud/sqlconsole/endpoints-monitoring.png'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; Setting up query API endpoints The Query API Endpoints feature allows you to create an API endpoint directly from any saved SQL query in the ClickHouse Cloud console. You'll be able to access API endpoints via HTTP to execute your saved queries without needing to connect to your ClickHouse Cloud service via a native driver. Pre-requisites {#quick-start-guide} Before proceeding, ensure you have: - An API key with appropriate permissions - An Admin Console Role You can follow this guide to create an API key if you don't yet have one. :::note Minimum permissions To query an API endpoint, the API key needs Member organization role with Query Endpoints service access. The database role is configured when you create the endpoint. ::: Create a saved query {#creating-a-saved-query} If you have a saved query, you can skip this step. Open a new query tab. For demonstration purposes, we'll use the youtube dataset , which contains approximately 4.5 billion records. Follow the steps in section "Create table" to create the table on your Cloud service and insert data to it. :::tip LIMIT the number of rows The example dataset tutorial inserts a lot of data - 4.65 billion rows which can take some time to insert. For the purposes of this guide we recommend to use the LIMIT clause to insert a smaller amount of data, for example 10 million rows. ::: As an example query, we'll return the top 10 uploaders by average views per video in a user-inputted year parameter. sql WITH sum(view_count) AS view_sum, round(view_sum / num_uploads, 2) AS per_upload SELECT uploader, count() AS num_uploads, formatReadableQuantity(view_sum) AS total_views, formatReadableQuantity(per_upload) AS views_per_video FROM youtube WHERE -- highlight-next-line toYear(upload_date) = {year: UInt16} GROUP BY uploader ORDER BY per_upload desc LIMIT 10
{"source_file": "query-endpoints.md"}
[ 0.006284186150878668, 0.021498695015907288, -0.044799238443374634, 0.054957471787929535, -0.018533140420913696, 0.04234239459037781, -0.016366997733712196, 0.025493303313851357, -0.031333405524492264, 0.05232692137360573, 0.014535052701830864, -0.024433961138129234, 0.09649074822664261, -0...
4f15c16a-0fa6-4808-8cb8-077eb02193be
Note that this query contains a parameter ( year ) which is highlighted in the snippet above. You can specify query parameters using curly brackets { } together with the type of the parameter. The SQL console query editor automatically detects ClickHouse query parameter expressions and provides an input for each parameter. Let's quickly run this query to make sure that it works by specifying the year 2010 in the query variables input box on the right side of the SQL editor: Next, save the query: More documentation around saved queries can be found in section "Saving a query" . Configuring the query API endpoint {#configuring-the-query-api-endpoint} Query API endpoints can be configured directly from query view by clicking the Share button and selecting API Endpoint . You'll be prompted to specify which API key(s) should be able to access the endpoint: After selecting an API key, you will be asked to: - Select the Database role that will be used to run the query ( Full access , Read only or Create a custom role ) - Specify cross-origin resource sharing (CORS) allowed domains After selecting these options, the query API endpoint will automatically be provisioned. An example curl command will be displayed so you can send a test request: The curl command displayed in the interface is given below for convenience: bash curl -H "Content-Type: application/json" -s --user '<key_id>:<key_secret>' '<API-endpoint>?format=JSONEachRow&param_year=<value>' Query API parameters {#query-api-parameters} Query parameters in a query can be specified with the syntax {parameter_name: type} . These parameters will be automatically detected and the example request payload will contain a queryVariables object through which you can pass these parameters. Testing and monitoring {#testing-and-monitoring} Once a Query API endpoint is created, you can test that it works by using curl or any other HTTP client: After you've sent your first request, a new button should appear immediately to the right of the Share button. Clicking it will open a flyout containing monitoring data about the query: Implementation details {#implementation-details} This endpoint executes queries on your saved Query API endpoints. It supports multiple versions, flexible response formats, parameterized queries, and optional streaming responses (version 2 only). Endpoint: text GET /query-endpoints/{queryEndpointId}/run POST /query-endpoints/{queryEndpointId}/run HTTP methods {#http-methods} | Method | Use Case | Parameters | |---------|----------|------------| | GET | Simple queries with parameters | Pass query variables via URL parameters ( ?param_name=value ) | | POST | Complex queries or when using request body | Pass query variables in request body ( queryVariables object) | When to use GET:
{"source_file": "query-endpoints.md"}
[ 0.03229360654950142, -0.03436514735221863, -0.043622784316539764, 0.07454308867454529, -0.0882570892572403, 0.1195400059223175, -0.07288355380296707, -0.005351439118385315, -0.057336609810590744, 0.02008960396051407, -0.06896860152482986, -0.10184437781572342, 0.02968515083193779, 0.015240...
36a84d54-2ac9-4502-ae81-2875c940f29f
When to use GET: - Simple queries without complex nested data - Parameters can be easily URL-encoded - Caching benefits from HTTP GET semantics When to use POST: - Complex query variables (arrays, objects, large strings) - When request body is preferred for security/privacy - Streaming file uploads or large data Authentication {#authentication} Required: Yes Method: Basic Auth using OpenAPI Key/Secret Permissions: Appropriate permissions for the query endpoint Request configuration {#request-configuration} URL parameters {#url-params} | Parameter | Required | Description | |-----------|----------|-------------| | queryEndpointId | Yes | The unique identifier of the query endpoint to run | Query parameters {#query-params} | Parameter | Required | Description | Example | |-----------|----------|-------------|---------| | format | No | Response format (supports all ClickHouse formats) | ?format=JSONEachRow | | param_:name | No | Query variables when request body is a stream. Replace :name with your variable name | ?param_year=2024 | | :clickhouse_setting | No | Any supported ClickHouse setting | ?max_threads=8 | Headers {#headers} | Header | Required | Description | Values | |--------|----------|-------------|--------| | x-clickhouse-endpoint-version | No | Specifies the endpoint version | 1 or 2 (defaults to last saved version) | | x-clickhouse-endpoint-upgrade | No | Triggers endpoint version upgrade (use with version header) | 1 to upgrade | Request body {#request-body} Parameters {#params} | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | queryVariables | object | No | Variables to be used in the query | | format | string | No | Response format | Supported formats {#supported-formats} | Version | Supported Formats | |-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| | Version 2 | All ClickHouse-supported formats | | Version 1 (limited) | TabSeparated TabSeparatedWithNames TabSeparatedWithNamesAndTypes JSON JSONEachRow CSV CSVWithNames CSVWithNamesAndTypes | Responses {#responses} Success {#success} Status: 200 OK The query was successfully executed. Error codes {#error-codes} | Status Code | Description | |-------------|-------------| | 400 Bad Request | The request was malformed | | 401 Unauthorized | Missing authentication or insufficient permissions | | 404 Not Found | The specified query endpoint was not found |
{"source_file": "query-endpoints.md"}
[ -0.08279699087142944, 0.09777531027793884, -0.04240710660815239, 0.06949527561664581, -0.08616835623979568, -0.052780285477638245, -0.03412371873855591, 0.0034008342772722244, 0.02413591369986534, -0.03303665295243263, -0.007509149610996246, -0.050003666430711746, 0.04514017328619957, -0.0...
1975c32f-bc88-4cb6-9232-80e4a265e44b
Error handling best practices {#error-handling-best-practices} Ensure valid authentication credentials are included in the request Validate the queryEndpointId and queryVariables before sending Implement graceful error handling with appropriate error messages Upgrading endpoint versions {#upgrading-endpoint-versions} To upgrade from version 1 to version 2: Include the x-clickhouse-endpoint-upgrade header set to 1 Include the x-clickhouse-endpoint-version header set to 2 This enables access to version 2 features including: - Support for all ClickHouse formats - Response streaming capabilities - Enhanced performance and functionality Examples {#examples} Basic request {#basic-request} Query API Endpoint SQL: sql SELECT database, name AS num_tables FROM system.tables LIMIT 3; Version 1 {#version-1} bash curl -X POST 'https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run' \ --user '<openApiKeyId:openApiKeySecret>' \ -H 'Content-Type: application/json' \ -d '{ "format": "JSONEachRow" }' javascript fetch( "https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run", { method: "POST", headers: { Authorization: "Basic <base64_encoded_credentials>", "Content-Type": "application/json", }, body: JSON.stringify({ format: "JSONEachRow", }), } ) .then((response) => response.json()) .then((data) => console.log(data)) .catch((error) => console.error("Error:", error)); json title="Response" { "data": { "columns": [ { "name": "database", "type": "String" }, { "name": "num_tables", "type": "String" } ], "rows": [ ["INFORMATION_SCHEMA", "COLUMNS"], ["INFORMATION_SCHEMA", "KEY_COLUMN_USAGE"], ["INFORMATION_SCHEMA", "REFERENTIAL_CONSTRAINTS"] ] } } Version 2 {#version-2} bash curl 'https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?format=JSONEachRow' \ --user '<openApiKeyId:openApiKeySecret>' \ -H 'x-clickhouse-endpoint-version: 2' application/x-ndjson title="Response" {"database":"INFORMATION_SCHEMA","num_tables":"COLUMNS"} {"database":"INFORMATION_SCHEMA","num_tables":"KEY_COLUMN_USAGE"} {"database":"INFORMATION_SCHEMA","num_tables":"REFERENTIAL_CONSTRAINTS"} bash curl -X POST 'https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?format=JSONEachRow' \ --user '<openApiKeyId:openApiKeySecret>' \ -H 'Content-Type: application/json' \ -H 'x-clickhouse-endpoint-version: 2'
{"source_file": "query-endpoints.md"}
[ 0.02004649117588997, 0.016095519065856934, -0.009150268509984016, -0.007277120836079121, -0.02275158278644085, -0.044555407017469406, -0.04135995730757713, 0.00017205937183462083, -0.041219327598810196, 0.03983169421553612, -0.022430820390582085, -0.04400467872619629, 0.0854479968547821, -...
952ee9a1-b758-41b7-92bf-ba5b1de818d8
javascript fetch( "https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?format=JSONEachRow", { method: "POST", headers: { Authorization: "Basic <base64_encoded_credentials>", "Content-Type": "application/json", "x-clickhouse-endpoint-version": "2", }, } ) .then((response) => response.json()) .then((data) => console.log(data)) .catch((error) => console.error("Error:", error)); application/x-ndjson title="Response" {"database":"INFORMATION_SCHEMA","num_tables":"COLUMNS"} {"database":"INFORMATION_SCHEMA","num_tables":"KEY_COLUMN_USAGE"} {"database":"INFORMATION_SCHEMA","num_tables":"REFERENTIAL_CONSTRAINTS"} Request with query variables and version 2 on JSONCompactEachRow format {#request-with-query-variables-and-version-2-on-jsoncompacteachrow-format} Query API Endpoint SQL: sql SELECT name, database FROM system.tables WHERE match(name, {tableNameRegex: String}) AND database = {database: String}; bash curl 'https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?format=JSONCompactEachRow&param_tableNameRegex=query.*&param_database=system' \ --user '<openApiKeyId:openApiKeySecret>' \ -H 'x-clickhouse-endpoint-version: 2' application/x-ndjson title="Response" ["query_cache", "system"] ["query_log", "system"] ["query_views_log", "system"] bash curl -X POST 'https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?format=JSONCompactEachRow' \ --user '<openApiKeyId:openApiKeySecret>' \ -H 'Content-Type: application/json' \ -H 'x-clickhouse-endpoint-version: 2' \ -d '{ "queryVariables": { "tableNameRegex": "query.*", "database": "system" } }' javascript fetch( "https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?format=JSONCompactEachRow", { method: "POST", headers: { Authorization: "Basic <base64_encoded_credentials>", "Content-Type": "application/json", "x-clickhouse-endpoint-version": "2", }, body: JSON.stringify({ queryVariables: { tableNameRegex: "query.*", database: "system", }, }), } ) .then((response) => response.json()) .then((data) => console.log(data)) .catch((error) => console.error("Error:", error)); application/x-ndjson title="Response" ["query_cache", "system"] ["query_log", "system"] ["query_views_log", "system"] Request with array in the query variables that inserts data into a table {#request-with-array-in-the-query-variables-that-inserts-data-into-a-table} Table SQL: SQL CREATE TABLE default.t_arr ( `arr` Array(Array(Array(UInt32))) ) ENGINE = MergeTree ORDER BY tuple() Query API Endpoint SQL: sql INSERT INTO default.t_arr VALUES ({arr: Array(Array(Array(UInt32)))});
{"source_file": "query-endpoints.md"}
[ 0.01923130825161934, -0.009209997020661831, -0.013832297176122665, 0.017429690808057785, -0.035054828971624374, -0.023329665884375572, -0.06449012458324432, 0.022477800026535988, 0.02494545839726925, -0.03596743196249008, 0.026843378320336342, -0.03171635419130325, 0.015346975065767765, 0....
91b08424-da68-42f6-b9a2-f134daa5f7df
Query API Endpoint SQL: sql INSERT INTO default.t_arr VALUES ({arr: Array(Array(Array(UInt32)))}); bash curl -X POST 'https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run' \ --user '<openApiKeyId:openApiKeySecret>' \ -H 'Content-Type: application/json' \ -H 'x-clickhouse-endpoint-version: 2' \ -d '{ "queryVariables": { "arr": [[[12, 13, 0, 1], [12]]] } }' javascript fetch( "https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run", { method: "POST", headers: { Authorization: "Basic <base64_encoded_credentials>", "Content-Type": "application/json", "x-clickhouse-endpoint-version": "2", }, body: JSON.stringify({ queryVariables: { arr: [[[12, 13, 0, 1], [12]]], }, }), } ) .then((response) => response.json()) .then((data) => console.log(data)) .catch((error) => console.error("Error:", error)); text title="Response" OK Request with ClickHouse settings max_threads set to 8 {#request-with-clickhouse-settings-max_threads-set-to-8} Query API Endpoint SQL: sql SELECT * FROM system.tables; bash curl 'https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?max_threads=8' \ --user '<openApiKeyId:openApiKeySecret>' \ -H 'x-clickhouse-endpoint-version: 2' bash curl -X POST 'https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?max_threads=8,' \ --user '<openApiKeyId:openApiKeySecret>' \ -H 'Content-Type: application/json' \ -H 'x-clickhouse-endpoint-version: 2' \ javascript fetch( "https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?max_threads=8", { method: "POST", headers: { Authorization: "Basic <base64_encoded_credentials>", "Content-Type": "application/json", "x-clickhouse-endpoint-version": "2", }, } ) .then((response) => response.json()) .then((data) => console.log(data)) .catch((error) => console.error("Error:", error)); Request and parse the response as a stream` {#request-and-parse-the-response-as-a-stream} Query API Endpoint SQL: sql SELECT name, database FROM system.tables; ``typescript async function fetchAndLogChunks( url: string, openApiKeyId: string, openApiKeySecret: string ) { const auth = Buffer.from( ${openApiKeyId}:${openApiKeySecret}`).toString( "base64" ); const headers = { Authorization: Basic ${auth} , "x-clickhouse-endpoint-version": "2", }; const response = await fetch(url, { headers, method: "POST", body: JSON.stringify({ format: "JSONEachRow" }), }); if (!response.ok) { console.error( HTTP error! Status: ${response.status} ); return; } const reader = response.body as unknown as Readable; reader.on("data", (chunk) => { console.log(chunk.toString()); }); reader.on("end", () => { console.log("Stream ended."); });
{"source_file": "query-endpoints.md"}
[ 0.03180376812815666, 0.02230830118060112, -0.08513205498456955, -0.00024483934976160526, -0.07827236503362656, -0.039824869483709335, 0.002920052269473672, -0.0038135636132210493, 0.05400474742054939, -0.004071357659995556, 0.004736233968287706, -0.025556735694408417, 0.04254131019115448, ...
2c36aaab-3622-4895-a0e5-0df4cb3c7b6f
const reader = response.body as unknown as Readable; reader.on("data", (chunk) => { console.log(chunk.toString()); }); reader.on("end", () => { console.log("Stream ended."); }); reader.on("error", (err) => { console.error("Stream error:", err); }); } const endpointUrl = "https://console-api.clickhouse.cloud/.api/query-endpoints/ /run?format=JSONEachRow"; const openApiKeyId = " "; const openApiKeySecret = " "; // Usage example fetchAndLogChunks(endpointUrl, openApiKeyId, openApiKeySecret).catch((err) => console.error(err) ); ``` ```shell title="Output" npx tsx index.ts {"name":"COLUMNS","database":"INFORMATION_SCHEMA"} {"name":"KEY_COLUMN_USAGE","database":"INFORMATION_SCHEMA"} ... Stream ended. ``` Insert a stream from a file into a table {#insert-a-stream-from-a-file-into-a-table} Create a file ./samples/my_first_table_2024-07-11.csv with the following content: csv "user_id","json","name" "1","{""name"":""John"",""age"":30}","John" "2","{""name"":""Jane"",""age"":25}","Jane" Create Table SQL: sql create table default.my_first_table ( user_id String, json String, name String, ) ENGINE = MergeTree() ORDER BY user_id; Query API Endpoint SQL: sql INSERT INTO default.my_first_table bash cat ./samples/my_first_table_2024-07-11.csv | curl --user '<openApiKeyId:openApiKeySecret>' \ -X POST \ -H 'Content-Type: application/octet-stream' \ -H 'x-clickhouse-endpoint-version: 2' \ "https://console-api.clickhouse.cloud/.api/query-endpoints/<endpoint id>/run?format=CSV" \ --data-binary @-
{"source_file": "query-endpoints.md"}
[ -0.0011311538983136415, 0.049642328172922134, -0.016073696315288544, 0.03166717290878296, 0.00516989640891552, -0.02316313609480858, -0.03524111211299896, 0.05421364679932594, 0.05661533400416374, 0.01660301350057125, -0.05875357240438461, 0.0160137377679348, -0.022234704345464706, 0.02031...
9e19f1ce-2768-4d87-abee-89e79bdd3b3f
slug: /cloud/guides/sql-console/gather-connection-details sidebar_label: 'Gather your connection details' title: 'Gather your connection details' description: 'Gather your connection details' doc_type: 'guide' keywords: ['connection details', 'credentials', 'connection string', 'setup', 'configuration'] import ConnectionDetails from '@site/docs/_snippets/_gather_your_details_http.mdx';
{"source_file": "connection_details.md"}
[ 0.025101343169808388, -0.0373239628970623, -0.08596492558717728, 0.00243061943911016, -0.06392689794301987, -0.006226543337106705, 0.021578149870038033, -0.027338067069649696, -0.024123726412653923, 0.04372687637805939, -0.023115720599889755, -0.012896541506052017, 0.05535836145281792, -0....
06f3335a-41de-4d3a-aaca-e814d05b0d0a
slug: /cloud/bestpractices/usage-limits sidebar_label: 'Service limits' title: 'Usage limits' description: 'Describes the recommended usage limits in ClickHouse Cloud' doc_type: 'reference' keywords: ['usage limits', 'quotas', 'best practices', 'resource management', 'cloud features'] While ClickHouse is known for its speed and reliability, optimal performance is achieved within certain operating parameters. For example, having too many tables, databases, or parts can negatively impact performance. To prevent this, ClickHouse Cloud enforces limits across several operational dimensions. The details of these guardrails are listed below. :::tip If you've run up against one of these guardrails, it's possible that you are implementing your use case in an unoptimized way. Contact our support team and we will gladly help you refine your use case to avoid exceeding the guardrails or look together at how we can increase them in a controlled manner. ::: | Dimension | Limit | |-------------------------------|------------------------------------------------------------| | Databases | 1000 | | Tables | 5000 | | Columns | ∼1000 (wide format is preferred to compact) | | Partitions | 50k | | Parts | 100k across the entire instance | | Part size | 150gb | | Services per organization | 20 (soft) | | Services per warehouse | 5 (soft) | | Replicas per service | 20 (soft) | | Low cardinality | 10k or less | | Primary keys in a table | 4-5 that sufficiently filter down the data | | Query concurrency | 1000 (per replica) | | Batch ingest | anything > 1M will be split by the system in 1M row blocks | :::note For Single Replica Services, the maximum number of databases is restricted to 100, and the maximum number of tables is restricted to 500. In addition, storage for Basic Tier Services is limited to 1 TB. :::
{"source_file": "usagelimits.md"}
[ -0.010466460138559341, -0.0018443510634824634, 0.007066564634442329, -0.04832593351602554, 0.00242138234898448, -0.040094561874866486, 0.027754900977015495, 0.0002723856014199555, -0.04000137001276016, 0.02907821536064148, 0.025388095527887344, 0.040783826261758804, 0.046865444630384445, -...
21368494-3706-413c-b7d0-33e886c63e8e
slug: /cloud/bestpractices/multi-tenancy sidebar_label: 'Multi tenancy' title: 'Multi tenancy' description: 'Best practices to implement multi tenancy' doc_type: 'guide' keywords: ['multitenancy', 'isolation', 'best practices', 'architecture', 'multi-tenant'] On a SaaS data analytics platform, it is common for multiple tenants, such as organizations, customers, or business units, to share the same database infrastructure while maintaining logical separation of their data. This allows different users to securely access their own data within the same platform. Depending on the requirements, there are different ways to implement multi-tenancy. Below is a guide on how to implement them with ClickHouse Cloud. Shared table {#shared-table} In this approach, data from all tenants is stored in a single shared table, with a field (or set of fields) used to identify each tenant's data. To maximize performance, this field should be included in the primary key . To ensure that users can only access data belonging to their respective tenants we use role-based access control , implemented through row policies . We recommend this approach as this is the simplest to manage, particularly when all tenants share the same data schema and data volumes are moderate (< TBs) By consolidating all tenant data into a single table, storage efficiency is improved through optimized data compression and reduced metadata overhead. Additionally, schema updates are simplified since all data is centrally managed. This method is particularly effective for handling a large number of tenants (potentially millions). However, alternative approaches may be more suitable if tenants have different data schemas or are expected to diverge over time. In cases where there is a significant gap in data volume between tenants, smaller tenants may experience unnecessary query performance impacts. Note, this issue is largely mitigated by including the tenant field in the primary key. Example {#shared-table-example} This is an example of a shared table multi-tenancy model implementation. First, let's create a shared table with a field tenant_id included in the primary key. sql --- Create table events. Using tenant_id as part of the primary key CREATE TABLE events ( tenant_id UInt32, -- Tenant identifier id UUID, -- Unique event ID type LowCardinality(String), -- Type of event timestamp DateTime, -- Timestamp of the event user_id UInt32, -- ID of the user who triggered the event data String, -- Event data ) ORDER BY (tenant_id, timestamp) Let's insert fake data.
{"source_file": "multitenancy.md"}
[ 0.04285800829529762, -0.04829035699367523, -0.061262525618076324, 0.008449695073068142, -0.041612688452005386, -0.008893021382391453, -0.013523638248443604, -0.061017680913209915, -0.016203587874770164, 0.0358256958425045, 0.06146702170372009, -0.006863573100417852, 0.10495663434267044, 0....
8f717d8b-e1db-4f16-a18e-f71cf6cead2d
Let's insert fake data. sql -- Insert some dummy rows INSERT INTO events (tenant_id, id, type, timestamp, user_id, data) VALUES (1, '7b7e0439-99d0-4590-a4f7-1cfea1e192d1', 'user_login', '2025-03-19 08:00:00', 1001, '{"device": "desktop", "location": "LA"}'), (1, '846aa71f-f631-47b4-8429-ee8af87b4182', 'purchase', '2025-03-19 08:05:00', 1002, '{"item": "phone", "amount": 799}'), (1, '6b4d12e4-447d-4398-b3fa-1c1e94d71a2f', 'user_logout', '2025-03-19 08:10:00', 1001, '{"device": "desktop", "location": "LA"}'), (2, '7162f8ea-8bfd-486a-a45e-edfc3398ca93', 'user_login', '2025-03-19 08:12:00', 2001, '{"device": "mobile", "location": "SF"}'), (2, '6b5f3e55-5add-479e-b89d-762aa017f067', 'purchase', '2025-03-19 08:15:00', 2002, '{"item": "headphones", "amount": 199}'), (2, '43ad35a1-926c-4543-a133-8672ddd504bf', 'user_logout', '2025-03-19 08:20:00', 2001, '{"device": "mobile", "location": "SF"}'), (1, '83b5eb72-aba3-4038-bc52-6c08b6423615', 'purchase', '2025-03-19 08:45:00', 1003, '{"item": "monitor", "amount": 450}'), (1, '975fb0c8-55bd-4df4-843b-34f5cfeed0a9', 'user_login', '2025-03-19 08:50:00', 1004, '{"device": "desktop", "location": "LA"}'), (2, 'f50aa430-4898-43d0-9d82-41e7397ba9b8', 'purchase', '2025-03-19 08:55:00', 2003, '{"item": "laptop", "amount": 1200}'), (2, '5c150ceb-b869-4ebb-843d-ab42d3cb5410', 'user_login', '2025-03-19 09:00:00', 2004, '{"device": "mobile", "location": "SF"}'), Then let's create two users user_1 and user_2 . sql -- Create users CREATE USER user_1 IDENTIFIED BY '<password>' CREATE USER user_2 IDENTIFIED BY '<password>' We create row policies that restricts user_1 and user_2 to access only their tenants' data. sql -- Create row policies CREATE ROW POLICY user_filter_1 ON default.events USING tenant_id=1 TO user_1 CREATE ROW POLICY user_filter_2 ON default.events USING tenant_id=2 TO user_2 Then GRANT SELECT privileges on the shared table using a common role. ```sql -- Create role CREATE ROLE user_role -- Grant read only to events table. GRANT SELECT ON default.events TO user_role GRANT user_role TO user_1 GRANT user_role TO user_2 ``` Now you can connect as user_1 and run a simple select. Only rows from the first tenant are returned. ```sql -- Logged as user_1 SELECT * FROM events
{"source_file": "multitenancy.md"}
[ -0.0011032653274014592, 0.07600067555904388, -0.013857352547347546, 0.023227015510201454, -0.0902038961648941, -0.028122566640377045, 0.07653047889471054, -0.04026348143815994, 0.06388697028160095, 0.00354396621696651, 0.08883975446224213, -0.06137224659323692, 0.01886039599776268, 0.02545...
6aa9bfff-1a92-415f-bf13-0cfe394f7b84
Now you can connect as user_1 and run a simple select. Only rows from the first tenant are returned. ```sql -- Logged as user_1 SELECT * FROM events ┌─tenant_id─┬─id───────────────────────────────────┬─type────────┬───────────timestamp─┬─user_id─┬─data────────────────────────────────────┐ 1. │ 1 │ 7b7e0439-99d0-4590-a4f7-1cfea1e192d1 │ user_login │ 2025-03-19 08:00:00 │ 1001 │ {"device": "desktop", "location": "LA"} │ 2. │ 1 │ 846aa71f-f631-47b4-8429-ee8af87b4182 │ purchase │ 2025-03-19 08:05:00 │ 1002 │ {"item": "phone", "amount": 799} │ 3. │ 1 │ 6b4d12e4-447d-4398-b3fa-1c1e94d71a2f │ user_logout │ 2025-03-19 08:10:00 │ 1001 │ {"device": "desktop", "location": "LA"} │ 4. │ 1 │ 83b5eb72-aba3-4038-bc52-6c08b6423615 │ purchase │ 2025-03-19 08:45:00 │ 1003 │ {"item": "monitor", "amount": 450} │ 5. │ 1 │ 975fb0c8-55bd-4df4-843b-34f5cfeed0a9 │ user_login │ 2025-03-19 08:50:00 │ 1004 │ {"device": "desktop", "location": "LA"} │ └───────────┴──────────────────────────────────────┴─────────────┴─────────────────────┴─────────┴─────────────────────────────────────────┘ ``` Separate tables {#separate-tables} In this approach, each tenant's data is stored in a separate table within the same database, eliminating the need for a specific field to identify tenants. User access is enforced using a GRANT statement , ensuring that each user can access only tables containing their tenants' data. Using separate tables is a good choice when tenants have different data schemas. For scenarios involving a few tenants with very large datasets where query performance is critical, this approach may outperform a shared table model. Since there is no need to filter out other tenants' data, queries can be more efficient. Additionally, primary keys can be further optimized, as there is no need to include an extra field (such as a tenant ID) in the primary key. Note this approach doesn't scale for 1000s of tenants. See usage limits . Example {#separate-tables-example} This is an example of a separate tables multi-tenancy model implementation. First, let's create two tables, one for events from tenant_1 and one for the events from tenant_2 . ```sql -- Create table for tenant 1 CREATE TABLE events_tenant_1 ( id UUID, -- Unique event ID type LowCardinality(String), -- Type of event timestamp DateTime, -- Timestamp of the event user_id UInt32, -- ID of the user who triggered the event data String, -- Event data ) ORDER BY (timestamp, user_id) -- Primary key can focus on other attributes
{"source_file": "multitenancy.md"}
[ 0.01779751107096672, -0.025526732206344604, -0.01371307484805584, 0.010442349128425121, -0.1175772026181221, -0.019491814076900482, 0.0959727093577385, -0.028096714988350868, 0.028906330466270447, 0.005661866627633572, 0.06604178249835968, -0.061650972813367844, -0.014416541904211044, -0.0...
7e0221f6-7e3d-46fb-8684-093ed84d92dd
-- Create table for tenant 2 CREATE TABLE events_tenant_2 ( id UUID, -- Unique event ID type LowCardinality(String), -- Type of event timestamp DateTime, -- Timestamp of the event user_id UInt32, -- ID of the user who triggered the event data String, -- Event data ) ORDER BY (timestamp, user_id) -- Primary key can focus on other attributes ``` Let's insert fake data. ```sql INSERT INTO events_tenant_1 (id, type, timestamp, user_id, data) VALUES ('7b7e0439-99d0-4590-a4f7-1cfea1e192d1', 'user_login', '2025-03-19 08:00:00', 1001, '{"device": "desktop", "location": "LA"}'), ('846aa71f-f631-47b4-8429-ee8af87b4182', 'purchase', '2025-03-19 08:05:00', 1002, '{"item": "phone", "amount": 799}'), ('6b4d12e4-447d-4398-b3fa-1c1e94d71a2f', 'user_logout', '2025-03-19 08:10:00', 1001, '{"device": "desktop", "location": "LA"}'), ('83b5eb72-aba3-4038-bc52-6c08b6423615', 'purchase', '2025-03-19 08:45:00', 1003, '{"item": "monitor", "amount": 450}'), ('975fb0c8-55bd-4df4-843b-34f5cfeed0a9', 'user_login', '2025-03-19 08:50:00', 1004, '{"device": "desktop", "location": "LA"}') INSERT INTO events_tenant_2 (id, type, timestamp, user_id, data) VALUES ('7162f8ea-8bfd-486a-a45e-edfc3398ca93', 'user_login', '2025-03-19 08:12:00', 2001, '{"device": "mobile", "location": "SF"}'), ('6b5f3e55-5add-479e-b89d-762aa017f067', 'purchase', '2025-03-19 08:15:00', 2002, '{"item": "headphones", "amount": 199}'), ('43ad35a1-926c-4543-a133-8672ddd504bf', 'user_logout', '2025-03-19 08:20:00', 2001, '{"device": "mobile", "location": "SF"}'), ('f50aa430-4898-43d0-9d82-41e7397ba9b8', 'purchase', '2025-03-19 08:55:00', 2003, '{"item": "laptop", "amount": 1200}'), ('5c150ceb-b869-4ebb-843d-ab42d3cb5410', 'user_login', '2025-03-19 09:00:00', 2004, '{"device": "mobile", "location": "SF"}') ``` Then let's create two users user_1 and user_2 . sql -- Create users CREATE USER user_1 IDENTIFIED BY '<password>' CREATE USER user_2 IDENTIFIED BY '<password>' Then GRANT SELECT privileges on the corresponding table. sql -- Grant read only to events table. GRANT SELECT ON default.events_tenant_1 TO user_1 GRANT SELECT ON default.events_tenant_2 TO user_2 Now you can connect as user_1 and run a simple select from the table corresponding to this user. Only rows from the first tenant are returned. ```sql -- Logged as user_1 SELECT * FROM default.events_tenant_1
{"source_file": "multitenancy.md"}
[ 0.06718207895755768, 0.04701567813754082, -0.020574677735567093, 0.022831207141280174, -0.09615873545408249, -0.037182923406362534, 0.06546232104301453, -0.00756363570690155, 0.040388599038124084, 0.030881933867931366, 0.10628586262464523, -0.0907466784119606, 0.0232401080429554, 0.0183823...
567f9ce0-2841-472e-9f43-8738a88932fb
```sql -- Logged as user_1 SELECT * FROM default.events_tenant_1 ┌─id───────────────────────────────────┬─type────────┬───────────timestamp─┬─user_id─┬─data────────────────────────────────────┐ 1. │ 7b7e0439-99d0-4590-a4f7-1cfea1e192d1 │ user_login │ 2025-03-19 08:00:00 │ 1001 │ {"device": "desktop", "location": "LA"} │ 2. │ 846aa71f-f631-47b4-8429-ee8af87b4182 │ purchase │ 2025-03-19 08:05:00 │ 1002 │ {"item": "phone", "amount": 799} │ 3. │ 6b4d12e4-447d-4398-b3fa-1c1e94d71a2f │ user_logout │ 2025-03-19 08:10:00 │ 1001 │ {"device": "desktop", "location": "LA"} │ 4. │ 83b5eb72-aba3-4038-bc52-6c08b6423615 │ purchase │ 2025-03-19 08:45:00 │ 1003 │ {"item": "monitor", "amount": 450} │ 5. │ 975fb0c8-55bd-4df4-843b-34f5cfeed0a9 │ user_login │ 2025-03-19 08:50:00 │ 1004 │ {"device": "desktop", "location": "LA"} │ └──────────────────────────────────────┴─────────────┴─────────────────────┴─────────┴─────────────────────────────────────────┘ ``` Separate databases {#separate-databases} Each tenant's data is stored in a separate database within the same ClickHouse service. This approach is useful if each tenant requires a large number of tables and possibly materialized views, and has different data schema. However, it may become challenging to manage if the number of tenants is large. The implementation is similar to the separate tables approach, but instead of granting privileges at the table level, privileges are granted at the database level. Note this approach doesn't scale for 1000s of tenants. See usage limits . Example {#separate-databases-example} This is an example of a separate databases multi-tenancy model implementation. First, let's create two databases, one for tenant_1 and one for tenant_2 . ```sql -- Create database for tenant_1 CREATE DATABASE tenant_1; -- Create database for tenant_2 CREATE DATABASE tenant_2; ``` ```sql -- Create table for tenant_1 CREATE TABLE tenant_1.events ( id UUID, -- Unique event ID type LowCardinality(String), -- Type of event timestamp DateTime, -- Timestamp of the event user_id UInt32, -- ID of the user who triggered the event data String, -- Event data ) ORDER BY (timestamp, user_id); -- Create table for tenant_2 CREATE TABLE tenant_2.events ( id UUID, -- Unique event ID type LowCardinality(String), -- Type of event timestamp DateTime, -- Timestamp of the event user_id UInt32, -- ID of the user who triggered the event data String, -- Event data ) ORDER BY (timestamp, user_id); ``` Let's insert fake data.
{"source_file": "multitenancy.md"}
[ 0.019323309883475304, 0.010497205890715122, 0.0334794782102108, -0.001629079575650394, -0.053299110382795334, -0.0019476443994790316, 0.14016634225845337, -0.03053717315196991, 0.05974006652832031, 0.05060310661792755, 0.09643474221229553, -0.09769371151924133, -0.007110057398676872, 0.000...
48b2751a-c710-4d93-8f6b-73da4009555f
Let's insert fake data. ```sql INSERT INTO tenant_1.events (id, type, timestamp, user_id, data) VALUES ('7b7e0439-99d0-4590-a4f7-1cfea1e192d1', 'user_login', '2025-03-19 08:00:00', 1001, '{"device": "desktop", "location": "LA"}'), ('846aa71f-f631-47b4-8429-ee8af87b4182', 'purchase', '2025-03-19 08:05:00', 1002, '{"item": "phone", "amount": 799}'), ('6b4d12e4-447d-4398-b3fa-1c1e94d71a2f', 'user_logout', '2025-03-19 08:10:00', 1001, '{"device": "desktop", "location": "LA"}'), ('83b5eb72-aba3-4038-bc52-6c08b6423615', 'purchase', '2025-03-19 08:45:00', 1003, '{"item": "monitor", "amount": 450}'), ('975fb0c8-55bd-4df4-843b-34f5cfeed0a9', 'user_login', '2025-03-19 08:50:00', 1004, '{"device": "desktop", "location": "LA"}') INSERT INTO tenant_2.events (id, type, timestamp, user_id, data) VALUES ('7162f8ea-8bfd-486a-a45e-edfc3398ca93', 'user_login', '2025-03-19 08:12:00', 2001, '{"device": "mobile", "location": "SF"}'), ('6b5f3e55-5add-479e-b89d-762aa017f067', 'purchase', '2025-03-19 08:15:00', 2002, '{"item": "headphones", "amount": 199}'), ('43ad35a1-926c-4543-a133-8672ddd504bf', 'user_logout', '2025-03-19 08:20:00', 2001, '{"device": "mobile", "location": "SF"}'), ('f50aa430-4898-43d0-9d82-41e7397ba9b8', 'purchase', '2025-03-19 08:55:00', 2003, '{"item": "laptop", "amount": 1200}'), ('5c150ceb-b869-4ebb-843d-ab42d3cb5410', 'user_login', '2025-03-19 09:00:00', 2004, '{"device": "mobile", "location": "SF"}') ``` Then let's create two users user_1 and user_2 . sql -- Create users CREATE USER user_1 IDENTIFIED BY '<password>' CREATE USER user_2 IDENTIFIED BY '<password>' Then GRANT SELECT privileges on the corresponding table. sql -- Grant read only to events table. GRANT SELECT ON tenant_1.events TO user_1 GRANT SELECT ON tenant_2.events TO user_2 Now you can connect as user_1 and run a simple select on the events table of the appropriate database. Only rows from the first tenant are returned. ```sql -- Logged as user_1 SELECT * FROM tenant_1.events ┌─id───────────────────────────────────┬─type────────┬───────────timestamp─┬─user_id─┬─data────────────────────────────────────┐ 1. │ 7b7e0439-99d0-4590-a4f7-1cfea1e192d1 │ user_login │ 2025-03-19 08:00:00 │ 1001 │ {"device": "desktop", "location": "LA"} │ 2. │ 846aa71f-f631-47b4-8429-ee8af87b4182 │ purchase │ 2025-03-19 08:05:00 │ 1002 │ {"item": "phone", "amount": 799} │ 3. │ 6b4d12e4-447d-4398-b3fa-1c1e94d71a2f │ user_logout │ 2025-03-19 08:10:00 │ 1001 │ {"device": "desktop", "location": "LA"} │ 4. │ 83b5eb72-aba3-4038-bc52-6c08b6423615 │ purchase │ 2025-03-19 08:45:00 │ 1003 │ {"item": "monitor", "amount": 450} │ 5. │ 975fb0c8-55bd-4df4-843b-34f5cfeed0a9 │ user_login │ 2025-03-19 08:50:00 │ 1004 │ {"device": "desktop", "location": "LA"} │ └──────────────────────────────────────┴─────────────┴─────────────────────┴─────────┴─────────────────────────────────────────┘ ``` Compute-compute separation {#compute-compute-separation}
{"source_file": "multitenancy.md"}
[ -0.009669000282883644, 0.07994507253170013, -0.0066756331361830235, 0.03309870511293411, -0.08260377496480942, -0.03553008660674095, 0.07042019069194794, -0.022218825295567513, 0.05485711991786957, 0.009470481425523758, 0.057829201221466064, -0.050831764936447144, 0.011012312024831772, 0.0...
5270ed44-5451-4378-81ee-72cf08e0ade0
Compute-compute separation {#compute-compute-separation} The three approaches described above can also be further isolated by using Warehouses . Data is shared through a common object storage but each tenant can have its own compute service thanks to compute-compute separation with different CPU/Memory ratio. User management is similar to the approaches described previously, since all services in a warehouse share access controls . Note the number of child services in a warehouse is limited to a small number. See Warehouse limitations . Separate cloud service {#separate-service} The most radical approach is to use a different ClickHouse service per tenant. This less common method would be a solution if tenants data are required to be stored in different regions - for legal, security or proximity reasons. A user account must be created on each service where the user can access their respective tenant's data. This approach is harder to manage and bring overhead with each service, as they each requires their own infrastructure to run. Services can be managed via the ClickHouse Cloud API with orchestration also possible via the official Terraform provider . Example {#separate-service-example} This is an example of a separate service multi-tenancy model implementation. Note the example shows the creation of tables and users on one ClickHouse service, the same will have to be replicated on all services. First, let's create the table events sql -- Create table for tenant_1 CREATE TABLE events ( id UUID, -- Unique event ID type LowCardinality(String), -- Type of event timestamp DateTime, -- Timestamp of the event user_id UInt32, -- ID of the user who triggered the event data String, -- Event data ) ORDER BY (timestamp, user_id); Let's insert fake data. sql INSERT INTO events (id, type, timestamp, user_id, data) VALUES ('7b7e0439-99d0-4590-a4f7-1cfea1e192d1', 'user_login', '2025-03-19 08:00:00', 1001, '{"device": "desktop", "location": "LA"}'), ('846aa71f-f631-47b4-8429-ee8af87b4182', 'purchase', '2025-03-19 08:05:00', 1002, '{"item": "phone", "amount": 799}'), ('6b4d12e4-447d-4398-b3fa-1c1e94d71a2f', 'user_logout', '2025-03-19 08:10:00', 1001, '{"device": "desktop", "location": "LA"}'), ('83b5eb72-aba3-4038-bc52-6c08b6423615', 'purchase', '2025-03-19 08:45:00', 1003, '{"item": "monitor", "amount": 450}'), ('975fb0c8-55bd-4df4-843b-34f5cfeed0a9', 'user_login', '2025-03-19 08:50:00', 1004, '{"device": "desktop", "location": "LA"}') Then let's create two users user_1 sql -- Create users CREATE USER user_1 IDENTIFIED BY '<password>' Then GRANT SELECT privileges on the corresponding table. sql -- Grant read only to events table. GRANT SELECT ON events TO user_1 Now you can connect as user_1 on the service for tenant 1 and run a simple select. Only rows from the first tenant are returned.
{"source_file": "multitenancy.md"}
[ -0.009555158205330372, -0.010403672233223915, -0.057363882660865784, -0.03926601633429527, -0.07733649760484695, -0.03526918962597847, 0.010524366050958633, -0.08058842271566391, 0.0366307869553566, 0.06721534579992294, 0.03753429651260376, -0.060683537274599075, 0.07190226763486862, 0.042...
255fae06-13eb-4413-8f24-9a037d623f8b
Now you can connect as user_1 on the service for tenant 1 and run a simple select. Only rows from the first tenant are returned. ```sql -- Logged as user_1 SELECT * FROM events ┌─id───────────────────────────────────┬─type────────┬───────────timestamp─┬─user_id─┬─data────────────────────────────────────┐ 1. │ 7b7e0439-99d0-4590-a4f7-1cfea1e192d1 │ user_login │ 2025-03-19 08:00:00 │ 1001 │ {"device": "desktop", "location": "LA"} │ 2. │ 846aa71f-f631-47b4-8429-ee8af87b4182 │ purchase │ 2025-03-19 08:05:00 │ 1002 │ {"item": "phone", "amount": 799} │ 3. │ 6b4d12e4-447d-4398-b3fa-1c1e94d71a2f │ user_logout │ 2025-03-19 08:10:00 │ 1001 │ {"device": "desktop", "location": "LA"} │ 4. │ 83b5eb72-aba3-4038-bc52-6c08b6423615 │ purchase │ 2025-03-19 08:45:00 │ 1003 │ {"item": "monitor", "amount": 450} │ 5. │ 975fb0c8-55bd-4df4-843b-34f5cfeed0a9 │ user_login │ 2025-03-19 08:50:00 │ 1004 │ {"device": "desktop", "location": "LA"} │ └──────────────────────────────────────┴─────────────┴─────────────────────┴─────────┴─────────────────────────────────────────┘ ```
{"source_file": "multitenancy.md"}
[ 0.000876881938893348, -0.04857439547777176, -0.023233752697706223, -0.00805917289108038, -0.11275541037321091, -0.013077044859528542, 0.1029898002743721, -0.03627563267946243, 0.03515240550041199, 0.017379703000187874, 0.06595486402511597, -0.05516061931848526, 0.005997045896947384, 0.0197...
851102df-c496-480b-901c-b43482e0eed5
slug: /cloud/bestpractices keywords: ['Cloud', 'Best Practices', 'Bulk Inserts', 'Asynchronous Inserts', 'Avoid Mutations', 'Avoid Nullable Columns', 'Avoid Optimize Final', 'Low Cardinality Partitioning Key', 'Multi Tenancy', 'Usage Limits'] title: 'Overview' hide_title: true description: 'Landing page for Best Practices section in ClickHouse Cloud' doc_type: 'landing-page' import TableOfContents from '@site/docs/best-practices/_snippets/_table_of_contents.md'; Best Practices in ClickHouse Cloud {#best-practices-in-clickhouse-cloud} This section provides best practices you will want to follow to get the most out of ClickHouse Cloud. | Page | Description | |----------------------------------------------------------|----------------------------------------------------------------------------| | Usage Limits | Explore the limits of ClickHouse. | | Multi tenancy | Learn about different strategies to implement multi-tenancy. | These are in addition to the standard best practices which apply to all deployments of ClickHouse.
{"source_file": "index.md"}
[ 0.008490200154483318, -0.008044284768402576, -0.028029872104525566, 0.027110373601317406, 0.06190729886293411, -0.002131069079041481, -0.0288737490773201, -0.02013544924557209, -0.030106298625469208, 0.11064466089010239, 0.05512893199920654, -0.0015581664629280567, 0.09845857322216034, -0....
744150c7-b199-45a4-ab3a-87710ab16ec9
sidebar_label: 'Review and restore backups' sidebar_position: 0 slug: /cloud/manage/backups/overview title: 'Overview' keywords: ['backups', 'cloud backups', 'restore'] description: 'Provides an overview of backups in ClickHouse Cloud' doc_type: 'guide' import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge'; import ScalePlanFeatureBadge from '@theme/badges/ScalePlanFeatureBadge'; import Image from '@theme/IdealImage'; import backup_chain from '@site/static/images/cloud/manage/backup-chain.png'; import backup_status_list from '@site/static/images/cloud/manage/backup-status-list.png'; import backup_usage from '@site/static/images/cloud/manage/backup-usage.png'; import backup_restore from '@site/static/images/cloud/manage/backup-restore.png'; import backup_service_provisioning from '@site/static/images/cloud/manage/backup-service-provisioning.png'; Review and restore backups This guide covers how backups work in ClickHouse Cloud, what options you have to configure backups for your service, and how to restore from a backup. Backup status list {#backup-status-list} Your service will be backed up based on the set schedule, whether it is the default daily schedule or a custom schedule picked by you. All available backups can be viewed from the Backups tab of the service. From here, you can see the status of the backup, the duration, as well as the size of the backup. You can also restore a specific backup using the Actions column. Understanding backup cost {#understanding-backup-cost} Per the default policy, ClickHouse Cloud mandates a backup every day, with a 24 hour retention. Choosing a schedule that requires retaining more data, or causes more frequent backups can cause additional storage charges for backups. To understand the backup cost, you can view the backup cost per service from the usage screen (as shown below). Once you have backups running for a few days with a customized schedule, you can get an idea of the cost and extrapolate to get the monthly cost for backups. Estimating the total cost for your backups requires you to set a schedule. We are also working on updating our pricing calculator , so you can get a monthly cost estimate before setting a schedule. You will need to provide the following inputs in order to estimate the cost: - Size of the full and incremental backups - Desired frequency - Desired retention - Cloud provider and region :::note Keep in mind that the estimated cost for backups will change as the size of the data in the service grows over time. ::: Restore a backup {#restore-a-backup} Backups are restored to a new ClickHouse Cloud service, not to the existing service from which the backup was taken. After clicking on the Restore backup icon, you can specify the service name of the new service that will be created, and then restore this backup: The new service will show in the services list as Provisioning until it is ready:
{"source_file": "01_review-and-restore-backups.md"}
[ -0.058158740401268005, 0.05718250200152397, -0.007538944948464632, 0.06894510239362717, 0.06466790288686752, 0.025398874655365944, 0.016496211290359497, 0.007160583510994911, -0.027878211811184883, 0.05079401656985283, 0.045305509120225906, 0.015383233316242695, 0.10297787934541702, -0.077...
dfda51ea-8f66-4ebb-acf7-96e9cc52abbc
The new service will show in the services list as Provisioning until it is ready: Working with your restored service {#working-with-your-restored-service} After a backup has been restored, you will now have two similar services: the original service that needed to be restored, and a new restored service that has been restored from a backup of the original. Once the backup restore is complete, you should do one of the following: - Use the new restored service and remove the original service. - Migrate data from the new restored service back to the original service and remove the new restored service. Use the new restored service {#use-the-new-restored-service} To use the new service, perform these steps: Verify that the new service has the IP Access List entries required for your use case. Verify that the new service contains the data that you need. Remove the original service. Migrate data from the newly restored service back to the original service {#migrate-data-from-the-newly-restored-service-back-to-the-original-service} Suppose you cannot work with the newly restored service for some reason, for example, if you still have users or applications that connect to the existing service. You may decide to migrate the newly restored data into the original service. The migration can be accomplished by following these steps: Allow remote access to the newly restored service The new service should be restored from a backup with the same IP Allow List as the original service. This is required as connections will not be allowed to other ClickHouse Cloud services unless you had allowed access from Anywhere . Modify the allow list and allow access from Anywhere temporarily. See the IP Access List docs for details. On the newly restored ClickHouse service (the system that hosts the restored data) :::note You will need to reset the password for the new service in order to access it. You can do that from the service list Settings tab. ::: Add a read only user that can read the source table ( db.table in this example): sql CREATE USER exporter IDENTIFIED WITH SHA256_PASSWORD BY 'password-here' SETTINGS readonly = 1; sql GRANT SELECT ON db.table TO exporter; Copy the table definition: sql SELECT create_table_query FROM system.tables WHERE database = 'db' AND table = 'table' On the destination ClickHouse Cloud system (the one that had the damaged table): Create the destination database: sql CREATE DATABASE db Using the CREATE TABLE statement from the source, create the destination: :::tip Change the ENGINE to ReplicatedMergeTree without any parameters when you run the CREATE statement. ClickHouse Cloud always replicates tables and provides the correct parameters. ::: sql CREATE TABLE db.table ... ENGINE = ReplicatedMergeTree ORDER BY ...
{"source_file": "01_review-and-restore-backups.md"}
[ -0.10590425133705139, -0.06995385885238647, 0.037752676755189896, -0.0520794652402401, -0.0004007259267382324, -0.030217690393328667, -0.009741728194057941, -0.12308498471975327, -0.0829678550362587, 0.024085933342576027, 0.03432413935661316, 0.07312965393066406, 0.0523441918194294, -0.029...
33399390-3f44-40fd-b89f-e83a17d95e09
sql CREATE TABLE db.table ... ENGINE = ReplicatedMergeTree ORDER BY ... Use the remoteSecure function to pull the data from the newly restored ClickHouse Cloud service into your original service: sql INSERT INTO db.table SELECT * FROM remoteSecure('source-hostname', db, table, 'exporter', 'password-here') After you have successfully inserted the data into your original service, make sure to verify the data in the service. You should also delete the new service once the data is verified. Undeleting or undropping tables {#undeleting-or-undropping-tables} The UNDROP command is supported in ClickHouse Cloud through Shared Catalog . To prevent users from accidentally dropping tables, you can use GRANT statements to revoke permissions for the DROP TABLE command for a specific user or role. :::note To prevent accidental deletion of data, please note that by default it is not possible to drop tables > 1TB in size in ClickHouse Cloud. Should you wish to drop tables greater than this threshold you can use setting max_table_size_to_drop to do so: sql DROP TABLE IF EXISTS table_to_drop SYNC SETTINGS max_table_size_to_drop=2000000000000 -- increases the limit to 2TB ::: :::note Legacy Plans: For customers on legacy plans, default daily backups retained for 24 hours, are included in the storage cost. ::: Configurable backups {#configurable-backups} If you want to set up a backups schedule different from the default backup schedule, take a look at Configurable Backups . Export backups to your own cloud account {#export-backups-to-your-own-cloud-account} For users wanting to export backups to their own cloud account, see here .
{"source_file": "01_review-and-restore-backups.md"}
[ -0.05160381272435188, -0.09355770796537399, 0.012851415202021599, 0.03988218307495117, -0.002782651921734214, -0.03905881568789482, 0.01986626908183098, -0.09946584701538086, -0.03027796745300293, 0.09620870649814606, 0.07507901638746262, 0.008763873018324375, 0.12092287093400955, -0.05642...
df6dfbb6-e0d0-41a1-8c30-4b64f0501a45
sidebar_label: 'Configure backup schedules' slug: /cloud/manage/backups/configurable-backups description: 'Guide showing how to configure backups' title: 'Configure backup schedules' keywords: ['backups', 'cloud backups', 'restore'] doc_type: 'guide' import backup_settings from '@site/static/images/cloud/manage/backup-settings.png'; import backup_configuration_form from '@site/static/images/cloud/manage/backup-configuration-form.png'; import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge'; import ScalePlanFeatureBadge from '@theme/badges/ScalePlanFeatureBadge'; import Image from '@theme/IdealImage'; To configure the backup schedule for a service, go to the Settings tab in the console and click on Change backup configuration . This opens a tab to the right where you can choose values for retention, frequency, and start time. You will need to save the chosen settings for them to take effect. :::note Start time and frequency are mutually exclusive. Start time takes precedence. ::: :::note Changing the backup schedule can cause higher monthly charges for storage as some of the backups might not be covered in the default backups for the service. See "Understanding backup cost" section below. :::
{"source_file": "02_configurable-backups.md"}
[ -0.07883868366479874, 0.018809432163834572, -0.008721908554434776, 0.07211989909410477, -0.010445253923535347, 0.05071341246366501, -0.03931225836277008, 0.005953730549663305, -0.021131323650479317, 0.017423070967197418, -0.012668713927268982, 0.017652714625000954, 0.09738899022340775, -0....
5e031da1-40eb-4888-a1d8-b571721ba13b
slug: /cloud/manage/backups title: 'Backups' description: 'Table of contents page for backups.' keywords: ['backups', 'configurable backups', 'export backups to own cloud'] doc_type: 'landing-page' | Page | Description | |-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| | Overview | Overview page for backups. | | Configurable Backups | Learn about how Scale and Enterprise tier users can customize their backup schedules according to their specific business needs | | Export Backups to your Own Cloud Account | Learn about an Enterprise tier feature that gives you the ability to export backups to your own cloud account. |
{"source_file": "index.md"}
[ -0.010456383228302002, 0.01999548450112343, 0.020363733172416687, 0.035471826791763306, 0.048506688326597214, 0.004558729939162731, -0.024354835972189903, -0.021943850442767143, 0.02716423012316227, 0.033150214701890945, -0.013284770771861076, -0.034269582480192184, 0.07947501540184021, -0...
a4cca036-9039-4ae0-8620-9ca20b3aa50d
sidebar_label: 'SAML SSO setup' slug: /cloud/security/saml-setup title: 'SAML SSO setup' description: 'How to set up SAML SSO with ClickHouse Cloud' doc_type: 'guide' keywords: ['ClickHouse Cloud', 'SAML', 'SSO', 'single sign-on', 'IdP', 'Okta', 'Google'] import Image from '@theme/IdealImage'; import samlOrgId from '@site/static/images/cloud/security/saml-org-id.png'; import samlOktaSetup from '@site/static/images/cloud/security/saml-okta-setup.png'; import samlGoogleApp from '@site/static/images/cloud/security/saml-google-app.png'; import samlAzureApp from '@site/static/images/cloud/security/saml-azure-app.png'; import samlAzureClaims from '@site/static/images/cloud/security/saml-azure-claims.png'; import EnterprisePlanFeatureBadge from '@theme/badges/EnterprisePlanFeatureBadge' SAML SSO setup ClickHouse Cloud supports single-sign on (SSO) via security assertion markup language (SAML). This enables you to sign in securely to your ClickHouse Cloud organization by authenticating with your identity provider (IdP). We currently support service provider-initiated SSO SSO, multiple organizations using separate connections, and just-in-time provisioning. We do not yet support a system for cross-domain identity management (SCIM) or attribute mapping. Before you begin {#before-you-begin} You will need Admin permissions in your IdP and the Admin role in your ClickHouse Cloud organization. After setting up your connection within your IdP, contact us with the information requested in the procedure below to complete the process. We recommend setting up a direct link to your organization in addition to your SAML connection to simplify the login process. Each IdP handles this differently. Read on for how to do this for your IdP. How to configure your IdP {#how-to-configure-your-idp} Steps {#steps} Get your organization ID All setups require your organization ID. To obtain your organization ID: 1. Sign in to your [ClickHouse Cloud](https://console.clickhouse.cloud) organization. 3. In the lower left corner, click on your organization name under **Organization**. 4. In the pop-up menu, select **Organization details**. 5. Make note of your **Organization ID** to use below. Configure your SAML integration ClickHouse uses service provider-initiated SAML connections. This means you can log in via https://console.clickhouse.cloud or via a direct link. We do not currently support identity provider initiated connections. Basic SAML configurations include the following: - SSO URL or ACS URL: `https://auth.clickhouse.cloud/login/callback?connection={organizationid}` - Audience URI or Entity ID: `urn:auth0:ch-production:{organizationid}` - Application username: `email` - Attribute mapping: `email = user.email` - Direct link to access your organization: `https://console.clickhouse.cloud/?connection={organizationid}`
{"source_file": "04_saml-sso-setup.md"}
[ -0.06212345138192177, 0.004348136950284243, -0.07734030485153198, 0.02244795672595501, -0.013553343713283539, 0.016600126400589943, 0.09132120013237, -0.05007796362042427, 0.01319293025881052, 0.02475564554333687, 0.06630048155784607, 0.012754732742905617, 0.11539364606142044, 0.0604056604...
d0e218b4-0a7f-4da7-b15b-008002089a0f
- Application username: `email` - Attribute mapping: `email = user.email` - Direct link to access your organization: `https://console.clickhouse.cloud/?connection={organizationid}` For specific configuration steps, refer to your specific identity provider below. Obtain your connection information Obtain your Identity provider SSO URL and x.509 certificate. Refer to your specific identity provider below for instructions on how to retrieve this information. Submit a support case 1. Return to the ClickHouse Cloud console. 2. Select **Help** on the left, then the Support submenu. 3. Click **New case**. 4. Enter the subject "SAML SSO Setup". 5. In the description, paste any links gathered from the instructions above and attach the certificate to the ticket. 6. Please also let us know which domains should be allowed for this connection (e.g. domain.com, domain.ai, etc.). 7. Create a new case. 8. We will complete the setup within ClickHouse Cloud and let you know when it's ready to test. Complete the setup 1. Assign user access within your Identity Provider. 2. Log in to ClickHouse via https://console.clickhouse.cloud OR the direct link you configured in 'Configure your SAML integration' above. Users are initially assigned the 'Member' role, which can log in to the organization and update personal settings. 3. Log out of the ClickHouse organization. 4. Log in with your original authentication method to assign the Admin role to your new SSO account. - For email + password accounts, please use `https://console.clickhouse.cloud/?with=email`. - For social logins, please click the appropriate button (**Continue with Google** or **Continue with Microsoft**) :::note `email` in `?with=email` above is the literal parameter value, not a placeholder ::: 5. Log out with your original authentication method and log back in via https://console.clickhouse.cloud OR the direct link you configured in 'Configure your SAML integration' above. 6. Remove any non-SAML users to enforce SAML for the organization. Going forward users are assigned via your Identity Provider. Configure Okta SAML {#configure-okta-saml} You will configure two App Integrations in Okta for each ClickHouse organization: one SAML app and one bookmark to house your direct link. 1. Create a group to manage access 1. Log in to your Okta instance as an **Administrator**. 2. Select **Groups** on the left. 3. Click **Add group**. 4. Enter a name and description for the group. This group will be used to keep users consistent between the SAML app and its related bookmark app. 5. Click **Save**. 6. Click the name of the group that you created. 7. Click **Assign people** to assign users you would like to have access to this ClickHouse organization. 2. Create a bookmark app to enable users to seamlessly log in
{"source_file": "04_saml-sso-setup.md"}
[ -0.012749586254358292, -0.033738020807504654, -0.039273813366889954, -0.010725414380431175, -0.005505654029548168, 0.015285312198102474, 0.03368094190955162, -0.04875198379158974, 0.03316685929894447, 0.008558094501495361, 0.0036071434151381254, -0.03974991291761398, 0.06459998339414597, 0...
483a95e8-865c-4efa-978b-931fb7bf472c
7. Click **Assign people** to assign users you would like to have access to this ClickHouse organization. 2. Create a bookmark app to enable users to seamlessly log in 1. Select **Applications** on the left, then select the **Applications** subheading. 2. Click **Browse App Catalog**. 3. Search for and select **Bookmark App**. 4. Click **Add integration**. 5. Select a label for the app. 6. Enter the URL as `https://console.clickhouse.cloud/?connection={organizationid}` 7. Go to the **Assignments** tab and add the group you created above. 3. Create a SAML app to enable the connection 1. Select **Applications** on the left, then select the **Applications** subheading. 2. Click **Create App Integration**. 3. Select SAML 2.0 and click Next. 4. Enter a name for your application and check the box next to **Do not display application icon to users** then click **Next**. 5. Use the following values to populate the SAML settings screen. | Field | Value | |--------------------------------|-------| | Single Sign On URL | `https://auth.clickhouse.cloud/login/callback?connection={organizationid}` | | Audience URI (SP Entity ID) | `urn:auth0:ch-production:{organizationid}` | | Default RelayState | Leave blank | | Name ID format | Unspecified | | Application username | Email | | Update application username on | Create and update | 7. Enter the following Attribute Statement. | Name | Name format | Value | |---------|---------------|------------| | email | Basic | user.email | 9. Click **Next**. 10. Enter the requested information on the Feedback screen and click **Finish**. 11. Go to the **Assignments** tab and add the group you created above. 12. On the **Sign On** tab for your new app, click the **View SAML setup instructions** button. 13. Gather these three items and go to Submit a Support Case above to complete the process. - Identity Provider Single Sign-On URL - Identity Provider Issuer - X.509 Certificate Configure Google SAML {#configure-google-saml} You will configure one SAML app in Google for each organization and must provide your users the direct link ( https://console.clickhouse.cloud/?connection={organizationId} ) to bookmark if using multi-org SSO. Create a Google Web App 1. Go to your Google Admin console (admin.google.com). 2. Click **Apps**, then **Web and mobile apps** on the left. 3. Click **Add app** from the top menu, then select **Add custom SAML app**. 4. Enter a name for the app and click **Continue**.
{"source_file": "04_saml-sso-setup.md"}
[ -0.05951347202062607, -0.08084474503993988, -0.10462098568677902, 0.06190751865506172, -0.059784628450870514, 0.04988484084606171, 0.033280592411756516, -0.07726757228374481, 0.012933339923620224, 0.03781875967979431, 0.00283300643786788, -0.038648054003715515, 0.060317181050777435, 0.0037...
3ade2fd2-32ab-4c37-8d52-ac305fa216d5
3. Click **Add app** from the top menu, then select **Add custom SAML app**. 4. Enter a name for the app and click **Continue**. 5. Gather these two items and go to Submit a Support Case above to submit the information to us. NOTE: If you complete the setup before copying this data, click **DOWNLOAD METADATA** from the app's home screen to get the X.509 certificate. - SSO URL - X.509 Certificate 7. Enter the ACS URL and Entity ID below. | Field | Value | |-----------|-------| | ACS URL | `https://auth.clickhouse.cloud/login/callback?connection={organizationid}` | | Entity ID | `urn:auth0:ch-production:{organizationid}` | 8. Check the box for **Signed response**. 9. Select **EMAIL** for the Name ID Format and leave the Name ID as **Basic Information > Primary email.** 10. Click **Continue**. 11. Enter the following Attribute mapping: | Field | Value | |-------------------|---------------| | Basic information | Primary email | | App attributes | email | 13. Click **Finish**. 14. To enable the app click **OFF** for everyone and change the setting to **ON** for everyone. Access can also be limited to groups or organizational units by selecting options on the left side of the screen. Configure Azure (Microsoft) SAML {#configure-azure-microsoft-saml} Azure (Microsoft) SAML may also be referred to as Azure Active Directory (AD) or Microsoft Entra. Create an Azure Enterprise Application You will set up one application integration with a separate sign-on URL for each organization. 1. Log on to the Microsoft Entra admin center. 2. Navigate to **Applications > Enterprise** applications on the left. 3. Click **New application** on the top menu. 4. Click **Create your own application** on the top menu. 5. Enter a name and select **Integrate any other application you don't find in the gallery (Non-gallery)**, then click **Create**. 6. Click **Users and groups** on the left and assign users. 7. Click **Single sign-on** on the left. 8. Click **SAML**. 9. Use the following settings to populate the Basic SAML Configuration screen. | Field | Value | |---------------------------|-------| | Identifier (Entity ID) | `urn:auth0:ch-production:{organizationid}` | | Reply URL (Assertion Consumer Service URL) | `https://auth.clickhouse.cloud/login/callback?connection={organizationid}` | | Sign on URL | `https://console.clickhouse.cloud/?connection={organizationid}` | | Relay State | Blank | | Logout URL | Blank | 11. Add (A) or update (U) the following under Attributes & Claims:
{"source_file": "04_saml-sso-setup.md"}
[ -0.07467021048069, 0.01060586329549551, -0.08989802747964859, 0.0028490941040217876, 0.0027603257913142443, 0.020705897361040115, -0.020168961957097054, -0.023381585255265236, 0.025845222175121307, 0.054862868040800095, 0.018839212134480476, -0.10270290076732635, 0.06492619961500168, 0.031...
2d27bbc2-ddd1-49c0-b3a1-d2ec2219c86e
11. Add (A) or update (U) the following under Attributes & Claims: | Claim name | Format | Source attribute | |--------------------------------------|---------------|------------------| | (U) Unique User Identifier (Name ID) | Email address | user.mail | | (A) email | Basic | user.mail | | (U) /identity/claims/name | Omitted | user.mail | 12. Gather these two items and go to Submit a Support Case above to complete the process: - Login URL - Certificate (Base64) Configure Duo SAML {#configure-duo-saml} Create a Generic SAML Service Provider for Duo 1. Follow the instructions for [Duo Single Sign-On for Generic SAML Service Providers](https://duo.com/docs/sso-generic). 2. Use the following Bridge Attribute mapping: | Bridge Attribute | ClickHouse Attribute | |:-------------------|:-----------------------| | Email Address | email | 3. Use the following values to update your Cloud Application in Duo: | Field | Value | |:----------|:-------------------------------------------| | Entity ID | `urn:auth0:ch-production:{organizationid}` | | Assertion Consumer Service (ACS) URL | `https://auth.clickhouse.cloud/login/callback?connection={organizationid}` | | Service Provider Login URL | `https://console.clickhouse.cloud/?connection={organizationid}` | 4. Gather these two items and go to Submit a Support Case above to complete the process: - Single Sign-On URL - Certificate How it works {#how-it-works} User management with SAML SSO {#user-management-with-saml-sso} For more information on managing user permissions and restricting access to only SAML connections, refer to Manage cloud users . Service provider-initiated SSO {#service-provider-initiated-sso} We only utilize service provider-initiated SSO. This means users go to https://console.clickhouse.cloud and enter their email address to be redirected to the IdP for authentication. Users already authenticated via your IdP can use the direct link to automatically log in to your organization without entering their email address at the login page. Multi-org SSO {#multi-org-sso} ClickHouse Cloud supports multi-organization SSO by providing a separate connection for each organization. Use the direct link ( https://console.clickhouse.cloud/?connection={organizationid} ) to log in to each respective organization. Be sure to log out of one organization before logging into another. Additional information {#additional-information} Security is our top priority when it comes to authentication. For this reason, we made a few decisions when implementing SSO that we need you to know.
{"source_file": "04_saml-sso-setup.md"}
[ -0.1526101976633072, 0.0031800277065485716, -0.023335564881563187, -0.04695168137550354, -0.033731408417224884, 0.03771556168794632, 0.06533513218164444, -0.0052780150435864925, 0.007373554166406393, -0.005833454430103302, 0.05751211568713188, -0.02275744453072548, 0.1003187745809555, 0.02...
54583d1c-9ec0-404b-827f-f1fa00c33bb5
Security is our top priority when it comes to authentication. For this reason, we made a few decisions when implementing SSO that we need you to know. We only process service provider-initiated authentication flows. Users must navigate to https://console.clickhouse.cloud and enter an email address to be redirected to your identity provider. Instructions to add a bookmark application or shortcut are provided for your convenience so your users don't need to remember the URL. We do not automatically link SSO and non-SSO accounts. You may see multiple accounts for your users in your ClickHouse user list even if they are using the same email address. Troubleshooting Common Issues {#troubleshooting-common-issues} | Error | Cause | Solution | |:------|:------|:---------| | There could be a misconfiguration in the system or a service outage | Identity provider initiated login | To resolve this error try using the direct link https://console.clickhouse.cloud/?connection={organizationid} . Follow the instructions for your identity provider above to make this the default login method for your users | | You are directed to your identity provider, then back to the login page | The identity provider does not have the email attribute mapping | Follow the instructions for your identity provider above to configure the user email attribute and log in again | | User is not assigned to this application | The user has not been assigned to the ClickHouse application in the identity provider | Assign the user to the application in the identity provider and log in again | | You have multiple ClickHouse organizations integrated with SAML SSO and you are always logged into the same organization, regardless of which link or tile you use | You are still logged in to the first organization | Log out, then log in to the other organization | | The URL briefly shows access denied | Your email domain does not match the domain we have configured | Reach out to support for assistance resolving this error |
{"source_file": "04_saml-sso-setup.md"}
[ -0.034402575343847275, -0.039444051682949066, -0.008033677004277706, 0.0071739377453923225, 0.01774965040385723, 0.02519996464252472, 0.05340002104640007, -0.0003371488128323108, 0.022497348487377167, -0.0004978355136699975, 0.0077420868910849094, 0.011208059266209602, 0.029917975887656212, ...
a8a178a0-6750-4279-b32b-5c0a0f94e33d
sidebar_label: 'Manage database users' slug: /cloud/security/manage-database-users title: 'Manage database users' description: 'This page describes how administrators can add database users, manage assignments, and remove database users' doc_type: 'guide' keywords: ['database users', 'access management', 'security', 'permissions', 'user management'] import Image from '@theme/IdealImage'; import user_grant_permissions_options from '@site/static/images/cloud/security/cloud-access-management/user_grant_permissions_options.png'; This guide demonstrates two ways to manage database users, within SQL console and directly within the database. SQL console passwordless authentication {#sql-console-passwordless-authentication} SQL console users are created for each session and authenticated using X.509 certificates that are automatically rotated. The user is removed when the session is terminated. When generating access lists for audits, please navigate to the Settings tab for the service in the console and note the SQL console access in addition to the database users that exist in the database. If custom roles are configured, the user's access is listed in the role ending with the user's username. SQL console users and roles {#sql-console-users-and-roles} Basic SQL console roles can be assigned to users with Service Read Only and Service Admin permissions. For more information, refer to Manage SQL Console Role Assignments . This guide demonstrates how to create a custom role for a SQL console user. To create a custom role for a SQL console user and grant it a general role, run the following commands. The email address must match the user's email address in the console. Create database_developer and grant permissions {#create-role-grant-permissions} Create the database_developer role and grant SHOW , CREATE , ALTER , and DELETE permissions. sql CREATE ROLE OR REPLACE database_developer; GRANT SHOW ON * TO database_developer; GRANT CREATE ON * TO database_developer; GRANT ALTER ON * TO database_developer; GRANT DELETE ON * TO database_developer; Create SQL console user role {#create-sql-console-user-role} Create a role for the SQL console user my.user@domain.com and assign it the database_developer role. sql CREATE ROLE OR REPLACE `sql-console-role:my.user@domain.com`; GRANT database_developer TO `sql-console-role:my.user@domain.com`; The user is assigned the new role when they use SQL console {#use-assigned-new-role} The user will be assigned the role associated with their email address whenever they use SQL console. Database authentication {#database-authentication} Database user ID and password {#database-user-id--password} Use the SHA256_hash method when creating user accounts to secure passwords. ClickHouse database passwords must contain a minimum of 12 characters and meet complexity requirements: upper case characters, lower case characters, numbers and/or special characters.
{"source_file": "04_manage-database-users.md"}
[ 0.024956777691841125, -0.012830287218093872, -0.08898157626390457, 0.05053429678082466, -0.017651183530688286, 0.06412546336650848, 0.11026682704687119, -0.018761886283755302, -0.013021901249885559, 0.08116471022367477, 0.034017663449048996, 0.038184754550457, 0.0990862175822258, 0.0079693...
862211b7-1da0-49d1-bf22-e22eeed21b38
:::tip Generate passwords securely Since users with less than administrative privileges cannot set their own password, ask the user to hash their password using a generator such as this one before providing it to the admin to setup the account. ::: sql CREATE USER userName IDENTIFIED WITH sha256_hash BY 'hash'; Database user with secure shell (SSH) authentication {#database-ssh} To set up SSH authentication for a ClickHouse Cloud database user. Use ssh-keygen to create a keypair. Use the public key to create the user. Assign roles and/or permissions to the user. Use the private key to authenticate against the service. For a detailed walkthrough with examples, check out How to connect to ClickHouse Cloud using SSH keys in our Knowledgebase. Database permissions {#database-permissions} Configure the following within the services and databases using the SQL GRANT statement. | Role | Description | |:----------------------|:------------------------------------------------------------------------------| | Default | Full administrative access to services | | Custom | Configure using the SQL GRANT statement | Database roles are additive. This means if a user is a member of two roles, the user has the most access granted to the two roles. They do not lose access by adding roles. Database roles can be granted to other roles, resulting in a hierarchical structure. Roles inherit all permissions of the roles for which it is a member. Database roles are unique per service and may be applied across multiple databases within the same service. The illustration below shows the different ways a user could be granted permissions. Initial settings {#initial-settings} Databases have an account named default that is added automatically and granted the default_role upon service creation. The user that creates the service is presented with the automatically generated, random password that is assigned to the default account when the service is created. The password is not shown after initial setup, but may be changed by any user with Service Admin permissions in the console at a later time. This account or an account with Service Admin privileges within the console may set up additional database users and roles at any time. :::note To change the password assigned to the default account in the console, go to the Services menu on the left, access the service, go to the Settings tab and click the Reset password button. ::: We recommend creating a new user account associated with a person and granting the user the default_role. This is so activities performed by users are identified to their user IDs and the default account is reserved for break-glass type activities.
{"source_file": "04_manage-database-users.md"}
[ -0.012052938342094421, -0.049462925642728806, -0.06994407624006271, -0.01620553806424141, -0.10892140120267868, 0.04657924920320511, 0.11220310628414154, -0.015549910254776478, -0.021385572850704193, 0.039801593869924545, 0.05547868087887764, -0.03269576281309128, 0.11165376007556915, -0.0...
44ca35ba-4aa3-4a9f-b737-193c2cf5e036
sql CREATE USER userID IDENTIFIED WITH sha256_hash by 'hashed_password'; GRANT default_role to userID; Users can use a SHA256 hash generator or code function such as hashlib in Python to convert a 12+ character password with appropriate complexity to a SHA256 string to provide to the system administrator as the password. This ensures the administrator does not see or handle clear text passwords. Database access listings with SQL console users {#database-access-listings-with-sql-console-users} The following process can be used to generate a complete access listing across the SQL console and databases in your organization. Get a list of all database grants {#get-a-list-of-all-database-grants} Run the following queries to get a list of all grants in the database. ```sql SELECT grants.user_name, grants.role_name, users.name AS role_member, grants.access_type, grants.database, grants.table FROM system.grants LEFT OUTER JOIN system.role_grants ON grants.role_name = role_grants.granted_role_name LEFT OUTER JOIN system.users ON role_grants.user_name = users.name UNION ALL SELECT grants.user_name, grants.role_name, role_grants.role_name AS role_member, grants.access_type, grants.database, grants.table FROM system.role_grants LEFT OUTER JOIN system.grants ON role_grants.granted_role_name = grants.role_name WHERE role_grants.user_name is null; ``` Associate grant list to Console users with access to SQL console {#associate-grant-list-to-console-users-with-access-to-sql-console} Associate this list with Console users that have access to SQL console. a. Go to the Console. b. Select the relevant service. c. Select Settings on the left. d. Scroll to the SQL console access section. e. Click the link for the number of users with access to the database There are # users with access to this service. to see the user listing. Warehouse users {#warehouse-users} Warehouse users are shared across services within the same warehouse. For more information, review warehouse access controls .
{"source_file": "04_manage-database-users.md"}
[ 0.050429780036211014, -0.016426870599389076, -0.10852115601301193, 0.019384829327464104, -0.09168685227632523, 0.022885123267769814, 0.08218181133270264, -0.005771721713244915, -0.07850324362516403, -0.010129071772098541, -0.050963159650564194, 0.05127555876970291, 0.08455979079008102, -0....
56d2f1df-73e5-456e-9782-04f15820e10a
sidebar_label: 'Common access management queries' title: 'Common access management queries' slug: /cloud/security/common-access-management-queries description: 'This article shows the basics of defining SQL users and roles and applying those privileges and permissions to databases, tables, rows, and columns.' keywords: ['ClickHouse Cloud', 'access management'] doc_type: 'guide' import CommonUserRolesContent from '@site/docs/_snippets/_users-and-roles-common.md'; Common access management queries :::tip Self-managed If you are working with self-managed ClickHouse please see SQL users and roles . ::: This article shows the basics of defining SQL users and roles and applying those privileges and permissions to databases, tables, rows, and columns. Admin user {#admin-user} ClickHouse Cloud services have an admin user, default , that is created when the service is created. The password is provided at service creation, and it can be reset by ClickHouse Cloud users that have the Admin role. When you add additional SQL users for your ClickHouse Cloud service, they will need a SQL username and password. If you want them to have administrative-level privileges, then assign the new user(s) the role default_role . For example, adding user clickhouse_admin : sql CREATE USER IF NOT EXISTS clickhouse_admin IDENTIFIED WITH sha256_password BY 'P!@ssword42!'; sql GRANT default_role TO clickhouse_admin; :::note When using the SQL Console, your SQL statements will not be run as the default user. Instead, statements will be run as a user named sql-console:${cloud_login_email} , where cloud_login_email is the email of the user currently running the query. These automatically generated SQL Console users have the default role. ::: Passwordless authentication {#passwordless-authentication} There are two roles available for SQL console: sql_console_admin with identical permissions to default_role and sql_console_read_only with read-only permissions. Admin users are assigned the sql_console_admin role by default, so nothing changes for them. However, the sql_console_read_only role allows non-admin users to be granted read-only or full access to any instance. An admin needs to configure this access. The roles can be adjusted using the GRANT or REVOKE commands to better fit instance-specific requirements, and any modifications made to these roles will be persisted. Granular access control {#granular-access-control} This access control functionality can also be configured manually for user-level granularity. Before assigning the new sql_console_* roles to users, SQL console user-specific database roles matching the namespace sql-console-role:<email> should be created. For example: sql CREATE ROLE OR REPLACE sql-console-role:<email>; GRANT <some grants> TO sql-console-role:<email>;
{"source_file": "05_common-access-management-queries.md"}
[ 0.006672120187431574, -0.09010016918182373, -0.08595810830593109, 0.02943495847284794, -0.04554660618305206, 0.0031488353852182627, 0.11118020117282867, -0.09332366287708282, -0.03987432271242142, 0.029137590900063515, 0.0544036440551281, 0.022083092480897903, 0.10712028294801712, -0.04303...
2ee47bb1-34f6-4784-b2d6-62139260372a
sql CREATE ROLE OR REPLACE sql-console-role:<email>; GRANT <some grants> TO sql-console-role:<email>; When a matching role is detected, it will be assigned to the user instead of the boilerplate roles. This introduces more complex access control configurations, such as creating roles like sql_console_sa_role and sql_console_pm_role , and granting them to specific users. For example: sql CREATE ROLE OR REPLACE sql_console_sa_role; GRANT <whatever level of access> TO sql_console_sa_role; CREATE ROLE OR REPLACE sql_console_pm_role; GRANT <whatever level of access> TO sql_console_pm_role; CREATE ROLE OR REPLACE `sql-console-role:christoph@clickhouse.com`; CREATE ROLE OR REPLACE `sql-console-role:jake@clickhouse.com`; CREATE ROLE OR REPLACE `sql-console-role:zach@clickhouse.com`; GRANT sql_console_sa_role to `sql-console-role:christoph@clickhouse.com`; GRANT sql_console_sa_role to `sql-console-role:jake@clickhouse.com`; GRANT sql_console_pm_role to `sql-console-role:zach@clickhouse.com`;
{"source_file": "05_common-access-management-queries.md"}
[ 0.035244766622781754, -0.08191680908203125, -0.04321903735399246, -0.016834691166877747, -0.07744313776493073, 0.04244251176714897, 0.08570937812328339, 0.03736790269613266, 0.002398660173639655, 0.038638707250356674, -0.05912903696298599, -0.06060880795121193, 0.05124518275260925, 0.04849...
84489055-1c4f-4e30-9a9a-4f5d6bbac2b8
sidebar_label: 'Cloud access management' slug: /cloud/security/cloud_access_management title: 'Cloud access management' description: 'Learn more about cloud access management' doc_type: 'landing-page' keywords: ['access management', 'security', 'user management', 'permissions', 'authentication'] Cloud access management This section contains detailed guides for managing access in ClickHouse Cloud | Page | Description | |--------------------------------------------------------|-------------------------------------------------------| | Manage my account | Describes how to manage your own user account, including passwords, MFA and account recovery | | Manage cloud users | An administrator's guide to managing user access in the ClickHouse Cloud console | | Manage SQL console role assignments | An administrator's guide to managing SQL console users | | Manage database users | An administrator's guide to managing database users | | SAML SSO setup | An administrator's guide to configuring and troubleshooting SAML integrations | | Common access management queries | Detailed examples of setting up and verifying database permissions |
{"source_file": "index.md"}
[ -0.011211346834897995, -0.019907912239432335, -0.046582676470279694, 0.021204717457294464, -0.017743827775120735, 0.06955568492412567, 0.09451738744974136, -0.0684523805975914, -0.010881141759455204, 0.07708223909139633, 0.026669492945075035, 0.009401701390743256, 0.04940794035792351, -0.0...
6326ac99-8d9b-4372-a548-ce200c7881ef
sidebar_label: 'Manage my account' slug: /cloud/security/manage-my-account title: 'Manage my account' description: 'This page describes how users can accept invitations, manage MFA settings, and reset passwords' doc_type: 'guide' keywords: ['account management', 'user profile', 'security', 'cloud console', 'settings'] import EnterprisePlanFeatureBadge from '@theme/badges/EnterprisePlanFeatureBadge' Accept an invitation {#accept-invitation} Users may use multiple methods to accept an invitation to join an organization. If this is your first invitation, select the appropriate authentication method for your organization below. If this is not your first organization, either sign in with your existing organization then accept the invitation from the lower left hand side of the page OR accept the invitation from your email and sign in with your existing account. :::note SAML Users Organizations using SAML have a unique login per ClickHouse organization. Use the direct link provided by your administrator to log in. ::: Email and password {#email-and-password} ClickHouse Cloud allows you to authenticate with an email address and password. When using this method the best way to protect your ClickHouse account is to use a strong password. There are many online resources to help you devise a password you can remember. Alternatively, you can use a random password generator and store your password in a password manager for increased security. Passwords must contain a minimum of 12 characters and meet 3 of 4 complexity requirements: upper case characters, lower case characters, numbers and/or special characters. Social single sign-on (SSO) {#social-sso} Use Continue with Google or Continue with Microsoft Account to sign up for services or accept invitations. If your company uses Google Workspace or Microsoft 365, you can leverage your current single sign-on setup within ClickHouse Cloud. To do this, simply sign up using your company email address and invite other users using their company email. The effect is that your users must login using your company's login flows, whether via your identity provider or directly through Google or Microsoft authentication, before they can authenticate into ClickHouse Cloud. SAML single sign-on (SSO) {#saml-sso} Users using SAML SSO are automatically added by their identity provider upon sign in. ClickHouse Cloud users with the Organization Admin role may manage roles assigned to SAML users and enforce SAML as the only authentication method. Manage multi-factor authentication (MFA) {#mfa} Users with email + password or social authentication can further secure their account using multi-factor authentication (MFA). To set up MFA: Log into console.clickhouse.cloud Click your initials in the upper left corner next to the ClickHouse logo Select Profile Select Security on the left Click Set up in the Authenticator app tile
{"source_file": "01_manage-my-account.md"}
[ -0.015897385776042938, -0.01880280300974846, 0.00473054451867938, 0.06484631448984146, 0.016092384234070778, 0.04616968333721161, 0.03041197918355465, -0.09223944693803787, 0.013892950490117073, 0.057781580835580826, 0.03131768852472305, -0.040512774139642715, 0.024077879264950752, 0.02260...
0e2c27c8-a2ac-4a4f-9f10-b294a67d4f41
Click your initials in the upper left corner next to the ClickHouse logo Select Profile Select Security on the left Click Set up in the Authenticator app tile Use an authenticator app such as Authy, 1Password or Google Authenticator to scan the QR code Enter the code to confirm On the next screen, copy the recovery code and store it in a safe place Check the box next to I have safely recorded this code Click Continue Obtain a new recovery code {#obtain-recovery-code} If you previously enrolled in MFA and either did not create or misplaced your recovery code, follow these steps to get a new recovery code: 1. Go to https://console.clickhouse.cloud 2. Sign in with your credentials and MFA 3. Go to your profile in the upper left corner 4. Click Security on the left 5. Click the trash can next to your Authenticator app 6. Click Remove authenticator app 7. Enter your code and click Continue 8. Click Set up in the Authenticator app section 9. Scan the QR code and input the new code 10. Copy your recovery code and store it in a safe place 11. Check the box next to I have safely recorded this code 12. Click Continue Account recovery {#account-recovery} Forgot password {#forgot-password} If you forgot your password, follow these steps for self-service recovery: 1. Go to https://console.clickhouse.cloud 2. Enter your email address and click Continue 3. Click Forgot your password? 4. Click Send password reset link 5. Check your email and click Reset password from the email 6. Enter your new password, confirm the password and click Update password 7. Click Back to sign in 8. Sign in normally with your new password MFA self-service recovery {#mfa-self-serivce-recovery} If you lost your MFA device or deleted your token, follow these steps to recover and create a new token: 1. Go to https://console.clickhouse.cloud 2. Enter your credentials and click Continue 3. On the Multi-factor authentication screen click Cancel 4. Click Recovery code 5. Enter the code and press Continue 6. Copy the new recovery code and store it somewhere safe 7. Click the box next to I have safely recorded this code and click continue 8. Once signed in, go to your profile in the upper left 9. Click on security in the upper left 10. Click the trash can icon next to Authenticator app to remove your old authenticator 11. Click Remove authenticator app 12. When prompted for your Multi-factor authentication, click Cancel 13. Click Recovery code 14. Enter your recovery code (this is the new code generated in step 7) and click Continue 15. Copy the new recovery code and store it somewhere safe - this is a fail safe in case you leave the screen during the removal process 16. Click the box next to I have safely recorded this code and click Continue 17. Follow the process above to set up a new MFA factor Lost MFA and recovery code {#lost-mfa-and-recovery-code}
{"source_file": "01_manage-my-account.md"}
[ -0.10557043552398682, -0.003647072473540902, 0.012036255560815334, -0.035690777003765106, 0.05775466933846474, 0.0889926478266716, -0.011691742576658726, -0.05934691056609154, 0.015636010095477104, 0.04100865498185158, 0.056608203798532486, -0.0525534562766552, 0.047524306923151016, -0.041...
f551edda-6833-43d4-b28c-498a906215c2
Lost MFA and recovery code {#lost-mfa-and-recovery-code} If you lost your MFA device AND recovery code or you lost your MFA device and never obtained a recovery code, follow these steps to request a reset: Submit a ticket : If you are in an organization that has other administrative users, even if you are attempting to access a single user organization, ask a member of your organization assigned the Admin role to log into the organization and submit a support ticket to reset your MFA on your behalf. Once we verify the request is authenticated, we will reset your MFA and notify the Admin. Sign in as usual without MFA and go to your profile settings to enroll a new factor if you wish. Reset via email : If you are the only user in the organization, submit a support case via email (support@clickhouse.com) using the email address associated with your account. Once we verify the request is coming from the correct email, we will reset your MFA AND password. Access your email to access the password reset link. Set up a new password then go to your profile settings to enroll a new factor if you wish.
{"source_file": "01_manage-my-account.md"}
[ -0.035202812403440475, -0.07850717753171921, 0.008529954589903355, 0.05342250317335129, 0.07972303777933121, 0.06272194534540176, -0.02757425419986248, -0.057393431663513184, -0.06480608135461807, -0.0174981988966465, 0.04707206040620804, -0.03426622599363327, 0.012871074490249157, -0.0336...
c3228a9a-32f0-4c8d-82c0-3efd7541c905
sidebar_label: 'Manage cloud users' slug: /cloud/security/manage-cloud-users title: 'Manage cloud users' description: 'This page describes how administrators can add users, manage assignments, and remove users' doc_type: 'guide' keywords: ['cloud users', 'access management', 'security', 'permissions', 'team management'] import Image from '@theme/IdealImage'; import step_1 from '@site/static/images/cloud/guides/sql_console/org_level_access/1_org_settings.png' import step_2 from '@site/static/images/cloud/guides/sql_console/org_level_access/2_org_settings.png' import step_3 from '@site/static/images/cloud/guides/sql_console/org_level_access/3_org_settings.png' import step_4 from '@site/static/images/cloud/guides/sql_console/org_level_access/4_org_settings.png' import step_5 from '@site/static/images/cloud/guides/sql_console/org_level_access/5_org_settings.png' import step_6 from '@site/static/images/cloud/guides/sql_console/org_level_access/6_org_settings.png' import step_7 from '@site/static/images/cloud/guides/sql_console/org_level_access/7_org_settings.png' import EnterprisePlanFeatureBadge from '@theme/badges/EnterprisePlanFeatureBadge' This guide is intended for users with the Organization Admin role in ClickHouse Cloud. Add users to your organization {#add-users} Invite users {#invite-users} Administrators may invite up to three (3) users at a time and assign organization and service level roles at the time of invitation. To invite users: 1. Select the organization name in the lower left corner 2. Click Users and roles 3. Select Invite members in the upper left corner 4. Enter the email address of up to 3 new users 5. Select the organization and service roles that will be assigned to the users 6. Click Send invites Users will receive an email from which they can join the organization. For more information on accepting invitations, see Manage my account . Add users via SAML identity provider {#add-users-via-saml} If your organization is configured for SAML SSO follow these steps to add users to your organization. Add users to your SAML application in your identity provider, the users will not appear in ClickHouse until they have logged in once When the user logs in to ClickHouse Cloud they will automatically be assigned the Member role which may only log in and has no other access Follow the instructions in the Manage user role assignments below to grant permissions Enforcing SAML-only authentication {#enforce-saml} Once you have at least one SAML user in the organization assigned to the Organization Admin role, remove users with other authentication methods from the organization to enforce SAML only authentication for the organization. Manage user role assignments {#manage-role-assignments} Users assigned the Organization Admin role may update permissions for other users at any time. Access organization settings {#access-organization-settings}
{"source_file": "02_manage-cloud-users.md"}
[ -0.02579088881611824, 0.02726413868367672, -0.04263991862535477, 0.06264146417379379, 0.03198447450995445, -0.0032196766696870327, 0.061420317739248276, -0.019855570048093796, -0.07170389592647552, 0.048588212579488754, 0.05355421453714371, 0.015876727178692818, 0.10508201271295547, -0.038...
cab10f12-315a-446d-821d-0ea3a619d765
Users assigned the Organization Admin role may update permissions for other users at any time. Access organization settings {#access-organization-settings} From the services page, select the name of your organization: Access users and roles {#access-users-and-roles} Select the Users and roles menu item from the popup menu. Select the user to update {#select-user-to-update} Select the menu item at the end of the row for the user that you which to modify access for: Select edit {#select-edit} A tab will display on the right hand side of the page: Update permissions {#update-permissions} Select the drop-down menu items to adjust console-wide access permissions and which features a user can access from within the ClickHouse console. Refer to Console roles and permissions for a listing of roles and associated permissions. Select the drop-down menu items to adjust the access scope of the service role of the selected user. When selecting Specific services , you can control the role of the user per service. Save your changes {#save-changes} Save your changes with the Save changes button at the bottom of the tab: Remove a user {#remove-user} :::note Remove SAML users SAML users that have been unassigned from the ClickHouse application in your identity provider are not able to log in to ClickHouse Cloud. The account is not removed from the console and will need to be manually removed. ::: Follow the steps below to remove a user. Select the organization name in the lower left corner Click Users and roles Click the three dots next to the user's name and select Remove Confirm the action by clicking the Remove user button
{"source_file": "02_manage-cloud-users.md"}
[ -0.011961858719587326, -0.021298428997397423, -0.05243785306811333, -0.013010233640670776, -0.03839005157351494, 0.029012979939579964, 0.04171387106180191, -0.06133256480097771, 0.0009820486884564161, 0.05730711668729782, -0.03494514152407646, 0.0417843721807003, -0.03961142525076866, 0.00...
4e6f51fe-d0a6-4c49-b488-5df4a92d11de
slug: /cloud/guides/sql-console/manage-sql-console-role-assignments sidebar_label: 'Manage SQL console role assignments' title: 'Manage SQL console role assignments' description: 'Guide showing how to manage SQL console role assignments' doc_type: 'guide' keywords: ['sql console', 'role assignments', 'access management', 'permissions', 'security'] import Image from '@theme/IdealImage'; import step_1 from '@site/static/images/cloud/guides/sql_console/service_level_access/1_service_settings.png' import step_2 from '@site/static/images/cloud/guides/sql_console/service_level_access/2_service_settings.png' import step_3 from '@site/static/images/cloud/guides/sql_console/service_level_access/3_service_settings.png' import step_4 from '@site/static/images/cloud/guides/sql_console/service_level_access/4_service_settings.png' import step_5 from '@site/static/images/cloud/guides/sql_console/service_level_access/5_service_settings.png' import step_6 from '@site/static/images/cloud/guides/sql_console/service_level_access/6_service_settings.png' import step_7 from '@site/static/images/cloud/guides/sql_console/service_level_access/7_service_settings.png' Configuring SQL console role assignments This guide shows you how to configure SQL console role assignments, which determine console-wide access permissions and the features that a user can access within Cloud console. Access service settings {#access-service-settings} From the services page, click the menu in the top right corner of the service for which you want to adjust SQL console access settings. Select settings from the popup menu. Adjust SQL console access {#adjust-sql-console-access} Under the "Security" section, find the "SQL console access" area: Update the settings for Service Admin {#update-settings-for-service-admin} Select the drop-down menu for Service Admin to change the access control settings for Service Admin roles: You can choose from the following roles: | Role | |---------------| | No access | | Read only | | Full access | Update the settings for Service Read Only {#update-settings-for-service-read-only} Select the drop-down menu for Service Read Only to change the access control settings for Service Read Only roles: You can choose from the following roles: | Role | |---------------| | No access | | Read only | | Full access | Review users with access {#review-users-with-access} An overview of users for the service can be viewed by selecting the user count: A tab will open to the right of the page showing the total number of users and their roles:
{"source_file": "03_manage-sql-console-role-assignments.md"}
[ 0.017535299062728882, -0.03294713422656059, -0.04965084791183472, 0.02123940922319889, 0.023342011496424675, 0.008873207494616508, 0.05669811740517616, 0.05347828567028046, -0.0712660476565361, 0.044161755591630936, 0.04240043833851814, 0.013166808523237705, 0.11418124288320541, 0.00207251...
7232fa7e-505c-4fd2-aaf4-1f66fffa78e2
sidebar_label: 'Setting IP filters' slug: /cloud/security/setting-ip-filters title: 'Setting IP filters' description: 'This page explains how to set IP filters in ClickHouse Cloud to control access to ClickHouse services.' doc_type: 'guide' keywords: ['IP filters', 'IP access list'] import Image from '@theme/IdealImage'; import ip_filtering_after_provisioning from '@site/static/images/cloud/security/ip-filtering-after-provisioning.png'; import ip_filter_add_single_ip from '@site/static/images/cloud/security/ip-filter-add-single-ip.png'; Setting IP filters {#setting-ip-filters} IP access lists filter traffic to ClickHouse services or API keys by specifying which source addresses are permitted to connect. These lists are configurable for each service and each API key. Lists can be configured during service or API key creation, or afterward. :::important If you skip the creation of the IP access list for a ClickHouse Cloud service then no traffic will be permitted to the service. If IP access lists for ClickHouse services are set to Allow from anywhere your service may be periodically moved from an idle to an active state by internet crawlers and scanners that look for public IPs, which may result in nominal unexpected cost. ::: Prepare {#prepare} Before you begin, collect the IP addresses or ranges that should be added to the access list. Take into consideration remote workers, on-call locations, VPNs, etc. The IP access list user interface accepts individual addresses and CIDR notation. Classless Inter-domain Routing (CIDR) notation, allows you to specify IP address ranges smaller than the traditional Class A, B, or C (8, 6, or 24) subnet mask sizes. ARIN and several other organizations provide CIDR calculators if you need one, and if you would like more information on CIDR notation, please see the Classless Inter-domain Routing (CIDR) RFC. Create or modify an IP access list {#create-or-modify-an-ip-access-list} :::note Applicable only to connections outside of PrivateLink IP access lists only apply to connections from the public internet, outside of PrivateLink . If you only want traffic from PrivateLink, set DenyAll in IP Allow list. ::: IP access list for ClickHouse services When you create a ClickHouse service, the default setting for the IP allow list is 'Allow from nowhere.' From your ClickHouse Cloud services list select the service and then select **Settings**. Under the **Security** section, you will find the IP access list. Click on the Add IPs button. A sidebar will appear with options for you to configure: - Allow incoming traffic from anywhere to the service - Allow access from specific locations to the service - Deny all access to the service IP access list for API keys When you create an API key, the default setting for the IP allow list is 'Allow from anywhere.'
{"source_file": "01_setting-ip-filters.md"}
[ -0.021622171625494957, 0.021804068237543106, -0.008646993897855282, -0.04264555126428604, 0.018712885677814484, -0.028430283069610596, 0.08799012005329132, -0.12811800837516785, -0.02639489807188511, 0.00525281298905611, 0.040678929537534714, 0.016328301280736923, 0.03708864003419876, -0.0...
492004f7-9f62-4cdf-aaa7-1afcc56e8b63
IP access list for API keys When you create an API key, the default setting for the IP allow list is 'Allow from anywhere.' From the API key list, click the three dots next to the API key under the **Actions** column and select **Edit**. At the bottom of the screen you will find the IP access list and options to configure: - Allow incoming traffic from anywhere to the service - Allow access from specific locations to the service - Deny all access to the service This screenshot shows an access list which allows traffic from a range of IP addresses, described as "NY Office range": Possible actions {#possible-actions} To add an additional entry you can use + Add new IP This example adds a single IP address, with a description of London server : Delete an existing entry Clicking the cross (x) can deletes an entry Edit an existing entry Directly modifying the entry Switch to allow access from Anywhere This is not recommended, but it is allowed. We recommend that you expose an application built on top of ClickHouse to the public and restrict access to the back-end ClickHouse Cloud service. To apply the changes you made, you must click Save . Verification {#verification} Once you create your filter confirm connectivity to a service from within the range, and confirm that connections from outside the permitted range are denied. A simple curl command can be used to verify: bash title="Attempt rejected from outside the allow list" curl https://<HOSTNAME>.clickhouse.cloud:8443 response curl: (35) error:02FFF036:system library:func(4095):Connection reset by peer or response curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to HOSTNAME.clickhouse.cloud:8443 bash title="Attempt permitted from inside the allow list" curl https://<HOSTNAME>.clickhouse.cloud:8443 response Ok. Limitations {#limitations} Currently, IP access lists support only IPv4
{"source_file": "01_setting-ip-filters.md"}
[ -0.04012071341276169, -0.00810993928462267, 0.008454977534711361, -0.06933960318565369, -0.06127340346574783, 0.03265279158949852, 0.03627049922943115, -0.11579001694917679, -0.024767782539129257, 0.017826024442911148, 0.016000615432858467, 0.0341523140668869, 0.007868417538702488, -0.0254...
8729eab7-1203-4cee-a324-6f6a60970c54
sidebar_label: 'Database audit log' slug: /cloud/security/audit-logging/database-audit-log title: 'Database audit log' description: 'This page describes how users can review the database audit log' doc_type: 'guide' keywords: ['audit logging', 'database logs', 'compliance', 'security', 'monitoring'] Database audit log {#database-audit-log} ClickHouse provides database audit logs by default. This page focuses on security relevant logs. For more information on data recorded by the system, refer to the docs for system tables . :::tip Log retention Information is logged directly to the system tables and are retained for up to 30 days by default. This period can be longer or shorter and is affected by the frequency of merges in the system. Customers may take additional measures to store logs for longer or export logs to a security information and event management (SIEM) system for long term storage. Details below. ::: Security relevant logs {#security-relevant-logs} ClickHouse logs security relevant database events primarily to session and query logs. The system.session_log records successful and failed login attempts, as well as the location of the authentication attempt. This information can be used to identify credential stuffing or brute force attacks against a ClickHouse instance. Sample query showing login failures sql select event_time ,type ,user ,auth_type ,client_address FROM clusterAllReplicas('default',system.session_log) WHERE type='LoginFailure' LIMIT 100 The system.query_log captures query activity executed in a ClickHouse instance. This information can be useful to determine what queries a threat actor executed. Sample query to search for activities of a "compromised_account" user sql SELECT event_time ,address ,initial_user ,initial_address ,forwarded_for ,query FROM clusterAllReplicas('default', system.query_log) WHERE user=’compromised_account’ Retaining log data within services {#reatining-log-data-within-services} Customers needing longer retention or log durability can use materialized views to achieve these objectives. For more information on materialized views, what they are, benefits and how to implement review our materialized views videos and documentation. Exporting logs {#exporting-logs} System logs may be written or exported to a storage location using various formats that are compatible with SIEM systems. For more information, review our table functions docs. The most common methods are: - Write to S3 - Write to GCS - Write to Azure Blob Storage
{"source_file": "02_database-audit-log.md"}
[ 0.03717181459069252, -0.035913120955228806, -0.04356160759925842, 0.03804159164428711, 0.07649941742420197, -0.01817016489803791, 0.11246467381715775, -0.016815073788166046, 0.041695788502693176, 0.05031820386648178, 0.06848639994859695, 0.031206784769892693, 0.05515250191092491, -0.021382...
658c72d6-f9bb-4ddc-a920-3c6321f7b77c
sidebar_label: 'BYOC security playbook' slug: /cloud/security/audit-logging/byoc-security-playbook title: 'BYOC security playbook' description: 'This page illustrates methods customers can use to identify potential security events' doc_type: 'guide' keywords: ['byoc', 'security', 'playbook', 'best practices', 'compliance'] BYOC security playbook {#byoc-security-playbook} ClickHouse operates Bring Your Own Cloud (BYOC) under a security shared responsibility model, which can be downloaded from our Trust Center at https://trust.clickhouse.com. The following information is provided for BYOC customers as examples of how to identify potential security events. Customers should consider this information in the context of their security program to determine if additional detections and alerts may be helpful. Potentially compromised ClickHouse credentials {#compromised-clickhouse-credentials} Refer to the database audit log documentation for queries to detect credential based attacks and queries to investigate malicious activities. Application layer denial of service attack {#application-layer-dos-attack} There are various methods to execute a Denial of Service (DoS) attack. If the attack is focused on crashing the ClickHouse instance through a specific payload, recover the system back to a running state, or reboot the system and restrict access to regain control. Use the following query to review the system.crash_log to get more information about the attack. sql SELECT * FROM clusterAllReplicas('default',system.crash_log) Compromised ClickHouse created AWS roles {#compromised-clickhouse-created-aws-roles} ClickHouse utilizes pre-created roles to enable system functions. This section assumes the customer is using AWS with CloudTrail and has access to the CloudTrail logs. If an incident may be the result of a compromised role, review activities in CloudTrail and CloudWatch related to the ClickHouse IAM roles and actions. Refer to the CloudFormation stack or Terraform module provided as part of setup for a list of IAM roles. Unauthorized access to EKS cluster {#unauthorized-access-eks-cluster} ClickHouse BYOC runs inside EKS. This section assumes the customer is using CloudTrail and CloudWatch in AWS and has access to the logs. If an incident may be the result of a compromised EKS cluster, use the queries below within the EKS CloudWatch logs to identify specific threats. List the number of Kubernetes API calls by username sql fields user.username | stats count(*) as count by user.username Identify whether a user is a ClickHouse engineer sql fields @timestamp,user.extra.sessionName.0, requestURI, verb,userAgent, @message, @logStream, @log | sort @timestamp desc | filter user.username like /clickhouse.com/ | limit 10000 Review user accessing Kubernetes secrets, filter out service roles
{"source_file": "03_byoc-security-playbook.md"}
[ -0.0375317707657814, -0.020074281841516495, -0.1045546680688858, -0.08120857924222946, 0.027018358930945396, 0.06258131563663483, 0.10327885299921036, -0.03600051626563072, 0.086075060069561, 0.05394457280635834, 0.03938233479857445, 0.01957441121339798, 0.04768980294466019, -0.05443640053...
9287e432-ccb2-49c1-9406-3b3124dfa13f
Review user accessing Kubernetes secrets, filter out service roles sql fields @timestamp,user.extra.sessionName.0, requestURI, verb,userAgent, @message, @logStream, @log | sort @timestamp desc | filter requestURI like /secret/ | filter verb="get" | filter ispresent(user.extra.sessionName.0) | filter user.username not like /ClickHouseManagementRole/ | filter user.username not like /data-plane-mgmt/
{"source_file": "03_byoc-security-playbook.md"}
[ 0.027894364669919014, 0.06761922687292099, 0.05062082037329674, -0.022344645112752914, -0.0379064679145813, -0.007974007166922092, 0.11587031185626984, -0.08837639540433884, 0.004342487081885338, 0.007794180419296026, -0.01868516393005848, -0.09224280714988708, -0.010598015040159225, 0.010...
4e1ac3cd-8371-4096-884a-b61502502dcd
sidebar_label: 'Audit logging' slug: /cloud/security/audit_logging title: 'Audit logging' hide_title: true description: 'Table of contents page for the ClickHouse Cloud audit logging section' doc_type: 'landing-page' keywords: ['audit logging', 'compliance', 'security', 'logging', 'monitoring'] Audit logging | Page | Description | |---------------------------------------------------------------------|------------------------------------------------------------------------------------| | Console audit log | Accessing and reviewing audited events in the ClickHouse Cloud console | | Database audit logs | Relevant logs for database activities | | BYOC security playbook | Sample logs and queries customers can use in developing their BYOC security program |
{"source_file": "index.md"}
[ 0.010102024301886559, 0.05964739993214607, 0.002013350836932659, 0.026636188849806786, 0.0971817672252655, 0.007336131762713194, 0.08109117299318314, -0.10550250858068466, 0.026415608823299408, 0.04774774610996246, 0.02936389297246933, -0.045131731778383255, 0.02677220106124878, -0.0291793...
0a273399-caea-47ae-a134-b5924609422c
sidebar_label: 'Console audit log' slug: /cloud/security/audit-logging/console-audit-log title: 'Console audit log' description: 'This page describes how users can review the cloud audit log' doc_type: 'guide' keywords: ['audit log'] import Image from '@theme/IdealImage'; import activity_log_1 from '@site/static/images/cloud/security/activity_log1.png'; import activity_log_2 from '@site/static/images/cloud/security/activity_log2.png'; import activity_log_3 from '@site/static/images/cloud/security/activity_log3.png'; Console audit log {#console-audit-log} User console activities are recorded in the audit log, which is available to users with the Admin or Developer organization role to review and integrate with logging systems. Specific events included in the console audit log are shown in the Access the console log via the user interface {#console-audit-log-ui} Select organization {#select-org} In ClickHouse Cloud, navigate to your organization details. Select audit {#select-audit} Select the Audit tab on the left menu to see what changes have been made to your ClickHouse Cloud organization - including who made the change and when it occurred. The Activity page displays a table containing a list of events logged about your organization. By default, this list is sorted in a reverse-chronological order (most-recent event at the top). Change the order of the table by clicking on the columns headers. Each item of the table contains the following fields: Activity: A text snippet describing the event User: The user that initiated the event IP Address: When applicable, this flied lists the IP Address of the user that initiated the event Time: The timestamp of the event Use the search bar {#use-search-bar} You can use the search bar provided to isolate events based on some criteria like for example service name or IP address. You can also export this information in a CSV format for distribution or analysis in an external tool. Access the console audit log via the API {#console-audit-log-api} Users can use the ClickHouse Cloud API activity endpoint to obtain an export of audit events. Further details can be found in the API reference . Log integrations {#log-integrations} Users can use the API to integrate with a logging platform of their choice. The following have supported out-of-the-box connectors: - ClickHouse Cloud Audit add-on for Splunk
{"source_file": "01_console-audit-log.md"}
[ 0.05149667337536812, 0.015931131318211555, -0.009808112867176533, -0.010753757320344448, 0.1360548585653305, 0.0043218438513576984, 0.08753819018602371, -0.014117795042693615, 0.07965134084224701, 0.0955740287899971, 0.02732415683567524, -0.0038943460676819086, 0.04753003641963005, 0.02870...
09c9296e-6bdb-4dc2-aa94-5d0d9405b3a5
sidebar_label: 'HIPAA onboarding' slug: /cloud/security/compliance/hipaa-onboarding title: 'HIPAA onboarding' description: 'Learn more about how to onboard to HIPAA compliant services' doc_type: 'guide' keywords: ['hipaa', 'compliance', 'healthcare', 'security', 'data protection'] import BetaBadge from '@theme/badges/BetaBadge'; import EnterprisePlanFeatureBadge from '@theme/badges/EnterprisePlanFeatureBadge'; import Image from '@theme/IdealImage'; import hipaa1 from '@site/static/images/cloud/security/compliance/hipaa_1.png'; import hipaa2 from '@site/static/images/cloud/security/compliance/hipaa_2.png'; import hipaa3 from '@site/static/images/cloud/security/compliance/hipaa_3.png'; import hipaa4 from '@site/static/images/cloud/security/compliance/hipaa_4.png'; ClickHouse offers services that are compliant with the Health Information Portability and Accountability Act (HIPAA) of 1996's Security Rule. Customers may process protected health information (PHI) within these services after signing a Business Associate Agreement (BAA) and deploying services to a compliant region. For more information about ClickHouse's compliance program and third party audit report availability, review our compliance overview and Trust Center . Additionally, customers should review our security features page to select and implement appropriate security controls for their workloads. This page describes the process for enabling deployment of HIPAA compliant services in ClickHouse Cloud. Enable and deploy HIPAA compliant services {#enable-hipaa-compliant-services} Sign up for Enterprise services {#sign-up-for-enterprise} Select your organization name in the lower left corner of the console. Click Billing . Review your Plan in the upper left corner. If your Plan is Enterprise , then go to the next section. If not, click Change plan . Select Switch to Enterprise . Enable HIPAA for your organization {#enable-hipaa} Select your organization name in the lower left corner of the console. Click Organization details . Toggle Enable HIPAA on. Follow the instructions on the screen to submit a request to complete a BAA. Once the BAA is completed, HIPAA will be enabled for the organization. Deploy services to HIPAA compliant regions {#deploy-hippa-services} Select New service in the upper left corner of the home screen in the console Change the Region type to HIPAA compliant Enter a name for the service and enter the remaining information For a complete listing of HIPAA compliant cloud providers and services, review our Supported cloud regions page. Migrate existing services {#migrate-to-hipaa} Customers are strongly encouraged to deploy services to compliant environments where required. The process to migrate services from a standard region to a HIPAA compliant region involves restoring from a backup and may require some downtime.
{"source_file": "hipaa-onboarding.md"}
[ -0.028519051149487495, 0.062378011643886566, -0.06510334461927414, -0.0739385113120079, 0.02651171013712883, 0.004736573435366154, 0.05189036950469017, 0.01587505452334881, -0.025653114542365074, 0.010943099856376648, 0.044697355479002, 0.024629320949316025, 0.07901919633150101, -0.0300620...
59f705d8-9597-4a1c-b4f4-81212550fb8d
If migration from standard to HIPAA compliant regions is required, follow these steps to perform self-service migrations: Select the service to be migrated. Click Backups on the left. Select the three dots to the left of the backup to be restored. Select the Region type to restore the backup to a HIPAA compliant region. Once the restoration is complete, run a few queries to verify the schemas and record counts are as expected. Delete the old service. :::info Restrictions Services must remain in the same cloud provider and geographic region. This process migrates the service to the compliant environment in the same cloud provider and region. :::
{"source_file": "hipaa-onboarding.md"}
[ 0.013833455741405487, 0.029981182888150215, 0.019181156530976295, -0.10615597665309906, -0.031161967664957047, 0.009683975949883461, -0.04010777547955513, -0.09196167439222336, 0.02280123345553875, 0.03981627896428108, 0.008901536464691162, 0.01163832750171423, 0.02433682791888714, -0.0213...
7edc42ff-0455-4ac7-b645-1124ccd9273d
sidebar_label: 'PCI onboarding' slug: /cloud/security/compliance/pci-onboarding title: 'PCI onboarding' description: 'Learn more about how to onboard to PCI compliant services' doc_type: 'guide' keywords: ['pci', 'compliance', 'payment security', 'data protection', 'security'] import BetaBadge from '@theme/badges/BetaBadge'; import EnterprisePlanFeatureBadge from '@theme/badges/EnterprisePlanFeatureBadge'; import Image from '@theme/IdealImage'; import pci1 from '@site/static/images/cloud/security/compliance/pci_1.png'; import pci2 from '@site/static/images/cloud/security/compliance/pci_2.png'; import pci3 from '@site/static/images/cloud/security/compliance/pci_3.png'; ClickHouse offers services that are compliant with the Payment Card Industry Data Security Standard (PCI-DSS) and is audited to Level 1 Service Provider requirements. Customers may process primary account numbers (PAN) within these services by enabling this feature and deploying services to a compliant region. For more information about ClickHouse's compliance program and third party audit report availability, review our compliance overview . For a copy of our PCI shared responsibility document, visit our Trust Center . Additionally, customers should review our security features page to select and implement appropriate security controls for their workloads. This page describes the process for enabling deployment of PCI compliant services in ClickHouse Cloud. Sign up for Enterprise services {#sign-up-for-enterprise} Select your organization name in the lower left corner of the console. Click Billing . Review your Plan in the upper left corner. If your Plan is Enterprise , then go to the next section. If not, click Change plan . Select Switch to Enterprise . Enable PCI for your organization {#enable-hipaa} Select your organization name in the lower left corner of the console. Click Organization details . Toggle Enable PCI on. Once enabled, PCI services can be deployed within the organization. Deploy services to PCI compliant regions {#deploy-pci-regions} Select New service in the upper left corner of the home screen in the console Change the Region type to HIPAA compliant Enter a name for the service and enter the remaining information For a complete listing of PCI compliant cloud providers and services, review our Supported cloud regions page. Migrate existing services {#migrate-to-hipaa} Customers are strongly encouraged to deploy services to compliant environments where required. The process to migrate services from a standard region to a PCI compliant region involves restoring from a backup and may require some downtime. If migration from standard to PCI compliant regions is required, follow these steps to perform self-service migrations: Select the service to be migrated. Click Backups on the left.
{"source_file": "pci-onboarding.md"}
[ -0.07686872035264969, 0.022063376381993294, -0.07112378627061844, -0.041825275868177414, 0.037714190781116486, -0.012588311918079853, 0.08154552429914474, -0.0302071925252676, -0.03533407300710678, -0.05639396607875824, 0.07383181154727936, -0.020012227818369865, 0.055272966623306274, 0.01...
8214b897-ce62-4efa-a4dd-1c1cbcdeb8d1
If migration from standard to PCI compliant regions is required, follow these steps to perform self-service migrations: Select the service to be migrated. Click Backups on the left. Select the three dots to the left of the backup to be restored. Select the Region type to restore the backup to a PCI compliant region. Once the restoration is complete, run a few queries to verify the schemas and record counts are as expected. Delete the old service. :::info Restrictions Services must remain in the same cloud provider and geographic region. This process migrates the service to the compliant environment in the same cloud provider and region. :::
{"source_file": "pci-onboarding.md"}
[ 0.028241444379091263, -0.007443610113114119, 0.06067287549376488, -0.07260888814926147, 0.025865113362669945, -0.010381207801401615, -0.043501678854227066, -0.13086619973182678, -0.019278747960925102, -0.005186670925468206, 0.045114416629076004, -0.004618980456143618, 0.008282314985990524, ...
c3bec3aa-fba1-4bfa-a622-75a9bb58fb7f
title: 'GCP private service connect' description: 'This document describes how to connect to ClickHouse Cloud using Google Cloud Platform (GCP) Private Service Connect (PSC), and how to disable access to your ClickHouse Cloud services from addresses other than GCP PSC addresses using ClickHouse Cloud IP access lists.' sidebar_label: 'GCP private service connect' slug: /manage/security/gcp-private-service-connect doc_type: 'guide' keywords: ['Private Service Connect'] import Image from '@theme/IdealImage'; import ScalePlanFeatureBadge from '@theme/badges/ScalePlanFeatureBadge'; import gcp_psc_overview from '@site/static/images/cloud/security/gcp-psc-overview.png'; import gcp_privatelink_pe_create from '@site/static/images/cloud/security/gcp-privatelink-pe-create.png'; import gcp_psc_open from '@site/static/images/cloud/security/gcp-psc-open.png'; import gcp_psc_enable_global_access from '@site/static/images/cloud/security/gcp-psc-enable-global-access.png'; import gcp_psc_copy_connection_id from '@site/static/images/cloud/security/gcp-psc-copy-connection-id.png'; import gcp_psc_create_zone from '@site/static/images/cloud/security/gcp-psc-create-zone.png'; import gcp_psc_zone_type from '@site/static/images/cloud/security/gcp-psc-zone-type.png'; import gcp_psc_dns_record from '@site/static/images/cloud/security/gcp-psc-dns-record.png'; import gcp_pe_remove_private_endpoint from '@site/static/images/cloud/security/gcp-pe-remove-private-endpoint.png'; import gcp_privatelink_pe_filters from '@site/static/images/cloud/security/gcp-privatelink-pe-filters.png'; import gcp_privatelink_pe_dns from '@site/static/images/cloud/security/gcp-privatelink-pe-dns.png'; Private Service Connect {#private-service-connect} Private Service Connect (PSC) is a Google Cloud networking feature that allows consumers to access managed services privately inside their virtual private cloud (VPC) network. Similarly, it allows managed service producers to host these services in their own separate VPC networks and offer a private connection to their consumers. Service producers publish their applications to consumers by creating Private Service Connect services. Service consumers access those Private Service Connect services directly through one of these Private Service Connect types. :::important By default, a ClickHouse service is not available over a Private Service connection even if the PSC connection is approved and established; you need explicitly add the PSC ID to the allow list on an instance level by completing step below. ::: Important considerations for using Private Service Connect Global Access : 1. Regions utilizing Global Access must belong to the same VPC. 1. Global Access must be explicitly enabled at the PSC level (refer to the screenshot below). 1. Ensure that your firewall settings do not block access to PSC from other regions. 1. Be aware that you may incur GCP inter-region data transfer charges.
{"source_file": "03_gcp-private-service-connect.md"}
[ -0.060518041253089905, 0.005113193299621344, -0.006365846376866102, 0.0058302669785916805, -0.022564709186553955, 0.031788937747478485, 0.061075061559677124, -0.05494154617190361, -0.012109707109630108, 0.028051650151610374, 0.054238468408584595, 0.03619598597288132, 0.033376120030879974, ...
d0a1aac7-d5e6-4b33-b9b1-fe578492b714
Cross-region connectivity is not supported. The producer and consumer regions must be the same. However, you can connect from other regions within your VPC by enabling Global Access at the Private Service Connect (PSC) level. Please complete the following to enable GCP PSC : 1. Obtain GCP service attachment for Private Service Connect. 1. Create a service endpoint. 1. Add "Endpoint ID" to ClickHouse Cloud service. 1. Add "Endpoint ID" to ClickHouse service allow list. Attention {#attention} ClickHouse attempts to group your services to reuse the same published PSC endpoint within the GCP region. However, this grouping is not guaranteed, especially if you spread your services across multiple ClickHouse organizations. If you already have PSC configured for other services in your ClickHouse organization, you can often skip most of the steps because of that grouping and proceed directly to the final step: Add "Endpoint ID" to ClickHouse service allow list . Find Terraform examples here . Before you get started {#before-you-get-started} :::note Code examples are provided below to show how to set up Private Service Connect within a ClickHouse Cloud service. In our examples below, we will use: - GCP region: us-central1 - GCP project (customer GCP project): my-gcp-project - GCP private IP address in customer GCP project: 10.128.0.2 - GCP VPC in customer GCP project: default ::: You'll need to retrieve information about your ClickHouse Cloud service. You can do this either via the ClickHouse Cloud console or the ClickHouse API. If you are going to use the ClickHouse API, please set the following environment variables before proceeding: shell REGION=<Your region code using the GCP format, for example: us-central1> PROVIDER=gcp KEY_ID=<Your ClickHouse key ID> KEY_SECRET=<Your ClickHouse key secret> ORG_ID=<Your ClickHouse organization ID> SERVICE_NAME=<Your ClickHouse service name> You can create a new key ClickHouse Cloud API key or use an existing one. Get your ClickHouse INSTANCE_ID by filtering by region, provider and service name: shell INSTANCE_ID=$(curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \ "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services" | \ jq ".result[] | select (.region==\"${REGION:?}\" and .provider==\"${PROVIDER:?}\" and .name==\"${SERVICE_NAME:?}\") | .id " -r) :::note - You can retrieve your Organization ID from ClickHouse console(Organization -> Organization Details). - You can create a new key or use an existing one. ::: Obtain GCP service attachment and DNS name for Private Service Connect {#obtain-gcp-service-attachment-and-dns-name-for-private-service-connect} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console}
{"source_file": "03_gcp-private-service-connect.md"}
[ -0.026089392602443695, -0.09189186245203018, -0.014084937050938606, -0.019663378596305847, 0.010335450060665607, 0.032876480370759964, -0.035982660949230194, -0.13298305869102478, -0.015063551254570484, 0.051090169697999954, -0.01700618676841259, -0.04638532176613808, 0.012548400089144707, ...
241ef75f-25c9-444a-9f2c-e47fa058060b
Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console} In the ClickHouse Cloud console, open the service that you would like to connect via Private Service Connect, then open the Settings menu. Click on the Set up private endpoint button. Make a note of the Service name ( endpointServiceId ) and DNS name ( privateDnsHostname ). You'll use them in the next steps. Option 2: API {#option-2-api} :::note You need at least one instance deployed in the region to perform this step. ::: Obtain GCP service attachment and DNS name for Private Service Connect: bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | jq .result { "endpointServiceId": "projects/.../regions/us-central1/serviceAttachments/production-us-central1-clickhouse-cloud", "privateDnsHostname": "xxxxxxxxxx.us-central1.p.gcp.clickhouse.cloud" } Make a note of the endpointServiceId and privateDnsHostname . You'll use them in the next steps. Create service endpoint {#create-service-endpoint} :::important This section covers ClickHouse-specific details for configuring ClickHouse via GCP PSC(Private Service Connect). GCP-specific steps are provided as a reference to guide you on where to look, but they may change over time without notice from the GCP cloud provider. Please consider GCP configuration based on your specific use case. Please note that ClickHouse is not responsible for configuring the required GCP PSC endpoints, DNS records. For any issues related to GCP configuration tasks, contact GCP Support directly. ::: In this section, we're going to create a service endpoint. Adding a private service connection {#adding-a-private-service-connection} First up, we're going to create a Private Service Connection. Option 1: Using Google Cloud console {#option-1-using-google-cloud-console} In the Google Cloud console, navigate to Network services -> Private Service Connect . Open the Private Service Connect creation dialog by clicking on the Connect Endpoint button. Target : use Published service Target service : use endpointServiceId API or Service name console from Obtain GCP service attachment for Private Service Connect step. Endpoint name : set a name for the PSC Endpoint name . Network/Subnetwork/IP address : Choose the network you want to use for the connection. You will need to create an IP address or use an existing one for the Private Service Connect endpoint. In our example, we pre-created an address with the name your-ip-address and assigned IP address 10.128.0.2 To make the endpoint available from any region, you can enable the Enable global access checkbox. To create the PSC Endpoint, use the ADD ENDPOINT button. The Status column will change from Pending to Accepted once the connection is approved.
{"source_file": "03_gcp-private-service-connect.md"}
[ 0.009010705165565014, -0.04007792845368385, -0.01348545216023922, -0.04591257497668266, -0.07326331734657288, 0.04936520382761955, -0.07204828411340714, -0.05874467268586159, 0.04215797409415245, 0.0642617791891098, 0.0007638672832399607, -0.04695712774991989, -0.007455176208168268, 0.0145...
7d24fbcf-1206-4845-b856-28c94274a569
To create the PSC Endpoint, use the ADD ENDPOINT button. The Status column will change from Pending to Accepted once the connection is approved. Copy PSC Connection ID , we are going to use it as Endpoint ID in the next steps. Option 2: Using Terraform {#option-2-using-terraform} ```json provider "google" { project = "my-gcp-project" region = "us-central1" } variable "region" { type = string default = "us-central1" } variable "subnetwork" { type = string default = "https://www.googleapis.com/compute/v1/projects/my-gcp-project/regions/us-central1/subnetworks/default" } variable "network" { type = string default = "https://www.googleapis.com/compute/v1/projects/my-gcp-project/global/networks/default" } resource "google_compute_address" "psc_endpoint_ip" { address = "10.128.0.2" address_type = "INTERNAL" name = "your-ip-address" purpose = "GCE_ENDPOINT" region = var.region subnetwork = var.subnetwork } resource "google_compute_forwarding_rule" "clickhouse_cloud_psc" { ip_address = google_compute_address.psc_endpoint_ip.self_link name = "ch-cloud-${var.region}" network = var.network region = var.region load_balancing_scheme = "" # service attachment target = "https://www.googleapis.com/compute/v1/$TARGET" # See below in notes } output "psc_connection_id" { value = google_compute_forwarding_rule.clickhouse_cloud_psc.psc_connection_id description = "Add GCP PSC Connection ID to allow list on instance level." } ``` :::note use endpointServiceId API or Service name console from Obtain GCP service attachment for Private Service Connect step ::: Set private DNS name for endpoint {#set-private-dns-name-for-endpoint} :::note There are various ways to configure DNS. Please set up DNS according to your specific use case. ::: You need to point "DNS name", taken from Obtain GCP service attachment for Private Service Connect step, to GCP Private Service Connect endpoint IP address. This ensures that services/components within your VPC/Network can resolve it properly. Add Endpoint ID to ClickHouse Cloud organization {#add-endpoint-id-to-clickhouse-cloud-organization} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-1} To add an endpoint to your organization, proceed to the Add "Endpoint ID" to ClickHouse service allow list step. Adding the PSC Connection ID using the ClickHouse Cloud console to services allow list automatically adds it to organization. To remove an endpoint, open Organization details -> Private Endpoints and click the delete button to remove the endpoint. Option 2: API {#option-2-api-1} Set these environment variables before running any commands: Replace ENDPOINT_ID below by value from Endpoint ID from Adding a Private Service Connection step To add an endpoint, run:
{"source_file": "03_gcp-private-service-connect.md"}
[ -0.06890125572681427, -0.0460188202559948, -0.022852720692753792, 0.012242269702255726, -0.055604904890060425, -0.007165639661252499, 0.007764511276036501, -0.06585658341646194, -0.014837984926998615, 0.12900908291339874, -0.039141468703746796, -0.0637294203042984, 0.02569747529923916, 0.0...
271546d0-5b11-4127-9856-8da7281faa54
Set these environment variables before running any commands: Replace ENDPOINT_ID below by value from Endpoint ID from Adding a Private Service Connection step To add an endpoint, run: bash cat <<EOF | tee pl_config_org.json { "privateEndpoints": { "add": [ { "cloudProvider": "gcp", "id": "${ENDPOINT_ID:?}", "description": "A GCP private endpoint", "region": "${REGION:?}" } ] } } EOF To remove an endpoint, run: bash cat <<EOF | tee pl_config_org.json { "privateEndpoints": { "remove": [ { "cloudProvider": "gcp", "id": "${ENDPOINT_ID:?}", "region": "${REGION:?}" } ] } } EOF Add/remove Private Endpoint to an organization: bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X PATCH -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}" -d @pl_config_org.json Add "Endpoint ID" to ClickHouse service allow list {#add-endpoint-id-to-services-allow-list} You need to add an Endpoint ID to the allow-list for each instance that should be available using Private Service Connect. Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-2} In the ClickHouse Cloud console, open the service that you would like to connect via Private Service Connect, then navigate to Settings . Enter the Endpoint ID retrieved from the Adding a Private Service Connection step. Click Create endpoint . :::note If you want to allow access from an existing Private Service Connect connection, use the existing endpoint drop-down menu. ::: Option 2: API {#option-2-api-2} Set these environment variables before running any commands: Replace ENDPOINT_ID below by value from Endpoint ID from Adding a Private Service Connection step Execute it for each service that should be available using Private Service Connect. To add: bash cat <<EOF | tee pl_config.json { "privateEndpointIds": { "add": [ "${ENDPOINT_ID}" ] } } EOF To remove: bash cat <<EOF | tee pl_config.json { "privateEndpointIds": { "remove": [ "${ENDPOINT_ID}" ] } } EOF bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X PATCH -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" -d @pl_config.json | jq Accessing instance using Private Service Connect {#accessing-instance-using-private-service-connect} Each service with Private Link enabled has a public and private endpoint. In order to connect using Private Link, you need to use a private endpoint which will be privateDnsHostname taken from Obtain GCP service attachment for Private Service Connect . Getting private DNS hostname {#getting-private-dns-hostname} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-3}
{"source_file": "03_gcp-private-service-connect.md"}
[ 0.008767166174948215, 0.04300917312502861, 0.012120791710913181, -0.016284773126244545, -0.00908165518194437, 0.020223209634423256, -0.009848101995885372, -0.045813240110874176, 0.0470150001347065, 0.06613373011350632, 0.00810216274112463, -0.02604416385293007, -0.008955639787018299, 0.027...
e206cd85-8807-4aff-afe5-7fb9952decf2
Getting private DNS hostname {#getting-private-dns-hostname} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-3} In the ClickHouse Cloud console, navigate to Settings . Click on the Set up private endpoint button. In the opened flyout, copy the DNS Name . Option 2: API {#option-2-api-3} bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | jq .result response { ... "privateDnsHostname": "xxxxxxx.<region code>.p.gcp.clickhouse.cloud" } In this example, connection to the xxxxxxx.yy-xxxxN.p.gcp.clickhouse.cloud hostname will be routed to Private Service Connect. Meanwhile, xxxxxxx.yy-xxxxN.gcp.clickhouse.cloud will be routed over the internet. Troubleshooting {#troubleshooting} Test DNS setup {#test-dns-setup} DNS_NAME - Use privateDnsHostname from Obtain GCP service attachment for Private Service Connect step bash nslookup $DNS_NAME response Non-authoritative answer: ... Address: 10.128.0.2 Connection reset by peer {#connection-reset-by-peer} Most likely, the Endpoint ID was not added to the service allow-list. Revisit the Add endpoint ID to services allow-list step . Test connectivity {#test-connectivity} If you have problems with connecting using PSC link, check your connectivity using openssl . Make sure the Private Service Connect endpoint status is Accepted : OpenSSL should be able to connect (see CONNECTED in the output). errno=104 is expected. DNS_NAME - Use privateDnsHostname from Obtain GCP service attachment for Private Service Connect step bash openssl s_client -connect ${DNS_NAME}:9440 ```response highlight-next-line CONNECTED(00000003) write:errno=104 no peer certificate available No client certificate CA names sent SSL handshake has read 0 bytes and written 335 bytes Verification: OK New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE No ALPN negotiated Early data was not sent Verify return code: 0 (ok) ``` Checking endpoint filters {#checking-endpoint-filters} REST API {#rest-api} bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X GET -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" | jq .result.privateEndpointIds [ "102600141743718403" ] Connecting to a remote database {#connecting-to-a-remote-database} Let's say you are trying to use the MySQL or PostgreSQL table functions in ClickHouse Cloud and connect to your database hosted in GCP. GCP PSC cannot be used to enable this connection securely. PSC is a one-way, unidirectional connection. It allows your internal network or GCP VPC to connect securely to ClickHouse Cloud, but it does not allow ClickHouse Cloud to connect to your internal network. According to the GCP Private Service Connect documentation :
{"source_file": "03_gcp-private-service-connect.md"}
[ 0.003156336024403572, 0.030973924323916435, -0.03197702392935753, -0.016777608543634415, -0.03974098712205887, -0.013481473550200462, -0.03399237245321274, -0.07057406008243561, 0.08448218554258347, 0.02831408381462097, -0.007966602221131325, -0.01872427947819233, -0.04549127444624901, -0....
22c5a010-7ece-457f-bac9-9cc8da5e59dc
According to the GCP Private Service Connect documentation : Service-oriented design: Producer services are published through load balancers that expose a single IP address to the consumer VPC network. Consumer traffic that accesses producer services is unidirectional and can only access the service IP address, rather than having access to an entire peered VPC network. To do this, configure your GCP VPC firewall rules to allow connections from ClickHouse Cloud to your internal/private database service. Check the default egress IP addresses for ClickHouse Cloud regions , along with the available static IP addresses . More information {#more-information} For more detailed information, visit cloud.google.com/vpc/docs/configure-private-service-connect-services .
{"source_file": "03_gcp-private-service-connect.md"}
[ -0.0390063039958477, -0.09094113856554031, 0.02079661563038826, -0.02185690402984619, -0.06472685188055038, 0.04132918640971184, 0.03610078990459442, -0.11167259514331818, -0.000060185539041412994, 0.039163585752248764, 0.029946254566311836, 0.0073327356949448586, 0.024971209466457367, -0....
b73e275e-32a9-4183-af53-eee1c82d36b4
title: 'Azure Private Link' sidebar_label: 'Azure Private Link' slug: /cloud/security/azure-privatelink description: 'How to set up Azure Private Link' keywords: ['azure', 'private link', 'privatelink'] doc_type: 'guide' import Image from '@theme/IdealImage'; import ScalePlanFeatureBadge from '@theme/badges/ScalePlanFeatureBadge'; import azure_pe from '@site/static/images/cloud/security/azure-pe.png'; import azure_privatelink_pe_create from '@site/static/images/cloud/security/azure-privatelink-pe-create.png'; import azure_private_link_center from '@site/static/images/cloud/security/azure-private-link-center.png'; import azure_pe_create_basic from '@site/static/images/cloud/security/azure-pe-create-basic.png'; import azure_pe_resource from '@site/static/images/cloud/security/azure-pe-resource.png'; import azure_pe_create_vnet from '@site/static/images/cloud/security/azure-pe-create-vnet.png'; import azure_pe_create_dns from '@site/static/images/cloud/security/azure-pe-create-dns.png'; import azure_pe_create_tags from '@site/static/images/cloud/security/azure-pe-create-tags.png'; import azure_pe_create_review from '@site/static/images/cloud/security/azure-pe-create-review.png'; import azure_pe_ip from '@site/static/images/cloud/security/azure-pe-ip.png'; import azure_pe_view from '@site/static/images/cloud/security/azure-pe-view.png'; import azure_pe_resource_id from '@site/static/images/cloud/security/azure-pe-resource-id.png'; import azure_pe_resource_guid from '@site/static/images/cloud/security/azure-pe-resource-guid.png'; import azure_pl_dns_wildcard from '@site/static/images/cloud/security/azure-pl-dns-wildcard.png'; import azure_pe_remove_private_endpoint from '@site/static/images/cloud/security/azure-pe-remove-private-endpoint.png'; import azure_privatelink_pe_filter from '@site/static/images/cloud/security/azure-privatelink-pe-filter.png'; import azure_privatelink_pe_dns from '@site/static/images/cloud/security/azure-privatelink-pe-dns.png'; Azure Private Link This guide shows how to use Azure Private Link to provide private connectivity via a virtual network between Azure (including customer-owned and Microsoft Partner services) and ClickHouse Cloud. Azure Private Link simplifies the network architecture and secures the connection between endpoints in Azure by eliminating data exposure to the public internet. Azure supports cross-region connectivity via Private Link. This enables you to establish connections between VNets located in different regions where you have ClickHouse services deployed. :::note Additional charges may be applied to inter-region traffic. Please check the latest Azure documentation. ::: Please complete the following steps to enable Azure Private Link: Obtain Azure connection alias for Private Link Create a Private Endpoint in Azure Add the Private Endpoint Resource ID to your ClickHouse Cloud organization Add the Private Endpoint Resource ID to your service(s) allow list
{"source_file": "04_azure-privatelink.md"}
[ -0.026931844651699066, 0.06198356673121452, -0.041558727622032166, 0.08456425368785858, 0.061001937836408615, 0.05865752696990967, 0.03713570907711983, 0.01372468750923872, -0.021049221977591515, 0.11689982563257217, 0.12097833305597305, -0.005264651495963335, 0.1136036142706871, 0.0393862...
bb3bca72-a553-424c-96e0-0a5f5882c985
Create a Private Endpoint in Azure Add the Private Endpoint Resource ID to your ClickHouse Cloud organization Add the Private Endpoint Resource ID to your service(s) allow list Access your ClickHouse Cloud service using Private Link :::note ClickHouse Cloud Azure PrivateLink has switched from using resourceGUID to Resource ID filters. You can still use resourceGUID, as it is backward-compatible, but we recommend switching to Resource ID filters. To migrate, simply create a new endpoint using the Resource ID, attach it to the service, and remove the old resourceGUID-based one. ::: Attention {#attention} ClickHouse attempts to group your services to reuse the same published Private Link service within the Azure region. However, this grouping is not guaranteed, especially if you spread your services across multiple ClickHouse organizations. If you already have Private Link configured for other services in your ClickHouse organization, you can often skip most of the steps because of that grouping and proceed directly to the final step: Add the Private Endpoint Resource ID to your service(s) allow list . Find Terraform examples at the ClickHouse Terraform Provider repository . Obtain Azure connection alias for Private Link {#obtain-azure-connection-alias-for-private-link} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console} In the ClickHouse Cloud console, open the service that you would like to connect via PrivateLink, then open the Settings menu. Click on the Set up private endpoint button. Make a note of the Service name and DNS name which will be used for setting up Private Link. Make a note of the Service name and DNS name , they will be needed in the next steps. Option 2: API {#option-2-api} Before you get started, you'll need a ClickHouse Cloud API key. You can create a new key or use an existing one. Once you have your API key, set the following environment variables before running any commands: bash REGION=<region code, use Azure format, for example: westus3> PROVIDER=azure KEY_ID=<Key ID> KEY_SECRET=<Key secret> ORG_ID=<set ClickHouse organization ID> SERVICE_NAME=<Your ClickHouse service name> Get your ClickHouse INSTANCE_ID by filtering by region, provider and service name: shell INSTANCE_ID=$(curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \ "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services" | \ jq ".result[] | select (.region==\"${REGION:?}\" and .provider==\"${PROVIDER:?}\" and .name==\"${SERVICE_NAME:?}\") | .id " -r) Obtain your Azure connection alias and Private DNS hostname for Private Link:
{"source_file": "04_azure-privatelink.md"}
[ -0.004650741349905729, -0.03140442073345184, -0.01668982394039631, 0.02941017411649227, 0.02047475427389145, 0.055953122675418854, 0.030000915750861168, -0.1535647064447403, 0.019127000123262405, 0.10405411571264267, 0.021747777238488197, -0.0011274080025032163, 0.059677157551050186, 0.067...
434075b9-30dd-4111-939c-38293fd6f929
Obtain your Azure connection alias and Private DNS hostname for Private Link: bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | jq .result { "endpointServiceId": "production-westus3-0-0.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.westus3.azure.privatelinkservice", "privateDnsHostname": "xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud" } Make a note of the endpointServiceId . You'll use it in the next step. Create a private endpoint in Azure {#create-private-endpoint-in-azure} :::important This section covers ClickHouse-specific details for configuring ClickHouse via Azure Private Link. Azure-specific steps are provided as a reference to guide you on where to look, but they may change over time without notice from the Azure cloud provider. Please consider Azure configuration based on your specific use case. Please note that ClickHouse is not responsible for configuring the required Azure private endpoints and DNS records. For any issues related to Azure configuration tasks, contact Azure Support directly. ::: In this section, we're going to create a Private Endpoint in Azure. You can use either the Azure Portal or Terraform. Option 1: Using Azure Portal to create a private endpoint in Azure {#option-1-using-azure-portal-to-create-a-private-endpoint-in-azure} In the Azure Portal, open Private Link Center → Private Endpoints . Open the Private Endpoint creation dialog by clicking on the Create button. In the following screen, specify the following options: Subscription / Resource Group : Please choose the Azure subscription and resource group for the Private Endpoint. Name : Set a name for the Private Endpoint . Region : Choose a region where the deployed VNet that will be connected to ClickHouse Cloud via Private Link. After you have completed the above steps, click the Next: Resource button. Select the option Connect to an Azure resource by resource ID or alias . For the Resource ID or alias , use the endpointServiceId you have obtained from the Obtain Azure connection alias for Private Link step. Click Next: Virtual Network button. Virtual network : Choose the VNet you want to connect to ClickHouse Cloud using Private Link Subnet : Choose the subnet where Private Endpoint will be created Optional: Application security group : You can attach ASG to Private Endpoint and use it in Network Security Groups to filter network traffic to/from Private Endpoint. Click Next: DNS button. Click the Next: Tags button. Optionally, you can attach tags to your Private Endpoint. Click the Next: Review + create button. Finally, click the Create button.
{"source_file": "04_azure-privatelink.md"}
[ -0.015427583828568459, 0.003316943533718586, -0.056259457021951675, 0.012938406318426132, -0.05530311167240143, 0.025943869724869728, 0.0036361138336360455, -0.09919971972703934, 0.058209169656038284, 0.09684813022613525, 0.033682238310575485, -0.052639227360486984, 0.05457650125026703, 0....
c660396b-4911-4a9e-b17b-17866e6f4999
Click the Next: Tags button. Optionally, you can attach tags to your Private Endpoint. Click the Next: Review + create button. Finally, click the Create button. The Connection status of the created Private Endpoint will be in Pending state. It will change to Approved state once you add this Private Endpoint to the service allow list. Open the network interface associated with Private Endpoint and copy the Private IPv4 address (10.0.0.4 in this example), you will need this information in the next steps. Option 2: Using Terraform to create a private endpoint in Azure {#option-2-using-terraform-to-create-a-private-endpoint-in-azure} Use the template below to use Terraform to create a Private Endpoint: ```json resource "azurerm_private_endpoint" "example_clickhouse_cloud" { name = var.pe_name location = var.pe_location resource_group_name = var.pe_resource_group_name subnet_id = var.pe_subnet_id private_service_connection { name = "test-pl" private_connection_resource_alias = " " is_manual_connection = true } } ``` Obtaining the Private Endpoint Resource ID {#obtaining-private-endpoint-resourceid} In order to use Private Link, you need to add the Private Endpoint connection Resource ID to your service allow list. The Private Endpoint Resource ID is exposed in the Azure Portal. Open the Private Endpoint created in the previous step and click JSON View : Under properties, find id field and copy this value: Preferred method: Using Resource ID Legacy method: Using resourceGUID You can still use the resourceGUID for backward compatibility. Find the resourceGuid field and copy this value: Setting up DNS for Private Link {#setting-up-dns-for-private-link} You will need to create a Private DNS zone ( ${location_code}.privatelink.azure.clickhouse.cloud ) and attach it to your VNet to access resources via Private Link. Create Private DNS zone {#create-private-dns-zone} Option 1: Using Azure portal Please follow this guide to create an Azure private DNS zone using the Azure Portal . Option 2: Using Terraform Use the following Terraform template to create a Private DNS zone: json resource "azurerm_private_dns_zone" "clickhouse_cloud_private_link_zone" { name = "${var.location}.privatelink.azure.clickhouse.cloud" resource_group_name = var.resource_group_name } Create a wildcard DNS record {#create-a-wildcard-dns-record} Create a wildcard record and point to your Private Endpoint: Option 1: Using Azure Portal Open the MyAzureResourceGroup resource group and select the ${region_code}.privatelink.azure.clickhouse.cloud private zone. Select + Record set. For Name, type * . For IP Address, type the IP address you see for Private Endpoint. Select OK . Option 2: Using Terraform
{"source_file": "04_azure-privatelink.md"}
[ 0.012565746903419495, 0.022292183712124825, -0.041083741933107376, 0.010627214796841145, -0.003932267427444458, 0.05293475463986397, 0.00762349646538496, -0.06372810900211334, 0.019608762115240097, 0.12983494997024536, 0.009315920993685722, -0.07028388231992722, 0.06293760985136032, 0.0666...
2c4688ed-908d-468b-8bee-b95a5864150b
Select + Record set. For Name, type * . For IP Address, type the IP address you see for Private Endpoint. Select OK . Option 2: Using Terraform Use the following Terraform template to create a wildcard DNS record: json resource "azurerm_private_dns_a_record" "example" { name = "*" zone_name = var.zone_name resource_group_name = var.resource_group_name ttl = 300 records = ["10.0.0.4"] } Create a virtual network link {#create-a-virtual-network-link} To link the private DNS zone to a virtual network, you'll need to create a virtual network link. Option 1: Using Azure Portal Please follow this guide to link the virtual network to your private DNS zone . Option 2: Using Terraform :::note There are various ways to configure DNS. Please set up DNS according to your specific use case. ::: You need to point "DNS name", taken from Obtain Azure connection alias for Private Link step, to Private Endpoint IP address. This ensures that services/components within your VPC/Network can resolve it properly. Verify DNS setup {#verify-dns-setup} xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud domain should be pointed to the Private Endpoint IP. (10.0.0.4 in this example). ```bash nslookup xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud. Server: 127.0.0.53 Address: 127.0.0.53#53 Non-authoritative answer: Name: xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud Address: 10.0.0.4 ``` Add the Private Endpoint Resource ID to your ClickHouse Cloud organization {#add-the-private-endpoint-id-to-your-clickhouse-cloud-organization} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-1} To add an endpoint to the organization, proceed to the Add the Private Endpoint Resource ID to your service(s) allow list step. Adding the Private Endpoint Resource ID using the ClickHouse Cloud console to the services allow list automatically adds it to organization. To remove an endpoint, open Organization details -> Private Endpoints and click the delete button to remove the endpoint. Option 2: API {#option-2-api-1} Set the following environment variables before running any commands: bash PROVIDER=azure KEY_ID=<Key ID> KEY_SECRET=<Key secret> ORG_ID=<set ClickHouse organization ID> ENDPOINT_ID=<Private Endpoint Resource ID> REGION=<region code, use Azure format> Set the ENDPOINT_ID environment variable using data from the Obtaining the Private Endpoint Resource ID step. Run the following command to add the Private Endpoint: bash cat <<EOF | tee pl_config_org.json { "privateEndpoints": { "add": [ { "cloudProvider": "azure", "id": "${ENDPOINT_ID:?}", "description": "Azure private endpoint", "region": "${REGION:?}" } ] } } EOF You can also run the following command to remove a Private Endpoint:
{"source_file": "04_azure-privatelink.md"}
[ -0.004903440363705158, 0.010704521089792252, -0.023486677557229996, 0.029635325074195862, -0.05250658839941025, 0.07545588910579681, 0.01617632992565632, -0.060382742434740067, 0.03458140045404434, 0.11829473823308945, -0.03261354938149452, -0.06259305775165558, 0.06669901311397552, 0.0120...
f666173e-9b1c-44c0-8fe0-e7a9b9831017
You can also run the following command to remove a Private Endpoint: bash cat <<EOF | tee pl_config_org.json { "privateEndpoints": { "remove": [ { "cloudProvider": "azure", "id": "${ENDPOINT_ID:?}", "region": "${REGION:?}" } ] } } EOF After adding or removing a Private Endpoint, run the following command to apply it to your organization: bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X PATCH -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}" -d @pl_config_org.json Add the Private Endpoint Resource ID to your service(s) allow list {#add-private-endpoint-id-to-services-allow-list} By default, a ClickHouse Cloud service is not available over a Private Link connection even if the Private Link connection is approved and established. You need to explicitly add the Private Endpoint Resource ID for each service that should be available using Private Link. Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-2} In the ClickHouse Cloud console, open the service that you would like to connect via PrivateLink then navigate to Settings . Enter the Resource ID obtained from the previous step. :::note If you want to allow access from an existing PrivateLink connection, use the existing endpoint drop-down menu. ::: Option 2: API {#option-2-api-2} Set these environment variables before running any commands: bash PROVIDER=azure KEY_ID=<Key ID> KEY_SECRET=<Key secret> ORG_ID=<set ClickHouse organization ID> ENDPOINT_ID=<Private Endpoint Resource ID> INSTANCE_ID=<Instance ID> Execute it for each service that should be available using Private Link. Run the following command to add the Private Endpoint to the services allow list: bash cat <<EOF | tee pl_config.json { "privateEndpointIds": { "add": [ "${ENDPOINT_ID:?}" ] } } EOF You can also run the following command to remove a Private Endpoint from the services allow list: bash cat <<EOF | tee pl_config.json { "privateEndpointIds": { "remove": [ "${ENDPOINT_ID:?}" ] } } EOF After adding or removing a Private Endpoint to the services allow list, run the following command to apply it to your organization: bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X PATCH -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" -d @pl_config.json | jq Access your ClickHouse Cloud service using Private Link {#access-your-clickhouse-cloud-service-using-private-link} Each service with Private Link enabled has a public and private endpoint. In order to connect using Private Link, you need to use a private endpoint which will be privateDnsHostname API or DNS name console taken from Obtain Azure connection alias for Private Link . Obtaining the private DNS hostname {#obtaining-the-private-dns-hostname}
{"source_file": "04_azure-privatelink.md"}
[ -0.009048866108059883, 0.04733551666140556, -0.02254641056060791, -0.0016001067124307156, -0.0026699574664235115, 0.03729451820254326, -0.015158528462052345, -0.127370223402977, 0.08168596774339676, 0.0984683707356453, 0.03908494859933853, 0.004655227065086365, 0.033282507210969925, 0.0261...
26eae042-8ee3-4489-91d6-ed0f124062d7
Obtaining the private DNS hostname {#obtaining-the-private-dns-hostname} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-3} In the ClickHouse Cloud console, navigate to Settings . Click on the Set up private endpoint button. In the opened flyout, copy the DNS Name . Option 2: API {#option-2-api-3} Set the following environment variables before running any commands: bash KEY_ID=<Key ID> KEY_SECRET=<Key secret> ORG_ID=<set ClickHouse organization ID> INSTANCE_ID=<Instance ID> Run the following command: bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | jq .result You should receive a response similar to the following: response { ... "privateDnsHostname": "xxxxxxx.<region code>.privatelink.azure.clickhouse.cloud" } In this example, connection to the xxxxxxx.region_code.privatelink.azure.clickhouse.cloud hostname will be routed to Private Link. Meanwhile, xxxxxxx.region_code.azure.clickhouse.cloud will be routed over the internet. Use the privateDnsHostname to connect to your ClickHouse Cloud service using Private Link. Troubleshooting {#troubleshooting} Test DNS setup {#test-dns-setup} Run the following command: bash nslookup <dns name> where "dns name" is the privateDnsHostname API or DNS name console from Obtain Azure connection alias for Private Link You should receive the following response: response Non-authoritative answer: Name: <dns name> Address: 10.0.0.4 Connection reset by peer {#connection-reset-by-peer} Most likely, the Private Endpoint Resource ID was not added to the service allow-list. Revisit the Add Private Endpoint Resource ID to your services allow-list step . Private Endpoint is in pending state {#private-endpoint-is-in-pending-state} Most likely, the Private Endpoint Resource ID was not added to the service allow-list. Revisit the Add Private Endpoint Resource ID to your services allow-list step . Test connectivity {#test-connectivity} If you have problems with connecting using Private Link, check your connectivity using openssl . Make sure the Private Link endpoint status is Accepted . OpenSSL should be able to connect (see CONNECTED in the output). errno=104 is expected. bash openssl s_client -connect abcd.westus3.privatelink.azure.clickhouse.cloud:9440 ```response highlight-next-line CONNECTED(00000003) write:errno=104 no peer certificate available No client certificate CA names sent SSL handshake has read 0 bytes and written 335 bytes Verification: OK New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE No ALPN negotiated Early data was not sent Verify return code: 0 (ok) ``` Checking private endpoint filters {#checking-private-endpoint-filters} Set the following environment variables before running any commands:
{"source_file": "04_azure-privatelink.md"}
[ 0.011967360973358154, 0.026852797716856003, -0.026418892666697502, -0.010282507166266441, -0.022985680028796196, -0.008747006766498089, -0.052190426737070084, -0.08095495402812958, 0.08124712854623795, 0.0363176129758358, -0.02108573168516159, -0.040737368166446686, -0.053913190960884094, ...
59b63b18-f2c2-4b5c-8d4d-f7564f5ad4ab
Checking private endpoint filters {#checking-private-endpoint-filters} Set the following environment variables before running any commands: bash KEY_ID=<Key ID> KEY_SECRET=<Key secret> ORG_ID=<please set ClickHouse organization ID> INSTANCE_ID=<Instance ID> Run the following command to check Private Endpoint filters: bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X GET -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" | jq .result.privateEndpointIds More information {#more-information} For more information about Azure Private Link, please visit azure.microsoft.com/en-us/products/private-link .
{"source_file": "04_azure-privatelink.md"}
[ 0.04525483772158623, 0.04524124041199684, -0.05186644196510315, 0.010731026530265808, 0.01128141488879919, 0.011724754236638546, 0.012647013179957867, -0.11601525545120239, 0.07279219478368759, 0.06600039452314377, 0.014566201716661453, -0.06169211119413376, 0.0017869406146928668, 0.036798...
f0532680-7c25-4281-81bc-4f11cd41836f
slug: /cloud/security/connectivity/private-networking title: 'Private networking' hide_title: true description: 'Table of contents page for the ClickHouse Cloud private networking section' doc_type: 'landing-page' keywords: ['private networking', 'network security', 'vpc', 'connectivity', 'cloud features'] Private networking ClickHouse Cloud provides the ability to connect your services to your cloud virtual network. Refer to the guides below for set up steps for your provider: AWS private Link GCP private service connect Azure private link
{"source_file": "index.md"}
[ -0.008541354909539223, -0.040691010653972626, -0.005937764886766672, -0.00341674592345953, -0.016172491014003754, 0.11455545574426651, 0.02528087981045246, -0.07513529807329178, 0.007136449683457613, 0.08151532709598541, 0.08385097980499268, 0.02271338365972042, -0.0013469335390254855, -0....
b340a08b-aa65-46de-bb7d-85db8050322d
title: 'AWS PrivateLink' description: 'This document describes how to connect to ClickHouse Cloud using AWS PrivateLink.' slug: /manage/security/aws-privatelink keywords: ['PrivateLink'] doc_type: 'guide' import Image from '@theme/IdealImage'; import ScalePlanFeatureBadge from '@theme/badges/ScalePlanFeatureBadge'; import aws_private_link_pecreate from '@site/static/images/cloud/security/aws-privatelink-pe-create.png'; import aws_private_link_endpoint_settings from '@site/static/images/cloud/security/aws-privatelink-endpoint-settings.png'; import aws_private_link_select_vpc from '@site/static/images/cloud/security/aws-privatelink-select-vpc-and-subnets.png'; import aws_private_link_vpc_endpoint_id from '@site/static/images/cloud/security/aws-privatelink-vpc-endpoint-id.png'; import aws_private_link_endpoints_menu from '@site/static/images/cloud/security/aws-privatelink-endpoints-menu.png'; import aws_private_link_modify_dnsname from '@site/static/images/cloud/security/aws-privatelink-modify-dns-name.png'; import pe_remove_private_endpoint from '@site/static/images/cloud/security/pe-remove-private-endpoint.png'; import aws_private_link_pe_filters from '@site/static/images/cloud/security/aws-privatelink-pe-filters.png'; import aws_private_link_ped_nsname from '@site/static/images/cloud/security/aws-privatelink-pe-dns-name.png'; AWS PrivateLink You can use AWS PrivateLink to establish secure connectivity between VPCs, AWS services, your on-premises systems, and ClickHouse Cloud without exposing traffic to the public Internet. This document outlines the steps to connect to ClickHouse Cloud using AWS PrivateLink. To restrict access to your ClickHouse Cloud services exclusively through AWS PrivateLink addresses, follow the instructions provided by ClickHouse Cloud IP Access Lists . :::note ClickHouse Cloud supports cross-region PrivateLink from the following regions: - sa-east-1 - il-central-1 - me-central-1 - me-south-1 - eu-central-2 - eu-north-1 - eu-south-2 - eu-west-3 - eu-south-1 - eu-west-2 - eu-west-1 - eu-central-1 - ca-west-1 - ca-central-1 - ap-northeast-1 - ap-southeast-2 - ap-southeast-1 - ap-northeast-2 - ap-northeast-3 - ap-south-1 - ap-southeast-4 - ap-southeast-3 - ap-south-2 - ap-east-1 - af-south-1 - us-west-2 - us-west-1 - us-east-2 - us-east-1 Pricing considerations: AWS will charge users for cross region data transfer, see pricing here . ::: Please complete the following to enable AWS PrivateLink : 1. Obtain Endpoint "Service name". 1. Create AWS Endpoint. 1. Add "Endpoint ID" to ClickHouse Cloud organization. 1. Add "Endpoint ID" to ClickHouse service allow list. Find Terraform examples here . Important considerations {#considerations}
{"source_file": "02_aws-privatelink.md"}
[ -0.03228222578763962, 0.032612044364213943, -0.06530734896659851, 0.053830720484256744, 0.08299439400434494, 0.04574484005570412, 0.010913873091340065, 0.022985730320215225, 0.011168972589075565, 0.05651365593075752, 0.10435692965984344, -0.023793021216988564, 0.06400007009506226, 0.022245...
da8d107d-074a-4fb7-a5fc-00791cdb6ac3
Find Terraform examples here . Important considerations {#considerations} ClickHouse attempts to group your services to reuse the same published service endpoint within the AWS region. However, this grouping is not guaranteed, especially if you spread your services across multiple ClickHouse organizations. If you already have PrivateLink configured for other services in your ClickHouse organization, you can often skip most of the steps because of that grouping and proceed directly to the final step: Add ClickHouse "Endpoint ID" to ClickHouse service allow list. Prerequisites for this process {#prerequisites} Before you get started you will need: Your AWS account. ClickHouse API key with the necessary permissions to create and manage private endpoints on ClickHouse side. Steps {#steps} Follow these steps to connect your ClickHouse Cloud services via AWS PrivateLink. Obtain endpoint "Service name" {#obtain-endpoint-service-info} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console} In the ClickHouse Cloud console, open the service you want to connect via PrivateLink, then navigate to the Settings menu. Make a note of the Service name and DNS name , then move onto next step . Option 2: API {#option-2-api} First, set the following environment variables before running any commands: shell REGION=<Your region code using the AWS format, for example: us-west-2> PROVIDER=aws KEY_ID=<Your ClickHouse key ID> KEY_SECRET=<Your ClickHouse key secret> ORG_ID=<Your ClickHouse organization ID> SERVICE_NAME=<Your ClickHouse service name> Get your ClickHouse INSTANCE_ID by filtering by region, provider and service name: shell INSTANCE_ID=$(curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \ "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services" | \ jq ".result[] | select (.region==\"${REGION:?}\" and .provider==\"${PROVIDER:?}\" and .name==\"${SERVICE_NAME:?}\") | .id " -r) Obtain endpointServiceId and privateDnsHostname for your PrivateLink configuration: bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \ "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | \ jq .result This command should return something like: result { "endpointServiceId": "com.amazonaws.vpce.us-west-2.vpce-svc-xxxxxxxxxxxxxxxxx", "privateDnsHostname": "xxxxxxxxxx.us-west-2.vpce.aws.clickhouse.cloud" } Make a note of the endpointServiceId and privateDnsHostname move onto next step . Create AWS endpoint {#create-aws-endpoint} :::important This section covers ClickHouse-specific details for configuring ClickHouse via AWS PrivateLink. AWS-specific steps are provided as a reference to guide you on where to look, but they may change over time without notice from the AWS cloud provider. Please consider AWS configuration based on your specific use case.
{"source_file": "02_aws-privatelink.md"}
[ 0.006078951992094517, -0.08167776465415955, -0.007049529813230038, -0.00889564398676157, -0.00044718009303323925, 0.02770080603659153, -0.03444645553827286, -0.09674657881259918, 0.02475420944392681, 0.06181519106030464, -0.008522944524884224, -0.0318262055516243, 0.0384194515645504, 0.015...
8cdb6fa3-987c-4ede-aa1d-293f605adc6a
Please note that ClickHouse is not responsible for configuring the required AWS VPC endpoints, security group rules or DNS records. If you previously enabled "private DNS names" while setting up PrivateLink and are experiencing difficulties configuring new services via PrivateLink, please contact ClickHouse support. For any other issues related to AWS configuration tasks, contact AWS Support directly. ::: Option 1: AWS console {#option-1-aws-console} Open the AWS console and Go to VPC → Endpoints → Create endpoints . Select Endpoint services that use NLBs and GWLBs and use Service name console or endpointServiceId API you got from Obtain Endpoint "Service name" step in Service Name field. Click Verify service : If you want to establish a cross-regional connection via PrivateLink, enable the "Cross region endpoint" checkbox and specify the service region. The service region is where the ClickHouse instance is running. If you get a "Service name could not be verified." error, please contact Customer Support to request adding new regions to the supported regions list. Next, select your VPC and subnets: As an optional step, assign Security groups/Tags: :::note Make sure that ports 443 , 8443 , 9440 , 3306 are allowed in the security group. ::: After creating the VPC Endpoint, make a note of the Endpoint ID value; you'll need it for an upcoming step. Option 2: AWS CloudFormation {#option-2-aws-cloudformation} Next, you need to create a VPC Endpoint using Service name console or endpointServiceId API you got from Obtain Endpoint "Service name" step. Make sure to use correct subnet IDs, security groups, and VPC ID. response Resources: ClickHouseInterfaceEndpoint: Type: 'AWS::EC2::VPCEndpoint' Properties: VpcEndpointType: Interface PrivateDnsEnabled: false ServiceName: <Service name(endpointServiceId), pls see above> VpcId: vpc-vpc_id SubnetIds: - subnet-subnet_id1 - subnet-subnet_id2 - subnet-subnet_id3 SecurityGroupIds: - sg-security_group_id1 - sg-security_group_id2 - sg-security_group_id3 After creating the VPC Endpoint, make a note of the Endpoint ID value; you'll need it for an upcoming step. Option 3: Terraform {#option-3-terraform} service_name below is Service name console or endpointServiceId API you got from Obtain Endpoint "Service name" step
{"source_file": "02_aws-privatelink.md"}
[ -0.045653894543647766, -0.09055919200181961, -0.045116692781448364, 0.00017570416093803942, -0.007621560245752335, 0.0482654944062233, -0.02900180220603943, -0.04603564366698265, -0.0019082266371697187, 0.02904769778251648, 0.016470892354846, -0.05171763524413109, 0.0013134124455973506, 0....
bfa0cbc0-053e-4acf-b24f-22f138c318d6
Option 3: Terraform {#option-3-terraform} service_name below is Service name console or endpointServiceId API you got from Obtain Endpoint "Service name" step json resource "aws_vpc_endpoint" "this" { vpc_id = var.vpc_id service_name = "<pls see comment above>" vpc_endpoint_type = "Interface" security_group_ids = [ Var.security_group_id1,var.security_group_id2, var.security_group_id3, ] subnet_ids = [var.subnet_id1,var.subnet_id2,var.subnet_id3] private_dns_enabled = false service_region = "(Optional) If specified, the VPC endpoint will connect to the service in the provided region. Define it for multi-regional PrivateLink connections." } After creating the VPC Endpoint, make a note of the Endpoint ID value; you'll need it for an upcoming step. Set private DNS name for endpoint {#set-private-dns-name-for-endpoint} :::note There are various ways to configure DNS. Please set up DNS according to your specific use case. ::: You need to point "DNS name", taken from Obtain Endpoint "Service name" step, to AWS Endpoint network interfaces. This ensures that services/components within your VPC/Network can resolve it properly. Add "Endpoint ID" to ClickHouse service allow list {#add-endpoint-id-to-services-allow-list} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-2} To add, please navigate to the ClickHouse Cloud console, open the service that you would like to connect via PrivateLink then navigate to Settings . Click Set up private endpoint to open private endpoints settings. Enter the Endpoint ID obtained from the Create AWS Endpoint step. Click "Create endpoint". :::note If you want to allow access from an existing PrivateLink connection, use the existing endpoint drop-down menu. ::: To remove please navigate to the ClickHouse Cloud console, find the service, then navigate to Settings of the service, find endpoint you would like to remove.Remove it from the list of endpoints. Option 2: API {#option-2-api-2} You need to add an Endpoint ID to the allow-list for each instance that should be available using PrivateLink. Set the ENDPOINT_ID environment variable using data from Create AWS Endpoint step. Set the following environment variables before running any commands: bash REGION=<Your region code using the AWS format, for example: us-west-2> PROVIDER=aws KEY_ID=<Your ClickHouse key ID> KEY_SECRET=<Your ClickHouse key secret> ORG_ID=<Your ClickHouse organization ID> SERVICE_NAME=<Your ClickHouse service name> To add an endpoint ID to an allow-list: ```bash cat <<EOF | tee pl_config.json { "privateEndpointIds": { "add": [ "${ENDPOINT_ID:?}" ] } } EOF curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \ -X PATCH -H "Content-Type: application/json" \ "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" \ -d @pl_config.json | jq ```
{"source_file": "02_aws-privatelink.md"}
[ -0.07491301000118256, -0.002950690919533372, -0.056284379214048386, -0.01631084457039833, -0.013952507637441158, 0.03686925023794174, -0.03153286874294281, -0.04727655649185181, 0.03454088792204857, 0.05371158942580223, -0.061046719551086426, -0.06923838704824448, 0.018762893974781036, 0.0...
cbcb451e-db22-489b-8de1-20201fa6dfb0
To remove an endpoint ID from an allow-list: ```bash cat <<EOF | tee pl_config.json { "privateEndpointIds": { "remove": [ "${ENDPOINT_ID:?}" ] } } EOF curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \ -X PATCH -H "Content-Type: application/json" \ "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" \ -d @pl_config.json | jq ``` Accessing an instance using PrivateLink {#accessing-an-instance-using-privatelink} Each service with Private Link enabled has a public and private endpoint. In order to connect using Private Link, you need to use a private endpoint which will be privateDnsHostname API or DNS Name console taken from Obtain Endpoint "Service name" . Getting private DNS hostname {#getting-private-dns-hostname} Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console-3} In the ClickHouse Cloud console, navigate to Settings . Click on the Set up private endpoint button. In the opened flyout, copy the DNS Name . Option 2: API {#option-2-api-3} Set the following environment variables before running any commands: bash KEY_ID=<Your ClickHouse key ID> KEY_SECRET=<Your ClickHouse key secret> ORG_ID=<Your ClickHouse organization ID> INSTANCE_ID=<Your ClickHouse service name> You can retrieve INSTANCE_ID from step . bash curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \ "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | \ jq .result This should output something like: result { "endpointServiceId": "com.amazonaws.vpce.us-west-2.vpce-svc-xxxxxxxxxxxxxxxxx", "privateDnsHostname": "xxxxxxxxxx.us-west-2.vpce.aws.clickhouse.cloud" } In this example connection via value of privateDnsHostname host name will be routed to PrivateLink, but connection via endpointServiceId hostname will be routed over the Internet. Troubleshooting {#troubleshooting} Multiple PrivateLinks in one region {#multiple-privatelinks-in-one-region} In most cases, you only need to create a single endpoint service for each VPC. This endpoint can route requests from the VPC to multiple ClickHouse Cloud services. Please refer here Connection to private endpoint timed out {#connection-to-private-endpoint-timed-out} Please attach security group to VPC Endpoint. Please verify inbound rules on security group attached to Endpoint and allow ClickHouse ports. Please verify outbound rules on security group attached to VM which is used to connectivity test and allow connections to ClickHouse ports. Private Hostname: Not found address of host {#private-hostname-not-found-address-of-host} Please check your DNS configuration Connection reset by peer {#connection-reset-by-peer} Most likely Endpoint ID was not added to service allow list, please visit step Checking endpoint filters {#checking-endpoint-filters} Set the following environment variables before running any commands:
{"source_file": "02_aws-privatelink.md"}
[ -0.038115859031677246, 0.0910278931260109, 0.004673262592405081, -0.021450860425829887, 0.006242399103939533, 0.012480607256293297, 0.01694389246404171, -0.0764881893992424, 0.025471925735473633, 0.039910878986120224, 0.023334747180342674, 0.014389783143997192, 0.021901583299040794, -0.001...
69a10166-239b-4ee1-b3e5-2b09b1519023
Checking endpoint filters {#checking-endpoint-filters} Set the following environment variables before running any commands: bash KEY_ID=<Key ID> KEY_SECRET=<Key secret> ORG_ID=<please set ClickHouse organization ID> INSTANCE_ID=<Instance ID> You can retrieve INSTANCE_ID from step . shell curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \ -X GET -H "Content-Type: application/json" \ "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" | \ jq .result.privateEndpointIds Connecting to a remote database {#connecting-to-a-remote-database} Let's say you are trying to use MySQL or PostgreSQL table functions in ClickHouse Cloud and connect to your database hosted in an Amazon Web Services (AWS) VPC. AWS PrivateLink cannot be used to enable this connection securely. PrivateLink is a one-way, unidirectional connection. It allows your internal network or Amazon VPC to connect securely to ClickHouse Cloud, but it does not allow ClickHouse Cloud to connect to your internal network. According to the AWS PrivateLink documentation : Use AWS PrivateLink when you have a client/server set up where you want to allow one or more consumer VPCs unidirectional access to a specific service or set of instances in the service provider VPC. Only the clients in the consumer VPC can initiate a connection to the service in the service provider VPC. To do this, configure your AWS Security Groups to allow connections from ClickHouse Cloud to your internal/private database service. Check the default egress IP addresses for ClickHouse Cloud regions , along with the available static IP addresses .
{"source_file": "02_aws-privatelink.md"}
[ 0.015732528641819954, 0.02610502392053604, -0.08499519526958466, 0.020927852019667625, 0.007410655729472637, 0.0005274497088976204, 0.004411124624311924, -0.07224799692630768, 0.06532768160104752, 0.022551340982317924, 0.011147900484502316, -0.048885270953178406, 0.0350768081843853, -0.054...
3fe494d5-a2b1-433d-8c0a-b3b67cf5cffb
title: 'ClickHouse Government' slug: /cloud/infrastructure/clickhouse-government keywords: ['government', 'fips', 'fedramp', 'gov cloud'] description: 'Overview of ClickHouse Government offering' doc_type: 'reference' import Image from '@theme/IdealImage'; import private_gov_architecture from '@site/static/images/cloud/reference/private-gov-architecture.png'; Overview {#overview} ClickHouse Government is a self-deployed package consisting of the same proprietary version of ClickHouse that runs on ClickHouse Cloud and our ClickHouse Operator, configured for separation of compute and storage and hardened to meet the rigorous demands of government agencies and public sector organizations. It is deployed to Kubernetes environments with S3 compatible storage. This package is currently available for AWS, with bare metal deployments coming soon. :::note Note ClickHouse Government is designed for government agencies, public sector organizations, or cloud software companies selling to these agencies and organizations, providing full control and management over their dedicated infrastructure. This option is only available by contacting us . ::: Benefits over open-source {#benefits-over-os} The following features differentiate ClickHouse Government from self-managed open source deployments: Enhanced performance {#enhanced-performance} Native separation of compute and storage Proprietary cloud features such as shared merge tree and warehouse functionality Tested and proven through a variety of use cases and conditions {#tested-proven} Fully tested and validated in ClickHouse Cloud Compliance package {#compliance-package} NIST Risk Management Framework (RMF) documentation to accelerate your Authorization to Operate (ATO) Full featured roadmap with new features added regularly {#full-featured-roadmap} Additional features that are coming soon include: - API to programmatically manage resources - Automated backups - Automated vertical scaling operations - Identity provider integration Architecture {#architecture} ClickHouse Government is fully self-contained within your deployment environment and consists of compute managed within Kubernetes and storage within an S3 compatible storage solution. Onboarding process {#onboarding-process} Customers can initiate onboarding by reaching out to us . For qualified customers, we will provide a detailed environment build guide and access to the images and Helm charts for deployment. General requirements {#general-requirements} This section is intended to provide an overview of the resources required to deploy ClickHouse Government. Specific deployment guides are provided as part of onboarding. Instance/server types and sizes depend on the use case. ClickHouse Government on AWS {#clickhouse-government-aws}
{"source_file": "03_clickhouse-government.md"}
[ -0.07903894782066345, -0.028988730162382126, -0.011610481888055801, -0.04480878636240959, 0.034823909401893616, -0.07194621860980988, 0.023314664140343666, -0.03769095987081528, 0.026471469551324844, 0.06174715235829353, 0.019987544044852257, 0.027039267122745514, 0.007215996738523245, -0....