Wednesday, September 17, 2025

Generative AI Deployment with Terraform

 

A Multi-Cloud Comparison

This post provides a detailed breakdown of the steps and resources required to deploy a generative AI application using Terraform, drawing on the provided Google Cloud blog post and comparing the process to Azure and AWS.

Part 1: The Google Cloud (GCP) Approach (Based on the Blog Post)

The blog post "Deploy a Generative AI Application with Terraform" focuses on using a specific set of GCP services and Terraform resources. The goal is to set up a serverless application that can interact with a large language model.

Core Services Used

  • Generative AI on Vertex AI: This is Google Cloud's fully managed platform for machine learning and AI development. It provides access to Google's foundation models.

  • Cloud Functions: A serverless compute service that allows you to run code without provisioning or managing servers. It will host the application's back-end logic.

  • Cloud Storage: Used for storing the application's code and dependencies.

Terraform Resources & Files

  • main.tf: The primary configuration file where you define all the resources.

  • google_project: Represents the GCP project.

  • google_service_account: Creates a service account for the Cloud Function to run with.

  • google_storage_bucket: Provisions the Cloud Storage bucket.

  • google_storage_bucket_object: Uploads the Cloud Function code to the bucket.

  • google_cloudfunctions2_function: Defines the Cloud Function itself, pointing to the code in the storage bucket.

  • google_cloud_run_service_iam_member: Sets the IAM policy to allow public access to the Cloud Function endpoint.

  • variables.tf: Contains all the input variables for your configuration, such as the project ID and region.

  • outputs.tf: Defines the output values, such as the URL of the deployed Cloud Function, so you can easily access them after deployment.

Deployment Steps

  1. Prerequisites:

  • Install the gcloud CLI.

  • Install Terraform.

  • Authenticate with Google Cloud using gcloud auth application-default login.

  1. Code: Create the Terraform configuration files (main.tf, variables.tf, outputs.tf) and the application code for the Cloud Function.

  2. Initialization: Run terraform init to initialize the working directory and download the necessary providers.

  3. Planning: Run terraform plan to see a preview of the infrastructure changes that will be made.

  4. Deployment: Run terraform apply to create the resources in your GCP project. Terraform will execute the plan and output the Cloud Function's URL upon completion.

Part 2: Comparison with Azure & AWS

Azure

Azure's approach to generative AI deployment with Terraform centers on its Azure AI services, particularly Azure OpenAI Service. The steps are conceptually similar but use different resources and services.

  • Generative AI Service: The primary service is Azure OpenAI Service, which provides access to models like GPT-4.

  • Serverless Compute: Azure Functions is the direct equivalent of GCP Cloud Functions.

  • Storage: Azure Blob Storage or Azure Data Lake Storage are used for storing code and data.

GCP Resource / Service

Azure Equivalent

Description

google_project

azurerm_resource_group

A logical container for all your resources.

google_storage_bucket

azurerm_storage_account

Stores your application code, model data, etc.

google_cloudfunctions2_function

azurerm_function_app

Hosts the serverless back-end code.

Vertex AI / Generative AI

azurerm_cognitive_account

The resource that provisions and manages the Azure OpenAI service.

gcloud auth

az login

The command-line tool for authenticating with the cloud provider.

AWS

AWS provides a highly flexible environment for generative AI. The approach with Terraform typically involves using a combination of services, with Amazon Bedrock often serving as the AI backbone.

  • Generative AI Service: Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models.

  • Serverless Compute: AWS Lambda is the serverless function service, analogous to Cloud Functions and Azure Functions.

  • Storage: Amazon S3 (Simple Storage Service) is the object storage service used for code, data, and model artifacts.

  • API Endpoint: Amazon API Gateway is commonly used to create a REST API endpoint for the Lambda function.

GCP Resource / Service

AWS Equivalent

Description

google_project

AWS Account/Region

The main account and a selected region to host resources.

google_storage_bucket

aws_s3_bucket

The storage service for application code and data.

google_cloudfunctions2_function

aws_lambda_function

The serverless compute service that runs the application logic.

Vertex AI / Generative AI

Amazon Bedrock (via API)

Bedrock is a service, and you'd use a Lambda function with appropriate IAM roles to interact with it via API calls.

gcloud auth

aws configure

The command-line tool for setting up authentication.

Summary of Steps Across Clouds

Step

GCP (Google Cloud)

Azure

AWS

Authentication

gcloud auth application-default login

az login

aws configure

Provider

hashicorp/google

hashicorp/azurerm

hashicorp/aws

Resource Grouping

google_project

azurerm_resource_group

N/A (Resources are in a region)

Core AI Service

google_cloudfunctions2_function

azurerm_cognitive_account

Interaction with Amazon Bedrock

Serverless Compute

google_cloudfunctions2_function

azurerm_function_app

aws_lambda_function

Storage

google_storage_bucket

azurerm_storage_account

aws_s3_bucket

IAM/Permissions

google_cloud_run_service_iam_member

azurerm_function_app_

aws_iam_role

Deployment Command

terraform apply

terraform apply

terraform apply


Tuesday, September 9, 2025

N8N Automation

N8N Automation - This post is for basic reading on N8N AI 

1. Introduction to the AI Automation Series with N8n

Welcome to the AI Automation series designed for the IT Operations Runbook team. This series focuses on leveraging the power of N8N, a powerful and flexible open-source workflow automation platform. N8N excels in connecting various applications and services, enabling the creation of complex workflows with a low-code/no-code approach. For an IT operations team, this is invaluable, as it allows for the rapid creation and deployment of automations that can handle routine, repetitive, or event-driven tasks. The goal of this series is to help you integrate artificial intelligence capabilities into your existing runbooks, transforming them from static procedures into dynamic, intelligent, and self-healing systems.

2. Understanding the Five Types of Nodes in N8n

Every N8N workflow is built from a series of connected nodes. Each node performs a specific function, and they can be broadly categorized into five main types that serve different purposes within a workflow.

  • Trigger Nodes: These are the starting points of a workflow. They listen for a specific event or operate on a schedule to initiate the automation. Without a trigger, a workflow will not run.

  • Action Nodes: These nodes perform a specific task or operation. They are the workhorses of a workflow, responsible for actions like sending an email, posting a message to Slack, creating a ticket in Jira, or executing a script. Most nodes fall into this category.

  • Flow Control Nodes: These nodes manage the flow of data and execution logic within a workflow. Examples include IF nodes to create conditional branches, Wait nodes to pause a workflow for a specific duration, or Split in Batches nodes to process data in manageable chunks.

  • Data Transformation Nodes: These nodes are used to manipulate, format, or transform data as it passes through the workflow. Nodes like Set to add or modify data, Code to execute custom JavaScript logic, or Function to run a block of code are all essential for data preparation.

  • AI Nodes: As a specialized subset of Action nodes, these are specifically designed to interact with artificial intelligence models and services. They allow you to integrate capabilities like natural language processing, text summarization, image generation, or sentiment analysis directly into your automation pipelines.

3. Introduction to AI Agents and Node Types in N8n

In the context of N8N, an "AI Agent" can be thought of as an intelligent workflow that leverages AI models to perform complex tasks that require reasoning or creativity. Instead of simply performing a predefined action, an AI agent can analyze a situation, make a decision, and then act accordingly.

N8N facilitates the creation of these agents through its dedicated AI nodes. By using nodes for services like OpenAI's ChatGPT, Hugging Face models, or other custom AI APIs, you can build workflows that:

  • Automatically Summarize Incidents: A workflow can be triggered by a new incident ticket, use an AI node to summarize the ticket and related chat logs, and then post the summary to a communication channel.

  • Generate Root Cause Analysis: An agent could be built to analyze log data and incident reports to draft a preliminary root cause analysis report.

  • Automate Customer Support: An AI agent could analyze incoming support requests, classify their urgency, and generate an appropriate first-response message.

These AI nodes can be seamlessly integrated with other standard nodes, allowing you to create a powerful chain of command: Trigger -> Data Transformation -> AI Node -> Action Node.

4. Understanding Trigger Nodes in N8n for Event-Driven Workflows

Trigger nodes are the foundation of any event-driven automation. They are always the first node in a workflow and dictate when the workflow will run. Choosing the correct trigger is crucial for building effective and responsive runbooks.

For an IT operations team, common trigger nodes include:

  • Webhook Trigger: This is one of the most powerful and common triggers. It provides a unique URL that can be called by an external service (e.g., a monitoring system like Prometheus or a cloud provider's alert system). When a call is received, the workflow is instantly triggered, allowing for real-time response to alerts.

  • Email Trigger: This node monitors an email inbox and triggers a workflow whenever a new email is received that matches a set of criteria. This is useful for automating responses to email-based alerts from legacy systems or for creating tickets from user-reported issues.

  • Cron Trigger: This node triggers a workflow on a predefined schedule (e.g., every day at 3:00 AM, every 15 minutes, or on the first of every month). This is perfect for automating routine maintenance tasks, daily health checks, or generating scheduled reports.

  • Service-Specific Triggers: N8N provides dedicated triggers for hundreds of services. For an IT team, these might include a Jira Trigger (to start a workflow when a new issue is created), a PagerDuty Trigger (for new incidents), or a GitHub Trigger (for new code commits or issues).

Post-Incident Analysis: AWS US-EAST-1

  Post-Incident Analysis: AWS US-EAST-1 Outage (October 20, 2025) 1. Incident Overview and Scope of Impact The major AWS service disruption ...