### Quick Start Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/terraform/guides/getting-started.mdx A complete example demonstrating the configuration of the Azion Terraform Provider v2.0 with basic resource definitions. ```hcl terraform { required_providers { azion = { source = "aziontech/azion" version = "2.0.0" } } } provider "azion" { api_token = var.api_token } # Create a workload resource "azion_workload" "example" { name = "my-workload" # Additional configuration... } # Create a connector resource "azion_connector" "example" { name = "my-connector" # Additional configuration... } # Create an application resource "azion_application_main_settings" "example" { name = "my-application" # Additional configuration... } ``` -------------------------------- ### Install and Start Orchestrator Agent Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/orchestrator/first-steps-edge-node.mdx Make the orchestrator executable, install it, and then start the agent. Run with sudo if necessary. For systems without a service manager, use the --foreground flag. ```bash chmod +x edge-orchestrator ./edge-orchestrator install ``` ```bash edge-orchestrator start ``` ```bash edge-orchestrator start --foreground ``` -------------------------------- ### Install Python Dependencies and Setup Environment Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/store-journey/sql/install-edgesql-shell.mdx Create a virtual environment, activate it, install PostgreSQL (if not already present), and then install the Python dependencies listed in requirements.txt. Ensure Python 3.x is installed. ```sh python -m venv env source env/bin/activate brew install postgresql pip install -r requirements.txt ``` -------------------------------- ### Install Azion Go SDK Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/sdks/go.mdx Use 'go get' to download and install the Azion API Go SDK into your project. Alternatively, 'go mod tidy' can manage dependencies. ```bash go get github.com/aziontech/azionapi-go-sdk ``` ```bash go mod tidy ``` -------------------------------- ### Complete Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/terraform/resources/workloads.mdx This example demonstrates the full setup including provider configuration, creating a workload and its deployment, querying existing workloads, and defining an output. ```hcl terraform { required_providers { azion = { source = "aziontech/azion" version = "2.0.0" } } } provider "azion" { api_token = var.api_token } # Create a workload resource "azion_workload" "my_app" { name = "my-application" } # Create a deployment for the workload resource "azion_workload_deployment" "my_app_deployment" { workload_id = azion_workload.my_app.id # Additional deployment configuration } # Query existing workloads data "azion_workloads" "all" {} output "workload_id" { value = azion_workload.my_app.id } ``` -------------------------------- ### Install Project Dependencies for Local Development Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/build-journey/develop-with-azion/frameworks/framework-astro.mdx When prompted after choosing to start a local development server, input 'y' to install the necessary project dependencies. This step is crucial for the local development server to function correctly. ```sh Do you want to install project dependencies? This may be required to start local development server (y/N) ``` -------------------------------- ### Quick Start with Azion CLI Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/cli/azion-cli/azion-overview/azion-overview.mdx Install Azion CLI, log in, initialize a new project, and deploy your application with these commands. ```bash curl -fsSL https://cli.azion.app/install.sh | bash azion login azion init azion deploy ``` -------------------------------- ### Install Terraform Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/terraform/guides/getting-started.mdx Verify the Terraform installation by checking its version. ```bash terraform version ``` -------------------------------- ### Start Local Development Server Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/build-journey/develop-with-azion/frameworks/framework-docusaurus.mdx After project setup, you can choose to start a local development server to preview your Docusaurus site. This requires installing project dependencies. ```sh Do you want to start a local development server? (y/N) ``` ```sh Do you want to install project dependencies? This may be required to start local development server (y/N) ``` -------------------------------- ### Start Orchestrator Agent Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/deploy-journey/configure-node/install-orch-agent/install-orch-agent.mdx After installation, start the Orchestrator agent service. Administrator privileges are required. ```bash sudo ./edge-orchestrator start ``` -------------------------------- ### Launch Project Locally Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/console-kit/console-kit.mdx Start the development server for the Azion Console Kit project. The --host flag makes it accessible on your network. ```bash yarn dev --host ``` -------------------------------- ### Full Azion Application Configuration Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/azion-lib/usage/config.mdx An example demonstrating a comprehensive Azion application configuration using `defineConfig`, including build settings, application definitions with caching, and storage configurations. ```javascript import { defineConfig } from 'azion/config'; const config = defineConfig({ build: { entry: './src/index.js', preset: 'javascript', bundler: 'esbuild', }, applications: [ { name: 'my-app', active: true, cache: [ { name: 'my-cache', browser: { maxAgeSeconds: 3600 }, edge: { maxAgeSeconds: 7200 }, }, ], }, ], storage: [ { name: 'my-storage', workloadsAccess: 'read_write', dir: './storage', prefix: 'app-data', }, ], }); export default config; ``` -------------------------------- ### MCP Inspector Installation Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/mcp/mcp-configuration.mdx Command to install the MCP Inspector globally. ```bash npm install -g @modelcontextprotocol/inspector ``` -------------------------------- ### Run Database Setup Migration Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/marketplace/templates/langgraph-template.mdx Execute this command in the 'migrations' folder to set up the vector database. This script initializes the database and creates necessary tables for storing embeddings. ```bash yarn setup ``` -------------------------------- ### Install Project Dependencies for Local Development Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/build-journey/develop-with-azion/frameworks/framework-angular.mdx When prompted after initializing your project, input 'y' to install the necessary dependencies for running the local development server. ```bash Do you want to install project dependencies? This may be required to start local development server (y/N) ``` -------------------------------- ### Full example of using get() and getWithMetadata() Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/azion-edge-runtime/api-reference/kv-store/read.mdx A comprehensive example demonstrating how to use get() and getWithMetadata() for single and multiple keys, including handling different data types and metadata. ```javascript async function handleRequest(request) { const kv = new Azion.KV(); try { // Read single key, returns value or null const value = await kv.get("first-key", "text"); // Read multiple keys, returns object with values const values = await kv.get(["first-key", "second-key"], "text"); // Read single key with metadata const valueWithMetadata = await kv.getWithMetadata("first-key", "text"); // Read multiple keys with metadata const valuesWithMetadata = await kv.getWithMetadata(["first-key", "second-key"], "text"); return new Response(JSON.stringify({ value: value, values: values, valueWithMetadata: valueWithMetadata, valuesWithMetadata: valuesWithMetadata }), { headers: { "Content-Type": "application/json" } }); } catch (e) { return new Response(e.message, { status: 500 }); } } addEventListener("fetch", (event) => { event.respondWith(handleRequest(event.request)); }); ``` -------------------------------- ### Get with Metadata Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/azion-edge-runtime/api-reference/kv-store/read.mdx Example of how to get the value and metadata for multiple keys. ```javascript await kv.getWithMetadata(keys, type?); ``` -------------------------------- ### V3 Configuration Structure Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/cli/azion-cli/config/azion-config-js.mdx Illustrates the flat configuration structure used in V3. ```javascript { origin: [...], cache: [...], rules: {...} } ``` -------------------------------- ### Start local development server Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/cli/azion-cli/commands/link-project/link.mdx Choose whether to start a local development server immediately after linking. If you select 'N' (No), you can start it later using the 'azion dev' command. ```bash ? Do you want to start a local development server? (y/N) ``` -------------------------------- ### Start local development server prompt Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/frameworks/angular.mdx This prompt asks whether to start a local development server after project setup. ```bash Do you want to start a local development server? (y/N) ``` -------------------------------- ### Add Azion MCP to Claude and Start Service Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/mcp/mcp-configuration.mdx Commands to add Azion MCP to Claude and start the Claude service. ```bash # Add Azion MCP to Claude claude mcp add "azion-mcp" "https://mcp.azion.com" -t http -H "Authorization: Bearer YOUR_PERSONAL_TOKEN" # Start Claude service claude serve ``` -------------------------------- ### Display Help for Azion CLI init Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/cli/azion-cli/commands/init/init.mdx Access detailed information about the `init` command and its available options by using the `--help` flag. ```sh azion init --help ``` -------------------------------- ### Complete Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/terraform/resources/connectors.mdx This example demonstrates a complete Terraform configuration including provider setup, connector creation, and querying existing connectors. ```hcl terraform { required_providers { azion = { source = "aziontech/azion" version = "2.0.0" } } } provider "azion" { api_token = var.api_token } # Create a connector resource "azion_connector" "my_origin" { name = "my-origin" # Origin configuration } # Query existing connectors data "azion_connectors" "all" {} output "connector_id" { value = azion_connector.my_origin.id } ``` -------------------------------- ### Setup Vector Database Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/marketplace/templates/langgraph-template.mdx This snippet shows how to initialize and set up the vector database. Ensure `yarn setup` is run before the first upload. ```typescript // const vectorStore = new AzionVectorStore(...); // await vectorStore.setupDatabase({ mode: "hybrid", columns: ["*"] }); ``` -------------------------------- ### Rules Engine Validation Criteria Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/paywall-edge-function-jwt/paywall-edge-function-jwt.mdx This example demonstrates how to define a business rule in the Rules Engine. The rule checks if a requested URI starts with the string '/news'. ```string If: ${uri} starts with /news ``` -------------------------------- ### Complete Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/terraform/resources/security.mdx A comprehensive example demonstrating the setup of network lists, firewall, and WAF rule sets using Azion Terraform resources. ```hcl terraform { required_providers { azion = { source = "aziontech/azion" version = "2.0.0" } } } provider "azion" { api_token = var.api_token } # Create network list for blocked IPs resource "azion_network_list" "blocked_ips" { name = "blocked-ips" list_type = "ip_cidr" } # Create firewall resource "azion_firewall_main_setting" "my_firewall" { name = "my-firewall" active = true # Link to workload/application } # Create WAF rule set resource "azion_waf_rule_set" "my_waf" { name = "my-waf" # WAF configuration } output "firewall_id" { value = azion_firewall_main_setting.my_firewall.id } ``` -------------------------------- ### Complete Azion KV client example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/azion-lib/usage/kv.mdx Demonstrates creating, connecting, and using the Azion KV client for setting, getting, hash operations, and managing the connection. Includes error handling and provider type checking. ```typescript import { createClient } from 'azion/kv'; async function main() { // Create and connect client const client = await createClient({ namespace: 'my-namespace', }) .on('error', (err) => console.error('KV Error:', err)) .connect(); // Store a value with expiration await client.set('user:123', JSON.stringify({ name: 'John', role: 'admin' }), { expiration: { type: 'EX', value: 3600 }, // 1 hour metadata: { createdBy: 'system' }, }); // Retrieve the value const userData = await client.get('user:123'); console.log('User data:', userData); // Get with metadata const result = await client.getWithMetadata('user:123'); console.log('Value:', result.value); console.log('Metadata:', result.metadata); // Hash operations await client.hSet('config', 'theme', 'dark'); await client.hSet('config', 'language', 'en'); const config = await client.hGetAll('config'); console.log('Config:', config); // Check provider type console.log('Provider:', client.getProviderType()); // Delete and disconnect await client.delete('user:123'); await client.disconnect(); } main(); ``` -------------------------------- ### Custom Bot Rules Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/fastly-to-azion/fastly-to-azion-comprehensive-guide.mdx Examples of custom bot rules for defining criteria and behaviors. ```text Criteria: ${user_agent} contains "BadBot" Behavior: Deny (403) Criteria: ${user_agent} contains "Googlebot" Behavior: Allow ``` -------------------------------- ### Setup Storage Bucket Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/azion-lib/usage/storage.mdx The `setupStorage` utility ensures a bucket exists by attempting to retrieve it first, and creating it if it doesn't exist. This is useful for initializing storage for applications. ```APIDOC ## POST /azion/storage/setup ### Description Ensures a bucket exists by checking for its presence and creating it if necessary. Returns the bucket object upon success. ### Method POST ### Endpoint /azion/storage/setup ### Parameters #### Request Body - **name** (string) - Required - The name of the bucket to get or create. - **workloads_access** (string) - Required - The access configuration for the bucket if it needs to be created. Possible values: `'read_only'`, `'read_write'`, `'restricted'`. - **options** (object) - Optional - Additional parameters for the request. ### Request Example ```json { "name": "my-app-bucket", "workloads_access": "read_write" } ``` ### Response #### Success Response (200) - **bucket** (AzionBucket) - The existing or newly created bucket object. #### Response Example ```json { "bucket": { "id": "12345", "name": "my-app-bucket", "workloads_access": "read_write", "created_at": "2023-01-01T10:00:00Z", "updated_at": "2023-01-01T10:00:00Z" } } ``` ``` -------------------------------- ### Nameserver Migration Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/fastly-to-azion/fastly-to-azion-comprehensive-guide.mdx Example of Azion DNS nameservers to configure for full DNS control. ```text ns1.aziondns.net ns2.aziondns.com ns3.aziondns.org ``` -------------------------------- ### Azion CLI Help Output Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/deploy-journey/advanced-config/run-scripts/run-scripts.mdx Example output of the Azion CLI help command, showing version, description, synopsis, and examples. ```bash Azion CLI 1.10.2 DESCRIPTION The Azion Command Line Interface is a unified tool to manage your Azion projects and resources SYNOPSIS azion [flags] EXAMPLES $ azion $ azion -t azionb43a9554776zeg05b11cb1declkbabcc9la $ azion --debug $ azion -h ... ``` -------------------------------- ### config init Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/cli/azion-cli/commands/config/config.mdx Examples of how to initialize the Azion configuration file. ```sh azion config init ``` ```sh azion config init --config-dir ./my-project ``` -------------------------------- ### CNAME Migration Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/fastly-to-azion/fastly-to-azion-comprehensive-guide.mdx Example of how to point a subdomain to the Azion-generated domain using a CNAME record. ```text www CNAME xxxxxxxxxx.map.azionedge.net ``` -------------------------------- ### Deploy AI Inference Starter Kit via CLI Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/cloudflare-to-azion/cf-to-azion-comprehensive-guide.mdx Command to deploy the AI Inference Starter Kit using the Azion CLI. ```bash # Deploy via CLI azion deploy --template ai-inference-starter-kit ``` -------------------------------- ### JavaScript GET Request Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/azion-edge-runtime/javascript-examples/rest-apis/rest-apis.mdx Use this snippet to make a GET request to an API endpoint. Ensure you set the 'Accept' and 'Authorization' headers correctly. The response is logged to the console. ```javascript var myHeaders = new Headers(); myHeaders.append("Accept", "application/json; version=3"); myHeaders.append("Authorization", "Token [TOKEN VALUE]"); var requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' }; fetch("https://api.azionapi.net/digital_certificates/", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); ``` -------------------------------- ### Workloads API v4 Response Example Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/main-menu/work-with-domains/migrate-ns.mdx This is an example of the JSON response you will receive after a successful GET request to retrieve workloads. It includes workload IDs, names, and domain information. ```json { "count": 3, "results": [ { "id": """, "name": "My workload", "active": true, "last_editor": "your-email.example.com", "last_modified": "2025-08-06T17:53:47.460211Z", "infrastructure": 1, "tls": { "certificate": null, "ciphers": 7, "minimum_version": "tls_1_3" }, "protocols": { "http": { "versions": [ "http1", "http2" ], "http_ports": [ 80 ], "https_ports": [ 443 ], "quic_ports": null } }, "mtls": { "verification": null, "certificate": null, "crl": null }, "domains": [ "xxxxxxx.azion.app" ], ``` -------------------------------- ### Choose a preset for your application Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/devtools/cli/azion-cli/commands/link-project/link.mdx Select a preset that matches your project's framework or technology stack. This helps Azion configure the build and deployment process correctly. Use arrow keys to navigate and type to filter the list. ```bash ? Choose a preset: [Use arrows to move, type to filter] > Angular Astro Docusaurus Eleventy Emscripten Gatsby Hexo Html Hugo Javascript Jekyll Next React Rustwasm Svelte Typescript Vitepress Vue ``` -------------------------------- ### Tool Calling Example with GPT-OSS 20B Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/main-menu/reference/ai-inference/ai-models/gpt-oss-20b.mdx This example demonstrates how to enable tool calling for the GPT-OSS 20B model. The model can then respond with tool calls that your application can execute. ```bash curl http://localhost:8000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "stream": true, "model": "gpt-oss-20b", "max_tokens": 1024, "messages": [ {"role": "system", "content": "You are a helpful assistant with access to tools."}, {"role": "user", "content": "What is the weather in London?"} ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state" } }, "required": ["location"] } } } ] }' ``` ```json {"id":"chatcmpl-tool-example","object":"chat.completion","created":1746821866,"model":"gpt-oss-20b","choices":[{"index":0,"message":{"role":"assistant","reasoning_content":null,"content":null,"tool_calls":[{"id":"chatcmpl-tool-fd3311e75aed4cbfbeb7244ced77379f","type":"function","function":{"name":"get_weather","arguments":"{\"location\": \"London\"}"}}]}},"logprobs":null,"finish_reason":"tool_calls","stop_reason":null}],"usage":{"prompt_tokens":293,"total_tokens":313,"completion_tokens":20,"prompt_tokens_details":null},"prompt_logprobs":null} ``` -------------------------------- ### Install Azion Grafana Plugin Source: https://github.com/aziontech/docs/blob/main/src/content/docs/en/pages/guides/aws-to-azion/aws-to-azion-comprehensive-guide.mdx Command to install the Azion Grafana plugin using the Grafana CLI. ```bash # Install Azion Grafana plugin grafana-cli plugins install aziontech-azion-plugin ```