<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Raju Banerjee on Medium]]></title>
        <description><![CDATA[Stories by Raju Banerjee on Medium]]></description>
        <link>https://medium.com/@errajubanerjee?source=rss-cda90b4a52d1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*W7IN3eWNm9ftyvCovk4srw.png</url>
            <title>Stories by Raju Banerjee on Medium</title>
            <link>https://medium.com/@errajubanerjee?source=rss-cda90b4a52d1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 01:29:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@errajubanerjee/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Secure AI SRE Agent on GKE: Kubernetes Incident Investigation with Prometheus, Grafana &…]]></title>
            <link>https://medium.com/@errajubanerjee/building-an-ai-sre-agent-on-gke-kubernetes-rca-with-prometheus-grafana-and-google-iap-34d35c5b0b7a?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/34d35c5b0b7a</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[sre]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Wed, 26 Aug 2026 14:13:59 GMT</pubDate>
            <atom:updated>2026-08-27T13:42:14.412Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Secure AI SRE Agent on GKE: Kubernetes Incident Investigation with Prometheus, Grafana &amp; Google IAP</h3><p>Over the last few days, I’ve been building a small project around a simple question:</p><blockquote><em>Can we make Kubernetes incident investigation a little less manual?</em></blockquote><p>Anyone who has worked with Kubernetes knows the usual flow when something breaks.</p><p>You start with:</p><pre>kubectl get pods</pre><p>Then maybe:</p><pre>kubectl describe pod<br>kubectl logs<br>kubectl get events</pre><p>After that, you open Prometheus, check Grafana, look at restart counts, CPU, memory, pod readiness, and try to connect everything together.</p><p>None of those steps is especially difficult.</p><p>The challenge is that the useful evidence is spread across different places, and during an incident you need to answer a few questions quickly:</p><ul><li>What actually failed?</li><li>Why did it fail?</li><li>Is this an application, Kubernetes, or infrastructure problem?</li><li>What is the safest next action?</li></ul><p>That is what pushed me to start building this project.</p><h3>AI SRE Agent</h3><p>The idea is to build a lightweight SRE assistant that can collect Kubernetes evidence, correlate operational signals, and help an engineer move faster toward root cause analysis.</p><p>The current version focuses first on building the <strong>evidence collection and control plane</strong> correctly.</p><p>The next layer is using an AI agent to correlate that evidence and generate structured RCA and remediation recommendations.</p><p>The platform currently brings together:</p><ul><li>FastAPI</li><li>Google Kubernetes Engine</li><li>Kubernetes APIs</li><li>Prometheus</li><li>Grafana</li><li>Kubernetes RBAC</li><li>GKE Ingress</li><li>Google-managed HTTPS</li><li>Google Identity-Aware Proxy</li><li>Incident investigation</li><li>Controlled remediation</li></ul><h3>Demo</h3><p><strong>Demo flow: Google authentication → IAP → platform health → monitoring → incident investigation → RCA result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPgJY3wk_Oc5y1Z1ydTywg.gif" /></figure><h3>What I wanted the platform to do</h3><p>I didn’t want to build another Kubernetes dashboard.</p><p>There are already plenty of good dashboards.</p><p>What I wanted was something closer to how an SRE actually thinks during an incident.</p><p>For example:</p><pre>Why is payment-api crashing?</pre><pre>Show me unhealthy pods.</pre><pre>Why is this deployment stuck in Pending?</pre><pre>Which workloads have unusually high restart counts?</pre><p>The basic flow is:</p><pre>Question<br>   ↓<br>Collect Kubernetes evidence<br>   ↓<br>Check pod state and events<br>   ↓<br>Check monitoring data<br>   ↓<br>Identify the likely problem<br>   ↓<br>Recommend the next action</pre><p>The longer-term goal is:</p><pre>Detect<br>  ↓<br>Collect<br>  ↓<br>Correlate<br>  ↓<br>Reason<br>  ↓<br>Recommend<br>  ↓<br>Remediate<br>  ↓<br>Verify</pre><h3>Starting with FastAPI</h3><p>I started with a small FastAPI application running locally.</p><p>The backend exposed APIs such as:</p><pre>/api/kubernetes/status<br>/api/prometheus/status<br>/api/grafana/status<br>/api/metrics<br>/api/investigate</pre><p>The frontend had four main sections:</p><ul><li>Overview</li><li>Monitoring</li><li>Investigate</li><li>Results</li></ul><p>Before adding more intelligence, I wanted to make sure the application could reliably answer three simple questions:</p><pre>Can I talk to Kubernetes?<br>Can I talk to Prometheus?<br>Can I talk to Grafana?</pre><p>That foundation turned out to be more important than I initially expected.</p><h3>Connecting the application to GKE</h3><p>Locally, the application could use my kubeconfig.</p><p>Once the application moved inside GKE, it needed to use in-cluster authentication with a Kubernetes ServiceAccount and the right RBAC permissions.</p><p>I checked the ServiceAccount being used by the deployment with:</p><pre>kubectl get deployment ai-sre-agent \<br>  -n ai-sre \<br>  -o jsonpath=&#39;{.spec.template.spec.serviceAccountName}&#39;<br>echo</pre><p>Then I tested Kubernetes access directly from inside the application pod:</p><pre>kubectl exec -n ai-sre deployment/ai-sre-agent -- \<br>  python -c &#39;<br>from kubernetes import client, config<br>config.load_incluster_config()<br>v1 = client.CoreV1Api()<br>print([n.metadata.name for n in v1.list_namespace().items])&#39;</pre><p>This helped me debug one of the first issues in the UI.</p><p>The namespace dropdown was stuck on:</p><pre>Loading namespaces...</pre><p>At first, it looked like a frontend problem.</p><p>It wasn’t.</p><p>The actual issue was RBAC.</p><p>Once the ServiceAccount, ClusterRole, and ClusterRoleBinding were corrected, the application could list namespaces and deployments properly.</p><p>That was a useful reminder: a UI problem in Kubernetes can easily originate several layers deeper.</p><h3>Creating a real incident</h3><p>A healthy cluster is not very interesting for an SRE tool.</p><p>So I created a workload that intentionally failed.</p><p>The container started, detected a missing configuration, and exited with something like:</p><pre>DATABASE_URL is missing</pre><p>Kubernetes restarted it repeatedly until the pod entered:</p><pre>CrashLoopBackOff</pre><p>Now I had a repeatable incident.</p><p>Instead of asking generic questions, I could ask:</p><pre>Why is payment-api crashing?</pre><p>and collect:</p><ul><li>pod status</li><li>restart counts</li><li>container state</li><li>readiness</li><li>Kubernetes events</li><li>deployment context</li></ul><p>This was where the project started to feel more like an investigation tool than a dashboard.</p><h3>Adding Prometheus and Grafana</h3><p>Kubernetes state alone is not enough for a useful RCA.</p><p>A pod can be running while the application is unhealthy.</p><p>A deployment may look normal while latency is increasing.</p><p>A workload may be restarting intermittently without showing an obvious problem at the moment you inspect it.</p><p>So I added Prometheus and Grafana using kube-prometheus-stack.</p><p>That gave me:</p><ul><li>Prometheus</li><li>Grafana</li><li>kube-state-metrics</li><li>Alertmanager</li></ul><p>The goal is for the investigation layer to correlate signals such as:</p><pre> Kubernetes state<br>   +<br> Events<br>   +<br> Logs<br>   +<br> Restart counts<br>   +<br> Prometheus metrics</pre><p>This is an important distinction.</p><p>Calling an LLM is relatively straightforward.</p><p>Building a useful SRE agent means giving it trustworthy evidence to reason from.</p><h3>One unexpected challenge: GKE Autopilot</h3><p>One of the more interesting problems came from running kube-prometheus-stack on GKE Autopilot.</p><p>The default chart assumes it can access node-level resources such as:</p><pre>/proc<br>/sys<br>/<br>hostNetwork<br>hostPID</pre><p>GKE Autopilot intentionally blocks this kind of unrestricted host access.</p><p>It also protects managed namespaces such as:</p><pre>kube-system</pre><p>The first Helm install failed because the chart tried to create or patch resources that Autopilot does not allow.</p><p>The right fix was not to bypass those restrictions.</p><p>I disabled the components that did not fit the Autopilot model:</p><pre>nodeExporter:<br>  enabled: false</pre><pre>prometheus-node-exporter:<br>  enabled: false</pre><pre>kubeDns:<br>  enabled: false</pre><pre>coreDns:<br>  enabled: false</pre><pre>kubeEtcd:<br>  enabled: false</pre><pre>kubeScheduler:<br>  enabled: false</pre><pre>kubeControllerManager:<br>  enabled: false</pre><pre>kubeProxy:<br>  enabled: false</pre><p>After that, the monitoring stack deployed successfully.</p><p>A Helm chart that works perfectly on a traditional Kubernetes cluster may still need adjustments on a managed platform such as GKE Autopilot.</p><h3>Containerizing the application</h3><p>I was building from my MacBook, so image architecture became another small but important issue.</p><p>The first build resulted in:</p><pre>no match for platform in manifest</pre><p>The GKE workload expected linux/amd64, while my local environment could build an ARM image.</p><p>I fixed that with Docker Buildx:</p><pre>docker buildx build \<br>  --platform linux/amd64 \<br>  -t us-east1-docker.pkg.dev/&lt;PROJECT_ID&gt;/ai-sre-repo/ai-sre-agent:v4 \<br>  --push .</pre><p>The Dockerfile remained simple:</p><pre>FROM python:3.13-slim</pre><pre>WORKDIR /app</pre><pre>COPY requirements.txt .</pre><pre>RUN pip install --no-cache-dir -r requirements.txt</pre><pre>COPY app ./app</pre><pre>EXPOSE 8080</pre><pre>CMD [&quot;uvicorn&quot;, &quot;app.main:app&quot;, &quot;--host&quot;, &quot;0.0.0.0&quot;, &quot;--port&quot;, &quot;8080&quot;]</pre><p>Once the image was in Artifact Registry, I deployed it to GKE.</p><h3>Moving from LoadBalancer to GKE Ingress</h3><p>Initially, I exposed the application using:</p><pre>type: LoadBalancer</pre><p>That was useful because it quickly proved that the application worked externally.</p><p>But I eventually wanted:</p><ul><li>a stable IP</li><li>DNS</li><li>HTTPS</li><li>authentication</li><li>authorization</li><li>IAP</li></ul><p>So I moved the public entry point to GKE Ingress and changed the application Service back to:</p><pre>type: ClusterIP</pre><p>The traffic path became:</p><pre>Internet<br>   ↓<br>Google Cloud HTTPS Load Balancer<br>   ↓<br>GKE Ingress<br>   ↓<br>ClusterIP Service<br>   ↓<br>FastAPI Pod</pre><p>I also reserved a global static IP:</p><pre>gcloud compute addresses create ai-sre-static-ip \<br>  --global</pre><p>One thing that confused me initially was seeing two public IPs.</p><p>The important distinction is:</p><pre>Kubernetes LoadBalancer Service IP<br>                ≠<br>        GKE Ingress IP</pre><p>Once I separated those two paths mentally, the networking became much easier to debug.</p><h3>Debugging from the inside out</h3><p>One debugging approach saved me a lot of time during this build:</p><p><strong>prove each layer before moving to the next.</strong></p><p>Before worrying about DNS, HTTPS, OAuth, or IAP, I verified that the Kubernetes Service could reach FastAPI internally.</p><p>For example:</p><pre>curl -v \<br>  http://ai-sre-agent.ai-sre.svc.cluster.local/health</pre><p>returned:</p><pre>HTTP/1.1 200 OK</pre><p>That immediately told me:</p><pre>Pod <br>Service <br>Cluster DNS </pre><p>From there, I could continue outward.</p><p>The troubleshooting order I used repeatedly was:</p><pre>Pod<br> ↓<br>Service<br> ↓<br>Cluster DNS<br> ↓<br>Ingress<br> ↓<br>Load Balancer<br> ↓<br>DNS<br> ↓<br>TLS<br> ↓<br>OAuth<br> ↓<br>IAP</pre><p>Trying to debug the entire path at once is much harder.</p><h3>Adding DNS and HTTPS</h3><p>For this lab environment, I used:</p><pre>rb.ai-sre.dynv6.net</pre><p>and pointed it to the GKE Ingress static IP.</p><p>Then I created a Google Managed Certificate:</p><pre>apiVersion: networking.gke.io/v1<br>kind: ManagedCertificate</pre><pre>metadata:<br>  name: ai-sre-cert<br>  namespace: ai-sre</pre><pre>spec:<br>  domains:<br>    - rb.ai-sre.dynv6.net</pre><p>The certificate initially remained in:</p><pre>Provisioning</pre><p>while DNS and Ingress were converging.</p><p>Once everything aligned, HTTPS became active.</p><h3>From application login to Google IAP</h3><p>My first authentication approach was a custom Google Sign-In flow inside FastAPI.</p><p>Users visited:</p><pre>/login</pre><p>clicked:</p><pre>Sign in with Google</pre><p>and the application managed the session.</p><p>It worked.</p><p>But for an internal operations platform, I wanted authentication to happen before traffic reached the application.</p><p>That is where Google Identity-Aware Proxy became a better fit.</p><p>The model changed from:</p><pre>Internet<br>   ↓<br>Application<br>   ↓<br>Login</pre><p>to:</p><pre>Internet<br>   ↓<br>Google HTTPS Load Balancer<br>   ↓<br>Identity-Aware Proxy<br>   ↓<br>IAM Authorization<br>   ↓<br>Application</pre><p>The application Service remains ClusterIP, so there is no alternate public Service path bypassing IAP.</p><h3>The redirect_uri_mismatch problem</h3><p>IAP did not work perfectly on the first attempt.</p><p>Google initially returned:</p><pre>Error 400: redirect_uri_mismatch</pre><p>The issue was the OAuth callback expected by IAP.</p><p>For a custom OAuth client, IAP uses a redirect URI in this format:</p><pre>https://iap.googleapis.com/v1/oauth/clientIds/&lt;CLIENT_ID&gt;:handleRedirect</pre><p>That exact URI had to be added to the OAuth client’s authorized redirect URIs.</p><p>Once that was configured correctly, the flow changed to:</p><pre>Choose an account<br>to continue to AI SRE Agent</pre><p>That was the point where I knew IAP was intercepting requests before they reached the application.</p><h3>Authentication is not authorization</h3><p>The next question was simple:</p><blockquote><em>Even if someone can authenticate with Google, should they be allowed into the SRE portal?</em></blockquote><p>Instead of maintaining an email allow-list inside Python, I used Google IAM.</p><p>Authorized users receive:</p><pre>roles/iap.httpsResourceAccessor</pre><p>The access path becomes:</p><pre>Google Identity<br>      ↓<br>IAM Authorization<br>      ↓<br>     IAP<br>      ↓<br> AI SRE Agent</pre><p>If application logic later depends on the authenticated IAP identity, I would also validate the signed IAP assertion rather than blindly trusting identity headers.</p><h3>Where auto-healing gets complicated</h3><p>The next major feature I am working on is controlled remediation.</p><p>This is also where AI infrastructure projects need to be careful.</p><p>Giving an AI agent unrestricted access to:</p><pre>kubectl</pre><p>would be easy.</p><p>It would also be a bad idea.</p><p>Instead, I want remediation to follow a controlled flow:</p><pre>Root Cause<br>   ↓<br>Proposed Action<br>   ↓<br>Risk Classification<br>   ↓<br>Policy Check<br>   ↓<br>Human Approval<br>   ↓<br>Execute<br>   ↓<br>Verify</pre><p>For a low-risk transient issue, the system might suggest:</p><pre>Action: Rollout Restart<br>Risk: Low<br>Auto-Heal Eligible: Yes</pre><p>But consider:</p><pre>DATABASE_URL missing</pre><p>A rollout restart does not solve that problem.</p><p>Restarting the same broken configuration only creates another broken pod.</p><p>In that case, the result should be closer to:</p><pre>Configuration Fix Required<br>Risk: High<br>Auto-Heal Eligible: No</pre><p>An automation system that can restart things is not necessarily an intelligent remediation system.</p><h3>What I learned</h3><h3>The LLM is only one part of the system</h3><p>Calling an LLM is relatively straightforward.</p><p>Building a trustworthy SRE agent around it is the harder engineering problem.</p><p>That includes:</p><pre>RBAC<br>Authentication<br>Authorization<br>Networking<br>TLS<br>Observability<br>Secrets<br>Policy<br>Safe remediation</pre><h3>Managed Kubernetes changes assumptions</h3><p>GKE Autopilot is intentionally restrictive.</p><p>That is a feature, not a bug.</p><p>The Prometheus node-exporter issue was a good example of why tools sometimes need to be adapted for managed Kubernetes.</p><h3>Internal traffic should stay internal</h3><p>Using an external Grafana IP from another pod worked, but it was fragile.</p><p>Kubernetes service discovery is the better option.</p><h3>AI remediation needs guardrails</h3><p>Investigation can be mostly read-only.</p><p>Remediation is different.</p><p>Any system that changes infrastructure should include:</p><pre>Risk<br>Policy<br>Approval<br>Audit<br>Verification<br>Rollback</pre><h3>I do not think AI will replace SRE engineers.</h3><p>What I do think is that there is a lot of repetitive operational work that agents can help with.</p><p>Today, an engineer might start an incident with:</p><pre>kubectl get pods</pre><p>and then spend the next ten or fifteen minutes collecting context.</p><p>I would rather have the system start by saying:</p><pre>Here is what failed.</pre><pre>Here is the evidence I found.</pre><pre>Here is the most likely root cause.</pre><pre>Here is what I recommend doing next.</pre><pre>And here is the risk of taking that action.</pre><blockquote><strong>GitHub Repository</strong><br>The complete implementation, Kubernetes manifests, monitoring configuration, demo workloads, and project documentation are available here:</blockquote><blockquote><a href="https://github.com/rbcap/ai-sre-agent-gke">AI SRE Agent on GKE</a></blockquote><p>The SRE still makes the decision.</p><p>The agent simply helps the engineer get to that decision faster.</p><p>That is the direction I am exploring with this AI SRE Agent.</p><p>If you’re experimenting with AI-assisted SRE, Kubernetes RCA, or safe remediation workflows, I’d be interested to hear how you’re approaching it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34d35c5b0b7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running GPU Workloads with Google Cloud Batch — Flex-start VMs & Calendar-mode Reservations]]></title>
            <link>https://blog.thecloudside.com/running-gpu-workloads-with-google-cloud-batch-flex-start-vms-calendar-mode-reservations-35c4d0c1ddc1?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/35c4d0c1ddc1</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Mon, 30 Mar 2026 11:20:55 GMT</pubDate>
            <atom:updated>2026-03-30T11:20:55.489Z</atom:updated>
            <content:encoded><![CDATA[<p>GPUs are among the most constrained resources in any cloud environment. Standard VM provisioning can fail silently — or at worst, queue indefinitely — when your target zone simply doesn’t have capacity. <strong>Dynamic Workload Scheduler (DWS)</strong> is Google Cloud’s answer to this problem.</p><p>Instead of trying a single zone and giving up, DWS submits a capacity request that persists across time. Cloud Batch integrates natively with DWS, meaning you can describe your GPU job once and let GCP find capacity — whether in us-east5-a tonight or us-central1-b tomorrow morning.</p><blockquote>Architecture at a GlanceCloud Batch → DWS Capacity Request → Instance Template (A2 Ultra GPU) → Task runs on Compute Engine VM → Logs to Cloud Logging</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h5e9ysLgUdFObDZcKz0alw.png" /></figure><h3>Prerequisites</h3><p>Before submitting your first job, you need three APIs enabled on your GCP project. The quickest path is through the Cloud Console — navigate to <em>APIs &amp; Services</em> and enable:</p><ul><li><strong>Batch API</strong> — the core job scheduling service</li><li><strong>Compute Engine API</strong> — provisions the underlying VMs</li><li><strong>Cloud Logging API</strong> — captures stdout/stderr from your tasks</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2XizJjBKDepgaYOCFyZlTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LnMEtBcAfuMJjwWCmv0eBA.png" /></figure><p>You’ll also need an <strong>instance template</strong> configured for A2 Ultra GPUs. In this walkthrough, the template is dws-batch-instance-template-a2-ultragpu-2g, which pre-bakes the machine type, accelerator config, and disk setup so your job spec stays clean.</p><h3>The Job Configuration File</h3><p>The dws-batch.json structure is mostly unchanged — the key difference is <em>how you express the scheduling mode</em>. The old goog-batch-dynamic-workload-scheduler: &quot;true&quot; label is removed. Instead, you set either provisioningModel: FLEX_START (for Flex-start VMs) or reference a calendar-mode reservation (for Calendar-mode).</p><h4>Option A — Flex-start VMs (recommended for most GPU jobs)</h4><pre><br>{<br>  &quot;allocationPolicy&quot;: {<br>    &quot;instances&quot;: [{<br>      &quot;installGpuDrivers&quot;: true,<br>      &quot;policy&quot;: {<br>        &quot;machineType&quot;: &quot;a2-ultragpu-2g&quot;,<br>        &quot;provisioningModel&quot;: &quot;FLEX_START&quot;<br>      }<br>    }],<br>    &quot;location&quot;: {<br>      &quot;allowedLocations&quot;: [<br>        &quot;regions/us-east5&quot;,<br>        &quot;zones/us-east5-a&quot;,<br>        &quot;zones/us-east5-b&quot;<br>      ]<br>    }<br>  },<br>  &quot;logsPolicy&quot;: {<br>    &quot;destination&quot;: &quot;CLOUD_LOGGING&quot;<br>  },<br>  &quot;taskGroups&quot;: [{<br>    &quot;taskSpec&quot;: {<br>      &quot;computeResource&quot;: {<br>        &quot;cpuMilli&quot;: &quot;2000&quot;,<br>        &quot;memoryMib&quot;: &quot;2000&quot;<br>      },<br>      &quot;runnables&quot;: [{<br>        &quot;script&quot;: { &quot;text&quot;: &quot;echo &#39;running on flex-start gpu vm&#39;&quot; }<br>      }]<br>    },<br>    &quot;parallelism&quot;: &quot;1&quot;,<br>    &quot;taskCount&quot;: &quot;1&quot;<br>  }]<br>}</pre><blockquote>Notice there is no labels block with goog-batch-dynamic-workload-scheduler anymore. The scheduling intent is now declared via provisioningModel: &quot;FLEX_START&quot; inside the instance policy. This is cleaner and more explicit.</blockquote><h3>Option B — Calendar-mode Reservation</h3><p>For high-assurance capacity, you first create a reservation in the GCP Console or via gcloud, then reference it in your batch job:</p><pre>{<br>  &quot;allocationPolicy&quot;: {<br>    &quot;instances&quot;: [{<br>      &quot;installGpuDrivers&quot;: true,<br>      &quot;policy&quot;: {<br>        &quot;machineType&quot;: &quot;a2-ultragpu-2g&quot;,<br>        &quot;reservationAffinity&quot;: {<br>          &quot;consumeReservationType&quot;: &quot;SPECIFIC_RESERVATION&quot;,<br>          &quot;key&quot;: &quot;compute.googleapis.com/reservation-name&quot;,<br>          &quot;values&quot;: [&quot;my-gpu-calendar-reservation&quot;]<br>        }<br>      }<br>    }]<br>  },<br>  &quot;logsPolicy&quot;: {<br>    &quot;destination&quot;: &quot;CLOUD_LOGGING&quot;<br>  },<br>  &quot;taskGroups&quot;: [{<br>    &quot;taskSpec&quot;: {<br>      &quot;computeResource&quot;: {<br>        &quot;cpuMilli&quot;: &quot;2000&quot;,<br>        &quot;memoryMib&quot;: &quot;2000&quot;<br>      },<br>      &quot;runnables&quot;: [{<br>        &quot;script&quot;: { &quot;text&quot;: &quot;echo &#39;running on calendar-reserved gpu&#39;&quot; }<br>      }]<br>    },<br>    &quot;parallelism&quot;: &quot;1&quot;,<br>    &quot;taskCount&quot;: &quot;1&quot;<br>  }]<br>}</pre><h3>Original Config (Deprecated — for reference only)</h3><pre>{<br>  &quot;allocationPolicy&quot;: {<br>    &quot;instances&quot;: [{<br>      &quot;instanceTemplate&quot;: &quot;projects/cnetwork-norvig/global/instanceTemplates/dws-batch-instance-template-a2-ultragpu-2g&quot;<br>    }],<br>    &quot;location&quot;: {<br>      &quot;allowedLocations&quot;: [<br>        &quot;regions/us-east5&quot;,<br>        &quot;zones/us-east5-a&quot;,<br>        &quot;zones/us-east5-b&quot;,<br>        &quot;zones/us-east5-c&quot;<br>      ]<br>    }<br>  },<br>  // ⚠ This label approach is deprecated — use provisioningModel or reservationAffinity instead<br>  &quot;labels&quot;: {<br>    &quot;goog-batch-dynamic-workload-scheduler&quot;: &quot;true&quot;<br>  },<br>  &quot;logsPolicy&quot;: { &quot;destination&quot;: &quot;CLOUD_LOGGING&quot; },<br>  &quot;taskGroups&quot;: [{<br>    &quot;taskSpec&quot;: {<br>      &quot;computeResource&quot;: { &quot;cpuMilli&quot;: &quot;2000&quot;, &quot;memoryMib&quot;: &quot;2000&quot; },<br>      &quot;runnables&quot;: [{ &quot;script&quot;: { &quot;text&quot;: &quot;hello testing dws&quot; } }]<br>    },<br>    &quot;parallelism&quot;: &quot;1&quot;, &quot;taskCount&quot;: &quot;1&quot;<br>  }]<br>}</pre><h3>Submitting the Job</h3><p>The gcloud batch jobs submit command itself is unchanged — only the JSON config differs. Use your updated config file when submitting new jobs:</p><h3>Flex-start VM job</h3><pre>gcloud batch jobs submit gpu-flex-01 \<br>    --location us-east5 \<br>    --config flex-start-batch.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*te5MY1Eyg1f1NZkrxHI98w.png" /></figure><h3>Calendar-mode reservation job</h3><pre>gcloud batch jobs submit gpu-cal-01 \<br>    --location us-central1 \<br>    --config calendar-reservation-batch.json</pre><blockquote>Both commands return immediately after submission — Cloud Batch acknowledges the job with a unique ID and the initial status is QUEUED. This behaviour is the same for both the old and new approaches.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i7y92X3clN97odfqV3zBiw.png" /></figure><p>In our gpu-dws-01 run on us-central1, the transition from QUEUED → SCHEDULED → RUNNING happened within roughly 2 minutes — a remarkably fast turnaround for A2 Ultra GPU capacity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YGkzYKwBmqlEjb0QG0BGZQ.png" /></figure><h3>Step-by-Step Walkthrough</h3><p>1. <strong>Enable APIs</strong>: In GCP Console, navigate to <em>APIs &amp; Services → Library</em> and enable Batch API, Compute Engine API, and Cloud Logging API for your project.</p><p>2. <strong>Choose your consumption model:</strong> Decide between <strong>Flex-start VMs</strong> (cost-optimised, best-effort, up to 7 days runtime) or <strong>Calendar-mode reservations</strong> (guaranteed capacity, 1–90 days). For most ML training and batch inference jobs, Flex-start is the right starting point.</p><p>3.<strong> Write your batch JSON </strong>: For Flex-start: set provisioningModel: &quot;FLEX_START&quot; inside allocationPolicy.instances[].policy. For Calendar-mode: set reservationAffinity.consumeReservationType: &quot;SPECIFIC_RESERVATION&quot; and reference your reservation name. Remove the old goog-batch-dynamic-workload-scheduler label.</p><p>4. <strong>Submit with gcloud:</strong> Run gcloud batch jobs submit &lt;JOB_NAME&gt; --location &lt;REGION&gt; --config &lt;your-config.json&gt;. The job enters QUEUED state immediately and the DWS engine begins capacity acquisition.</p><p>5. <strong>Monitor &amp; Collect Logs:</strong> Watch state transitions with gcloud batch jobs describe &lt;JOB_NAME&gt; --location &lt;REGION&gt;. View task logs in Cloud Logging; filter by resource.labels.job_id to isolate your job&#39;s output.</p><h3>Key Takeaways</h3><ul><li><strong>Flex-start = cost-first</strong> — best-effort availability, up to 7 days runtime, up to 53% cheaper* than on-demand. Right for most ML/batch workloads.</li><li><strong>Calendar-mode = reliability-first</strong> — reserve GPU capacity up to 90 days in advance at DWS rates. Right for production pipelines with SLA requirements.</li><li><strong>DWS pricing applies to both</strong> — you get the discount regardless of which consumption model you choose.</li><li><strong>Multi-location arrays still matter</strong> — listing multiple zones in allowedLocations gives DWS more options to find capacity quickly, especially for Flex-start jobs.</li><li><strong>Cloud Logging integration is zero-config</strong> — logsPolicy.destination: CLOUD_LOGGING works the same in both new configs.</li></ul><p>*Please validate the discount/pricing from official Google Site.</p><p>Migration path from the old approachIf you have existing jobs using the deprecated label, the migration is simple: remove the labels block, remove the instanceTemplate reference, and add policy.machineType + policy.provisioningModel: &quot;FLEX_START&quot; inside your instances array. The submit command and job lifecycle remain identical.</p><h3>What’s Next</h3><p>With the new consumption models in place, the natural next steps are:</p><ul><li>Replacing the inline script.text with a containerised workload using container.imageUri</li><li>Evaluating Flex-start vs Calendar-mode costs for your specific GPU SKU using the <a href="https://cloud.google.com/products/calculator">GCP Pricing Calculator</a></li><li>Mounting Cloud Storage buckets as FUSE volumes for large dataset access</li><li>Setting up Pub/Sub notifications on job state changes for downstream pipeline orchestration</li><li>Implementing retry policies for transient task failures on Flex-start VMs (since they can be preempted)</li></ul><p>Cloud Batch continues to be one of the simplest paths to managed GPU batch computing on GCP — and with the new consumption models, you now have explicit control over the cost-vs-reliability tradeoff without managing clusters yourself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35c4d0c1ddc1" width="1" height="1" alt=""><hr><p><a href="https://blog.thecloudside.com/running-gpu-workloads-with-google-cloud-batch-flex-start-vms-calendar-mode-reservations-35c4d0c1ddc1">Running GPU Workloads with Google Cloud Batch — Flex-start VMs &amp; Calendar-mode Reservations</a> was originally published in <a href="https://blog.thecloudside.com/">The Cloudside View</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating 30+TB from AWS FSx-NFS
to GCP Filestore Using AWS DataSync]]></title>
            <link>https://blog.thecloudside.com/migrating-30-tb-from-aws-fsx-nfs-to-gcp-filestore-using-aws-datasync-76b8a223bf0d?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/76b8a223bf0d</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 09:43:54 GMT</pubDate>
            <atom:updated>2026-03-11T09:43:54.849Z</atom:updated>
            <content:encoded><![CDATA[<p>Migrating tens of terabytes of file data across cloud providers is one of the more daunting tasks a solutions architect can face. When the source filesystem is live — receiving a terabyte of new writes every weekday — and users can write to any folder at any time, the challenge multiplies.</p><p>This blog documents our real-world migration of approximately 30.2TB from AWS FSx (NFS) to GCP Filestore, using AWS DataSync as the primary transfer engine and Megaport for dedicated cross-cloud connectivity. We’ll cover the architectural decisions, the gotchas we encountered, and the pattern-based parallelization strategy that made it work.</p><p><strong>The Challenge: Why This Migration Was Hard</strong></p><p>On paper, the requirement sounds straightforward: move files from one NFS filesystem to another. In practice, several factors made this one of the more complex migrations we’ve tackled:</p><ol><li><strong>Live, continuous writes: </strong>The source FSx filesystem receives approximately 1TB of new data every weekday. Saturdays and Sundays are quiet, but that’s a narrow window.</li><li><strong>Unpredictable folder structure: </strong>Folders are created using MongoDB Timestamp patterns, which are not sequential by calendar date. There is no consistent naming convention across months, days, or years.</li><li><strong>Writes to old folders: </strong>Customers can read from and write to any folder at any time, including folders that are years old. This means you cannot simply sync “recent” folders and ignore the rest.</li><li><strong>Unreliable cleanup: </strong>A MongoDB-driven query is supposed to purge files older than 30 days, but this cleanup is inconsistent. Some data from the past 4–5 years still exists, and the folders themselves are never deleted.</li><li><strong>Scale: </strong>30.2TB is large enough that a full filesystem scan becomes expensive in time and compute, but small enough that exotic solutions (like physical appliance transfers) aren’t justified.</li></ol><blockquote><strong>Key Insight</strong></blockquote><blockquote>The fundamental tension in this migration: AWS DataSync’s incremental sync mode does a full scan of the source to detect changes, which becomes prohibitively slow at 30TB. But you need incremental syncs because the data is always changing.</blockquote><p>The solution? <strong>Break the problem into thousands of smaller, targeted tasks.</strong></p><p><strong>Architecture Decisions</strong></p><p><strong>Megaport: The Cross-Cloud Link</strong></p><p>The first critical decision was network connectivity. Transferring 30TB over the public internet would be slow, unreliable, and expensive (AWS egress charges alone would be significant). We provisioned a 1Gbps Megaport link between AWS and GCP. This gave us:</p><ul><li>Consistent, predictable bandwidth — no contention with public internet traffic</li><li>Lower latency between the two cloud environments</li><li>Reduced egress costs compared to raw internet transfer</li><li>A stable pipe that could sustain the daily 72,000+ task schedule</li></ul><p>At a theoretical 1Gbps, the maximum throughput is approximately 10.8TB per day. In practice, factoring in protocol overhead and DataSync’s scan time, we observed 4–6TB per day of effective transfer — comfortably ahead of the 1TB daily write rate.</p><p><strong>AWS DataSync: The Transfer Engine</strong></p><p>We chose AWS DataSync as the transfer tool for several reasons. It has native support for AWS FSx as a source location and can connect to any NFS endpoint (including GCP Filestore) as a destination. It provides built-in data integrity verification with checksum validation on every transfer. It supports include/exclude filters that let you target specific paths or file patterns. It has scheduling capabilities for recurring tasks, and it offers a multi-agent architecture that allows parallel execution.</p><p>The key advantage over alternatives like rsync or rclone was operational: DataSync is a managed service with built-in monitoring, retry logic, and integration with CloudWatch for alerting. At 72,000+ tasks, we needed that operational maturity.</p><h4><strong>The Migration Strategy: Three Phases</strong></h4><p><strong>Phase 1: Bulk Transfer with File Size Filters</strong></p><p>We started by transferring the largest files first. Using DataSync’s filter capabilities, we created tasks that targeted files above a certain size threshold. This allowed us to move approximately 10TB in the initial phase with relatively few tasks. Large files transfer efficiently because the per-file overhead (metadata lookup, checksum computation, connection setup) is amortized over more data. This gave us the best “bytes moved per task” ratio.</p><p>Why big files first?</p><p>If you have 10TB spread across 100 large files versus 10TB across 10 million small files, the large-file transfer completes orders of magnitude faster. You get the most data migrated with the least operational overhead. This reduces the remaining delta that subsequent phases need to handle.</p><p><strong>Phase 2: Pattern-Based Parallelization (Category A)</strong></p><p>After the initial bulk transfer, we faced the remaining ~20TB of smaller files spread across an unpredictable folder structure. A single DataSync incremental sync task scanning the entire 30TB filesystem was too slow — the scan phase alone would consume most of the available time window<strong>.</strong></p><p>Our solution was to decompose the problem into 71,667 individual DataSync tasks, each targeting a specific folder pattern. Since folders follow MongoDB Timestamp patterns, we could enumerate all known folder paths and create a targeted task for each one.</p><p>We distributed these tasks across 4 DataSync agents to maximize parallelism. Each agent handles a portion of the task queue, allowing us to run thousands of small, focused syncs concurrently rather than one massive scan.</p><blockquote><strong>How we structured the DataSync tasks:</strong></blockquote><blockquote>Each folder on FSx follows the path /documents/{MongoDB ObjectID}/, where the ObjectID is a 24-character hex string like 5f89b117082fd3f13aaae312. Since these IDs have no calendar-based pattern, we enumerated all 71,667 known folder paths and batched them into DataSync tasks using the SIMPLE_PATTERN filter with the pipe | delimiter. Here&#39;s a sanitized example of the CLI command:</blockquote><blockquote>aws datasync create-task \<br> --source-location-arn &#39;arn:aws:datasync:&lt;region&gt;:&lt;account&gt;:location/loc-xxxxx&#39; \<br> --destination-location-arn &#39;arn:aws:datasync:&lt;region&gt;:&lt;account&gt;:location/loc-yyyyy&#39; \<br> --cloud-watch-log-group-arn &#39;arn:aws:logs:&lt;region&gt;:&lt;account&gt;:log-group:/aws/datasync&#39; \<br> --includes &#39;FilterType=SIMPLE_PATTERN,Value=/documents/5f89a31acc9911d186513c6c/|/documents/5f89b116bb2195a519aae319/|/documents/5f89b117082fd3f13aaae312/&#39;</blockquote><blockquote>By batching multiple folder paths into a single task’s filter, we reduced the total number of DataSync tasks from 71,667 (one per folder) to a manageable set distributed across our 4 agents. This batching was critical — without it, we would have hit AWS DataSync service quotas and created unnecessary API overhead.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tqSixpzSLOpC6JnYwsbaPQ.png" /></figure><p><strong>Phase 3: Category B — Recent 30-Day Folders</strong></p><p>Concurrently with the Category A pattern-based tasks, we ran a separate set of tasks targeting the most recently active folders — roughly the 30-day window of data that the cleanup process is supposed to manage. These folders have the highest churn rate, with the most frequent reads and writes. Running them as a separate category ensures that the hottest data stays in sync even while the historical backlog is being processed.</p><p>This dual-track approach — Category A for the full historical dataset and Category B for the active window — ensures that by the time we reach cutover, both old and new data are consistent across both filesystems.</p><p><strong>Handling the Hard Parts</strong></p><p>The MongoDB Timestamp Folder Problem</p><p>MongoDB ObjectID timestamps are not human-readable calendar dates. The pattern encodes a Unix timestamp in the first 4 bytes of the ObjectID, but the resulting folder names don’t follow any obvious chronological ordering when listed in a directory. This meant we couldn’t simply glob patterns like /2024/*/* to capture a year’s worth of data.</p><p>Instead, we had to enumerate every known folder path from the filesystem, map each to a DataSync filter pattern, and create individual tasks. The result was the 71,667 tasks mentioned earlier. While this is a large number of tasks to manage, it gave us surgical precision — each task knows exactly where to look and doesn’t waste time scanning irrelevant directories.</p><p><strong>Writes to Old Folders</strong></p><p>Perhaps the most challenging aspect of this migration is that users can write new files into folders that are years old. A customer might create a file in a folder timestamped from 2022 at any moment. This means no folder can ever be considered “done” until the final cutover.</p><p>Our mitigation was the daily scheduled execution of all 72,000+ tasks. By running every pattern daily, we catch any stray writes to old folders within a 24-hour window. The weekend pause in writes (no Saturday/Sunday activity) gives us a natural validation window.</p><p><strong>Lessons Learned</strong></p><ol><li><strong>Invest in dedicated connectivity early. </strong>The Megaport link paid for itself in reliability and predictability. Trying to push 30TB over the public internet while maintaining daily syncs would have been painful.</li><li><strong>Start with the biggest files. </strong>The size-filtered initial transfer moved the most data with the least effort. It’s a simple optimization that dramatically reduces the remaining work.</li><li><strong>Don’t fight the full scan — avoid it. </strong>Rather than waiting for DataSync’s incremental mode to scan 30TB, we broke the problem into thousands of targeted tasks. The overhead of managing 72,000 tasks is far less than the overhead of scanning 30TB to find 1TB of changes.</li><li><strong>Parallelize with multiple agents. </strong>Distributing tasks across 4 DataSync agents transformed what would be a sequential bottleneck into a parallel pipeline. The transfer rates improved significantly.</li><li><strong>Track everything. </strong>With 72,000+ tasks running daily, a tracking spreadsheet and automated monitoring are essential. Failed tasks need to be caught and retried promptly. CloudWatch dashboards and alerts made this manageable.</li><li><strong>Plan for unreliable cleanup. </strong>If a purge process is supposed to keep your dataset at a certain size, verify that it works before relying on it in your migration plan. We budgeted for the full historical dataset and it was the right call.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eglsIeGbJnFz568pkKerBA.png" /></figure><p><strong>Cutover Strategy</strong></p><p>With daily syncs running and both Category A and Category B tasks keeping the destination current, the cutover plan leverages the natural weekend pause:</p><ol><li><strong>Friday evening: </strong>Halt all application writes to the source FSx filesystem.</li><li><strong>Friday night: </strong>Execute a final run of all 72,000+ DataSync tasks to capture the last delta.</li><li><strong>Saturday: </strong>Run validation — compare file counts and total sizes between source and destination for each category.</li><li><strong>Sunday: </strong>Update all application configurations to point to GCP Filestore.</li><li><strong>Monday morning: </strong>Applications go live against Filestore. Keep the source FSx in read-only mode for 1–2 weeks as a rollback option.</li></ol><p><strong>Conclusion</strong></p><p>Cross-cloud file migrations at this scale are never simple, especially when the data is live and the folder structure is unpredictable. The combination of a dedicated Megaport interconnect, AWS DataSync’s native FSx-to-NFS capability, and a pattern-based parallelization strategy across multiple agents gave us the throughput and precision we needed.</p><p>The key takeaway: when a managed tool’s default mode (full filesystem scan) doesn’t scale to your dataset, don’t abandon the tool — decompose the problem. 71K small or come up with more patterns , targeted tasks running across 4, 5 agents turned an impossible full-scan bottleneck into a tractable parallel pipeline.</p><p>If you’re facing a similar cross-cloud NFS migration, the pattern described here — bulk transfer by size, then parallel targeted syncs by path, with dedicated connectivity — is a proven approach that balances speed, reliability.</p><p>References :<br><a href="https://www.megaport.com/">https://www.megaport.com/</a></p><p><a href="https://cloud.google.com/filestore?hl=en">https://cloud.google.com/filestore?hl=en</a></p><p>Have questions about your own cross-cloud migration? Let’s connect.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76b8a223bf0d" width="1" height="1" alt=""><hr><p><a href="https://blog.thecloudside.com/migrating-30-tb-from-aws-fsx-nfs-to-gcp-filestore-using-aws-datasync-76b8a223bf0d">Migrating 30+TB from AWS FSx-NFS
to GCP Filestore Using AWS DataSync</a> was originally published in <a href="https://blog.thecloudside.com/">The Cloudside View</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up Tableau Server on GCP (Linux) with Automated Backups — A Complete Guide]]></title>
            <link>https://blog.thecloudside.com/setting-up-tableau-server-on-gcp-linux-with-automated-backups-a-complete-guide-3c31ceccd0db?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c31ceccd0db</guid>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 11:03:11 GMT</pubDate>
            <atom:updated>2026-03-09T11:03:11.303Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re looking to host Tableau Server on Google Cloud Platform, you’re making a solid choice. GCP gives you the flexibility to right-size your infrastructure, and running Tableau on Linux keeps licensing costs down compared to Windows. In this post, I’ll walk you through the entire setup — from provisioning the VM to automating daily backups to Google Cloud Storage.</p><h4>What We’re Building</h4><p>By the end of this guide, you’ll have a fully functional Tableau Server running on an Ubuntu VM in GCP, with automated daily backups for both log archives and server data pushed to a GCS bucket. Here’s the high-level architecture:</p><ul><li><strong>Compute</strong>: A single GCP VM running Ubuntu 18 LTS</li><li><strong>Storage</strong>: 1 TB persistent disk for Tableau data</li><li><strong>Backup</strong>: A GCS bucket (backup-tableau-data) storing daily log archives and data snapshots</li><li><strong>Scheduling</strong>: A cron job running at 1:00 AM daily to handle all maintenance tasks</li></ul><h3>Step 1: Provision the GCP Infrastructure</h3><p>Start by creating a VM in the GCP Console (or via gcloud CLI) with the following specs:</p><p>SettingValueMachine Typen2-custom-12-67584 (12 vCPUs, 66 GB RAM)OSUbuntu 18.04 LTSBoot Disk1 TB Standard Persistent DiskNetworkingAssign a static external IP</p><p>Tableau Server is memory-hungry, so don’t skimp on RAM. The 66 GB configuration above comfortably handles a mid-size deployment with multiple concurrent users. Make sure your firewall rules allow inbound traffic on ports <strong>443</strong> (Tableau Portal) and <strong>8850</strong> (TSM Admin).</p><blockquote><strong><em>Tip</em></strong><em>: Set up a DNS record (e.g., </em><em>tableau.yourdomain.com) pointing to your static IP early — you&#39;ll need it for SSL configuration later.</em></blockquote><h3>Step 2: Install Tableau Server</h3><p>SSH into your VM and download the Tableau Server installer. We’re using version 2022.1.10 in this example.</p><pre># Install the dependency manager<br>sudo apt-get update<br>sudo apt-get -y install gdebi-core<br><br># Install Tableau Server<br>sudo gdebi -n tableau-server-2025.3.2_amd64.deb</pre><p>The gdebi tool automatically handles dependency resolution, so you don&#39;t need to chase down missing libraries manually.</p><h3>Initialize Tableau Services Manager (TSM)</h3><p>Run the initialization script as a <strong>non-root</strong> user:</p><pre>sudo /opt/tableau/tableau_server/packages/scripts.&lt;version&gt;/initialize-tsm --accepteula</pre><blockquote><strong><em>Note</em></strong><em>: Replace </em><em>&lt;version&gt; with the actual build number from your installation. You can find it by listing the contents of </em><em>/opt/tableau/tableau_server/packages/ and looking for the </em><em>scripts.* directory.</em></blockquote><p>This sets up TSM, which is the administration backend for Tableau Server. Once initialized, you’ll be able to manage the server through both CLI and the web-based TSM admin portal.</p><h3>Step 3: Create Admin Users and Activate the License</h3><p>Create the OS-Level Admin UserCreate the OS-Level Admin User</p><pre>sudo useradd tableau_admin<br>sudo passwd tableau_admin</pre><h3>Add the User to the TSM Admin Group</h3><pre>sudo usermod -G tsmadmin -a tableau_admin</pre><h3>Activate Your License</h3><p>Log into the TSM Admin Portal at https://&lt;your-ip&gt;:8850, enter your Tableau license key, and activate the server. This step links your installation to your Tableau subscription.</p><p>Set Up the Initial Tableau Portal Admin</p><pre>tabcmd initialuser --server http://localhost --username &#39;tableau_admin&#39;</pre><p>You’ll be prompted for a password — this becomes the login credential for the Tableau web portal. Once complete, you should see a success message confirming the session was created.</p><h3>Verify Access</h3><p>Open your browser and navigate to:</p><ul><li><strong>TSM Admin Panel</strong>: <a href="https://your-domain:8850/">https://your-domain:8850</a></li><li><strong>Tableau Portal</strong>: <a href="https://your-domain/#/home">https://your-domain/#/home</a></li></ul><p>Log in with the tableau_admin credentials you just configured. If everything is working, you&#39;ll land on the Tableau home page.</p><h3>Step 4: Set Up Automated Backups to GCS</h3><p>This is where things get interesting. We’ll create a single shell script that handles three tasks every night: archiving logs, backing up server data, and pushing both to a GCS bucket.</p><p>Create the GCS Bucket</p><pre>gsutil mb gs://backup-tableau-data</pre><p>Make sure the VM’s service account has <strong>Storage Object Admin</strong> permission on this bucket.</p><h3>The Backup Script</h3><p>Create the file at /opt/tableau-backup.sh:</p><pre>#!/bin/bash<br><br># ============================================<br># Tableau Server Backup Script<br># Runs daily via cron at 1:00 AM<br># ============================================<br><br>BUCKET_NAME=backup-tableau-data<br>BDATE=$(date +%Y-%m-%d)<br>TABLEAU_BACKUP=${BDATE}_tableau_server_logs<br># NOTE: Replace &lt;version&gt; below with your actual build number.<br># Find it via: ls /opt/tableau/tableau_server/packages/ | grep customer-bin<br>TSM_BIN=/opt/tableau/tableau_server/packages/customer-bin.&lt;version&gt;<br>ARCHIVE_PATH=/var/opt/tableau/tableau_server/data/tabsvc/files/log-archives<br>BACKUP_PATH=/var/opt/tableau/tableau_server/data/tabsvc/files/backups<br><br>echo &quot;$(date): ##### Maintenance Started #####&quot;<br><br># --- 1. Generate and upload log archive ---<br>echo &quot;Generating log archive...&quot;<br>$TSM_BIN/tsm maintenance ziplogs -l -f $TABLEAU_BACKUP<br><br>echo &quot;Uploading log archive to GCS...&quot;<br>/snap/bin/gsutil cp $ARCHIVE_PATH/$TABLEAU_BACKUP.zip \<br>  gs://$BUCKET_NAME/archive-logs/<br><br># --- 2. Cleanup old logs (keeps server running) ---<br>echo &quot;Running log cleanup...&quot;<br>$TSM_BIN/tsm maintenance cleanup -l --log-files-retention 2<br><br>echo &quot;Deleting local archives older than 3 days...&quot;<br>find $ARCHIVE_PATH -name &#39;*.zip&#39; -type f -mtime +3 -delete<br><br># --- 3. Create and upload data backup ---<br>echo &quot;Creating data backup...&quot;<br>$TSM_BIN/tsm maintenance backup -f backup-file -d<br><br>echo &quot;Uploading data backup to GCS...&quot;<br>/snap/bin/gsutil cp $BACKUP_PATH/backup-file-$BDATE.tsbak \<br>  gs://$BUCKET_NAME/data-backup/<br><br>echo &quot;$(date): ##### Maintenance Completed #####&quot;</pre><h3>What the Script Does</h3><p>The script performs three operations in sequence. First, it runs tsm maintenance ziplogs to package all current server logs into a dated ZIP archive, then pushes that archive to the archive-logs/ folder in your GCS bucket. Next, it runs tsm maintenance cleanup to remove log files older than 2 days from the local disk — importantly, this runs without stopping the server. Finally, it creates a full data backup (.tsbak file) using tsm maintenance backup and uploads it to the data-backup/ folder in GCS.</p><p>Local archives older than 3 days are automatically deleted to prevent disk space issues.</p><h3>GCS Bucket Structure</h3><p>After a few days, your bucket will look like this:</p><pre>backup-tableau-data/<br>├── archive-logs/<br>│   ├── 2026-03-06_tableau_server_logs.zip<br>│   ├── 2026-03-07_tableau_server_logs.zip<br>│   └── 2026-03-08_tableau_server_logs.zip<br>└── data-backup/<br>    ├── backup-file-2026-03-06.tsbak<br>    ├── backup-file-2026-03-07.tsbak<br>    └── backup-file-2026-03-08.tsbak</pre><p><strong><em>Pro Tip</em></strong><em>: Set up a GCS lifecycle policy to automatically delete backups older than 30 days. This keeps storage costs in check without manual intervention.</em></p><h3>Make It Executable and Schedule It</h3><pre># Set permissions<br>sudo chmod +x /opt/tableau-backup.sh</pre><pre># Add to crontab (runs daily at 1:00 AM)<br>crontab -e<br># Add this line:<br>0 1 * * * /opt/tableau-backup.sh &gt;&gt; /var/log/tableau-backup.log 2&gt;&amp;1</pre><p>If your projects or content aren’t visible in the dashboard after the upgrade, rebuild the search index:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FtegogWi2v1YPWvAr-lo4g.png" /><figcaption>command summary</figcaption></figure><h4>Final Thoughts</h4><p>Running Tableau Server on GCP gives you a reliable, scalable analytics platform without the overhead of managing physical hardware. The key takeaways from this setup:</p><ul><li><strong>Right-size your VM</strong> — Tableau needs generous RAM (64 GB+) for smooth performance with concurrent users.</li><li><strong>Automate everything</strong> — The daily backup script ensures you always have a recovery point, and pushing to GCS means your backups survive even if the VM goes down.</li><li><strong>Monitor your disk</strong> — The cleanup routines in the backup script are essential. Without them, log files can quietly fill your 1 TB disk over a few months.</li><li><strong>Test your backups</strong> — Periodically restore a .tsbak file to a test environment to make sure your backups are actually usable.</li></ul><p>Have questions or run into issues? Drop a comment below, and I’ll do my best to help.</p><p>We’ll cover Tableau Server upgrades — including version migration and search reindexing — in Part 2.</p><p><em>References: </em><a href="https://help.tableau.com/current/server/en-us/cli_maintenance_tsm.htm"><em>Tableau TSM CLI Documentation</em></a><em>, </em><a href="https://help.tableau.com/current/server-linux/en-us/db_backup.htm"><em>Tableau Backup Guide (Linux)</em></a><em>, </em><a href="https://help.tableau.com/current/server-linux/en-us/server-upgrade-baseline-singlenode-setup.htm"><em>Tableau Upgrade Guide (Linux)</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c31ceccd0db" width="1" height="1" alt=""><hr><p><a href="https://blog.thecloudside.com/setting-up-tableau-server-on-gcp-linux-with-automated-backups-a-complete-guide-3c31ceccd0db">Setting Up Tableau Server on GCP (Linux) with Automated Backups — A Complete Guide</a> was originally published in <a href="https://blog.thecloudside.com/">The Cloudside View</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securing AI Workloads on GKE: OPA Gatekeeper + gVisor Sandbox]]></title>
            <link>https://medium.com/thoughtpillars-cloud/securing-ai-workloads-on-gke-opa-gatekeeper-gvisor-sandbox-c7d6d0d4d3eb?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7d6d0d4d3eb</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[opas]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[gke]]></category>
            <category><![CDATA[gatekeepers]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 08:11:11 GMT</pubDate>
            <atom:updated>2026-03-09T09:28:21.080Z</atom:updated>
            <content:encoded><![CDATA[<p>Your GKE cluster is one kubectl apply away from a supply-chain compromise or a runaway GPU bill. Here is a policy-as-code approach to Kubernetes AI governance that prevents both—tested on a live GKE cluster with real deny/allow results. Here’s why standard Kubernetes policies aren’t enough for AI workloads:</p><ul><li><strong>Model Supply-Chain Attacks:</strong> Pulling a “fine-tuned LLaMA” from an unverified repo is risky. Model images contain binary weights that are nearly impossible to inspect for embedded malicious code.</li><li><strong>GPU Cost Explosions:</strong> A single inference pod requesting 8 GPUs without limits can trigger the autoscaler to spin up nodes costing $80/hour.</li><li><strong>Static Credential Exposure:</strong> Mounting GCP JSON keys as Secrets is “faster,” but those keys never rotate and are one compromised pod away from full project access.</li></ul><h3>Architecture Overview</h3><p>Here’s the layered defense model we’ll talk about</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fhoBHt1VMmqsbiE6Ql9Yxw.png" /></figure><h3><strong>Step 1: Set Up GKE with a gVisor Sandbox Node Pool</strong></h3><p>gVisor is a lightweight container sandbox that intercepts system calls. This is critical for <strong>AI Agents</strong> that execute arbitrary code (LangChain tools, code interpreters)</p><h4>Create the Secure Node Pool</h4><p>When adding the node pool, ensure <strong>GKE Sandbox</strong> is enabled. This applies a specific taint to the nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bi96XMKdky94o7gASyoD0g.png" /><figcaption>node configuration</figcaption></figure><p>Post creation of the node verify the taint that prevents regular pods from accidentally scheduling here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*aSuJQhdJ53r3Oal2mHZWRg.png" /><figcaption>gVisor Node Taint</figcaption></figure><pre>kubectl get nodes<br>NAME                                           STATUS   ROLES    AGE   VERSION<br>gke-secureai-default-node-pool-4116f322-v4h3   Ready    &lt;none&gt;   3m    v1.34.3-gke.1444000<br><br>Check for gVisor-enabled nodes:<br><br>kubectl get nodes -l sandbox.gke.io/runtime=gvisor<br>NAME                                     STATUS   ROLES    AGE   VERSION<br>gke-secureai-secure-pool-933f858b-ztx7   Ready    &lt;none&gt;   5m    v1.34.3-gke.1444000</pre><p>Verify the taint that prevents regular pods from accidentally scheduling here:</p><pre>kubectl describe nodes -l sandbox.gke.io/runtime=gvisor | grep -A3 Taints<br>Taints: sandbox.gke.io/runtime=gvisor:NoSchedule</pre><p><strong>Key point:</strong> The NoSchedule taint means only pods that explicitly tolerate gVisor will land on these nodes. This keeps your sandbox pool dedicated to high-risk workloads.</p><h3>Step 2: Install OPA Gatekeeper</h3><p>Gatekeeper uses <strong>Rego</strong> to define what is allowed in your cluster.</p><pre>kubectl apply -f https://raw.githubusercontent.com/open-policy-agent/gatekeeper/v3.15.0/deploy/gatekeeper.yaml</pre><p>Create Namespaces for Workload Separation</p><pre>kubectl create namespace ml-inference<br>kubectl create namespace ai-agents<br>kubectl create namespace ml-training</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-gX75RMSTqT_I4h0sW4Yg.png" /></figure><p><em>Note: This POC uses open-source OPA Gatekeeper. For production, GKE Enterprise’s managed Policy Controller provides the same constraint engine with a built-in dashboard, SCC integration, and fleet-wide governance. The constraint YAML files work identically on both.</em></p><h3>Step 3: Policy 1 — Restrict Container Registries</h3><p>This blocks pods from pulling untrusted AI models.</p><pre># constraint-template-allowed-registries.yaml<br>apiVersion: templates.gatekeeper.sh/v1<br>kind: ConstraintTemplate<br>metadata:<br>  name: k8sallowedregistries<br>spec:<br>  crd:<br>    spec:<br>      names:<br>        kind: K8sAllowedRegistries<br>      validation:<br>        openAPIV3Schema:<br>          type: object<br>          properties:<br>            allowedRegistries:<br>              type: array<br>              items:<br>                type: string<br>  targets:<br>    - target: admission.k8s.gatekeeper.sh<br>      rego: |<br>        package k8sallowedregistries<br><br>        violation[{&quot;msg&quot;: msg}] {<br>          container := input_containers[_]<br>          satisfied := [good |<br>            repo = input.parameters.allowedRegistries[_]<br>            good = startswith(container.image, repo)<br>          ]<br>          not any(satisfied)<br>          msg := sprintf(<br>            &quot;Image &#39;%v&#39; is not from an approved registry. Allowed: %v&quot;,<br>            [container.image, input.parameters.allowedRegistries]<br>          )<br>        }<br><br>        input_containers[c] { c := input.review.object.spec.containers[_] }<br>        input_containers[c] { c := input.review.object.spec.initContainers[_] }</pre><p><strong>How the above logic works :</strong></p><ul><li>For every container (including init containers) in the pod spec</li><li>Check if the image name starts with any of the allowed registry prefixes.</li><li>If none match → block the pod and show an error message.</li></ul><p>Apply the Constraint<br>The constraint tells Gatekeeper where and what to enforce:</p><pre># constraint-restrict-ai-registries.yaml<br>apiVersion: constraints.gatekeeper.sh/v1beta1<br>kind: K8sAllowedRegistries<br>metadata:<br>  name: restrict-ai-registries<br>spec:<br>  enforcementAction: deny<br>  match:<br>    kinds:<br>      - apiGroups: [&quot;&quot;]<br>        kinds: [&quot;Pod&quot;]<br>    namespaces:<br>      - &quot;ai-agents&quot;<br>      - &quot;ml-inference&quot;<br>      - &quot;ml-training&quot;<br>  parameters:<br>    allowedRegistries:<br>      - &quot;us-docker.pkg.dev/&quot;<br>      - &quot;gcr.io/deeplearning-platform-release/&quot;<br>      - &quot;nvcr.io/&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*aH22vpCFw6gcAhchwDT5mA.png" /><figcaption>Allowed DockerImages</figcaption></figure><h3>Review It</h3><p><strong>Attempt a blocked image:</strong></p><p>Now, If I run it will cause deny</p><pre>kubectl run test-fail-registry --image=nginx:latest -n ai-agents<br><br><br>Error from server (Forbidden): admission webhook &quot;validation.gatekeeper.sh&quot; denied the request: [restrict-ai-registries] Image &#39;nginx:latest&#39; is not from an approved registry. Allowed: [&quot;us-docker.pkg.dev/&quot;, &quot;gcr.io/deeplearning-platform-release/&quot;, &quot;nvcr.io/&quot;]</pre><pre>% kubectl run test-pass \<br>  --image=us-docker.pkg.dev/my-project/ai-models/llama-serve:v2.1 \<br>  -n ai-agents<br>pod/test-pass created</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LmnzuxbQ9YqhpH6WR45o1Q.png" /></figure><p>Check Policy Controller (Gatekeeper)</p><pre>kubectl get constraints<br>kubectl get constrainttemplates<br>NAME                     ENFORCEMENT-ACTION   TOTAL-VIOLATIONS<br>restrict-ai-registries   deny                 0<br>NAME                   AGE<br>k8sallowedregistries   44h</pre><h3>Step 4: Policy 2 — Enforce GPU Resource Limits</h3><h4>The Threat</h4><p>Without resource limits, a single nvidia.com/gpu: 2request triggers the cluster autoscaler to provision expensive GPU nodes.</p><pre># constraint-template-gpu-limits.yaml<br>apiVersion: templates.gatekeeper.sh/v1<br>kind: ConstraintTemplate<br>metadata:<br>  name: k8sgpulimits<br>spec:<br>  crd:<br>    spec:<br>      names:<br>        kind: K8sGPULimits<br>      validation:<br>        openAPIV3Schema:<br>          type: object<br>          properties:<br>            maxGPUs:<br>              type: integer<br>              description: &quot;Maximum number of GPUs a single pod can request&quot;<br>  targets:<br>    - target: admission.k8s.gatekeeper.sh<br>      rego: |<br>        package k8sgpulimits<br><br>        violation[{&quot;msg&quot;: msg}] {<br>          container := input.review.object.spec.containers[_]<br>          gpu_request := container.resources.requests[&quot;nvidia.com/gpu&quot;]<br>          to_number(gpu_request) &gt; input.parameters.maxGPUs<br>          msg := sprintf(<br>            &quot;Container &#39;%v&#39; requests %v GPUs, which exceeds the limit of %v.&quot;,<br>            [container.name, gpu_request, input.parameters.maxGPUs]<br>          )<br>        }<br><br>        # Also block pods with GPU limits but no requests (sneaky workaround)<br>        violation[{&quot;msg&quot;: msg}] {<br>          container := input.review.object.spec.containers[_]<br>          gpu_limit := container.resources.limits[&quot;nvidia.com/gpu&quot;]<br>          not container.resources.requests[&quot;nvidia.com/gpu&quot;]<br>          msg := sprintf(<br>            &quot;Container &#39;%v&#39; sets GPU limits without requests. Define explicit requests.&quot;,<br>            [container.name]<br>          )<br>        }</pre><p><strong>Apply the constraint:</strong></p><pre># constraint-gpu-limits.yaml<br>apiVersion: constraints.gatekeeper.sh/v1beta1<br>kind: K8sGPULimits<br>metadata:<br>  name: limit-gpu-per-pod<br>spec:<br>  enforcementAction: deny<br>  match:<br>    kinds:<br>      - apiGroups: [&quot;&quot;]<br>        kinds: [&quot;Pod&quot;]<br>    namespaces:<br>      - &quot;ml-inference&quot;<br>      - &quot;ai-agents&quot;<br>      - &quot;ml-training&quot;<br>  parameters:<br>    maxGPUs: 1</pre><h3>Test It</h3><p><strong>Attempt to request too many GPUs:</strong></p><pre>cat &lt;&lt;EOF | kubectl apply -n ml-inference -f -<br>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: greedy-inference<br>spec:<br>  containers:<br>  - name: model<br>    image: us-docker.pkg.dev/my-project/ai-models/llama-serve:v2.1<br>    resources:<br>      requests:<br>        nvidia.com/gpu: 4<br>      limits:<br>        nvidia.com/gpu: 4<br>EOF<br><br>Error from server (Forbidden): error when creating &quot;STDIN&quot;: admission webhook &quot;validation.gatekeeper.sh&quot; denied the request: [limit-gpu-per-pod] Container &#39;model&#39; requests 4 GPUs, which exceeds the limit of 1.</pre><h3>Step 5: Policy 3 — Block Static Credentials (Enforce Workload Identity)</h3><p>Teams mount GCP service account JSON keys as Kubernetes Secrets because it’s the “quick fix” to access Vertex AI or Cloud Storage. These keys are long-lived, unauditable, and one leaked secret away from full project compromise.</p><h3>Define the Template</h3><p>This policy blocks pods that mount any secret containing known credential key patterns:</p><pre># constraint-template-no-static-creds.yaml<br>apiVersion: templates.gatekeeper.sh/v1<br>kind: ConstraintTemplate<br>metadata:<br>  name: k8snostaticcreds<br>spec:<br>  crd:<br>    spec:<br>      names:<br>        kind: K8sNoStaticCreds<br>      validation:<br>        openAPIV3Schema:<br>          type: object<br>          properties:<br>            blockedSecretPatterns:<br>              type: array<br>              items:<br>                type: string<br>              description: &quot;Secret name patterns to block (substring match)&quot;<br>  targets:<br>    - target: admission.k8s.gatekeeper.sh<br>      rego: |<br>        package k8snostaticcreds<br><br>        violation[{&quot;msg&quot;: msg}] {<br>          volume := input.review.object.spec.volumes[_]<br>          volume.secret<br>          secret_name := volume.secret.secretName<br>          pattern := input.parameters.blockedSecretPatterns[_]<br>          contains(secret_name, pattern)<br>          msg := sprintf(<br>            &quot;Pod mounts secret &#39;%v&#39; which matches blocked pattern &#39;%v&#39;. Use Workload Identity instead of static credentials.&quot;,<br>            [secret_name, pattern]<br>          )<br>        }<br><br>        # Also catch env vars referencing blocked secrets<br>        violation[{&quot;msg&quot;: msg}] {<br>          container := input.review.object.spec.containers[_]<br>          env := container.env[_]<br>          env.valueFrom.secretKeyRef<br>          secret_name := env.valueFrom.secretKeyRef.name<br>          pattern := input.parameters.blockedSecretPatterns[_]<br>          contains(secret_name, pattern)<br>          msg := sprintf(<br>            &quot;Container &#39;%v&#39; references secret &#39;%v&#39; via env var. Use Workload Identity instead.&quot;,<br>            [container.name, secret_name]<br>          )<br>        }</pre><p>Apply the Constraint</p><pre># constraint-no-static-creds.yaml<br>apiVersion: constraints.gatekeeper.sh/v1beta1<br>kind: K8sNoStaticCreds<br>metadata:<br>  name: block-static-gcp-creds<br>spec:<br>  enforcementAction: deny<br>  match:<br>    kinds:<br>      - apiGroups: [&quot;&quot;]<br>        kinds: [&quot;Pod&quot;]<br>    namespaces:<br>      - &quot;ai-agents&quot;<br>      - &quot;ml-inference&quot;<br>      - &quot;ml-training&quot;<br>  parameters:<br>    blockedSecretPatterns:<br>      - &quot;sa-key&quot;<br>      - &quot;service-account&quot;<br>      - &quot;gcp-credentials&quot;<br>      - &quot;google-credentials&quot;</pre><h3>Test It</h3><p><strong>Attempt to mount a service account key:</strong></p><pre>kubectl create secret generic gcp-credentials-vertex \<br>  --from-literal=key.json=&#39;{&quot;type&quot;:&quot;service_account&quot;}&#39; \<br>  -n ai-agents<br><br>cat &lt;&lt;EOF | kubectl apply -n ai-agents -f -<br>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: bad-creds-pod<br>spec:<br>  containers:<br>  - name: model<br>    image: us-docker.pkg.dev/my-project/ai-models/llama-serve:v2.1<br>  volumes:<br>  - name: creds<br>    secret:<br>      secretName: gcp-credentials-vertex<br>EOF</pre><pre>Error from server (Forbidden): error when creating &quot;STDIN&quot;: <br>admission webhook &quot;validation.gatekeeper.sh&quot; denied the request: <br>[block-static-gcp-creds] Pod mounts secret &#39;gcp-credentials-vertex&#39; <br>which matches blocked pattern &#39;gcp-credentials&#39;. <br>Use Workload Identity instead of static credentials.</pre><p>The right way — Workload Identity (no secrets needed):</p><p>Create Service Account</p><pre># Enable Workload Identity on cluster<br>gcloud container clusters update CLUSTER_NAME \<br>  --workload-pool=${PROJECT_ID}.svc.id.goog<br><br># Create Kubernetes Service Account<br>kubectl create serviceaccount vertex-ai-sa -n ai-agents<br><br># Create GCP Service Account<br>gcloud iam service-accounts create vertex-ai-sa<br><br># Bind IAM Role<br>gcloud projects add-iam-policy-binding $PROJECT_ID \<br>  --member=&quot;serviceAccount:vertex-ai-sa@${PROJECT_ID}.iam.gserviceaccount.com&quot; \<br>  --role=&quot;roles/aiplatform.user&quot;<br><br># Allow KSA to impersonate GSA<br>gcloud iam service-accounts add-iam-policy-binding \<br>  vertex-ai-sa@${PROJECT_ID}.iam.gserviceaccount.com \<br>  --member=&quot;serviceAccount:${PROJECT_ID}.svc.id.goog[ai-agents/vertex-ai-sa]&quot; \<br>  --role=&quot;roles/iam.workloadIdentityUser&quot;<br><br># Annotate KSA<br>kubectl annotate serviceaccount vertex-ai-sa \<br>  -n ai-agents \<br>  iam.gke.io/gcp-service-account=vertex-ai-sa@${PROJECT_ID}.iam.gserviceaccount.com</pre><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: good-creds-pod<br>  namespace: ai-agents<br>spec:<br>  serviceAccountName: vertex-ai-sa  # Bound to GCP SA via Workload Identity<br>  containers:<br>  - name: model<br>    image: us-docker.pkg.dev/my-project/ai-models/llama-serve:v2.1</pre><pre>pod/good-creds-pod created</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-j925zCLL0sgTwj_Cz1Aw.png" /></figure><h3>Step 6: Deploy an AI Agent Pod to the gVisor Sandbox</h3><p>This pod runs an AI agent that uses tool execution (high risk), pulls from an approved registry (Policy 1), uses Workload Identity (Policy 3), and runs inside the gVisor sandbox (runtime isolation):</p><pre># sandboxed-agent-pod.yaml<br>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: secure-ai-agent<br>  namespace: ai-agents<br>spec:<br>  runtimeClassName: gvisor<br>  serviceAccountName: vertex-ai-sa<br>  nodeSelector:<br>    sandbox.gke.io/runtime: gvisor<br>  tolerations:<br>  - key: sandbox.gke.io/runtime<br>    operator: Equal<br>    value: gvisor<br>    effect: NoSchedule<br>  containers:<br>  - name: agent<br>    image: us-docker.pkg.dev/my-project/ai-models/react-agent:v1.0<br>    resources:<br>      requests:<br>        cpu: &quot;2&quot;<br>        memory: &quot;2Gi&quot;<br>      limits:<br>        cpu: &quot;2&quot;<br>        memory: &quot;8Gi&quot;<br>        <br>    securityContext:<br>      runAsNonRoot: true<br>      readOnlyRootFilesystem: true<br>      allowPrivilegeEscalation: false</pre><p><strong>What happens when you apply this:</strong></p><ul><li>Gatekeeper checks us-docker.pkg.dev/... → approved registry ✅</li><li>Gatekeeper checks volumes → no blocked secrets ✅</li><li>Kubernetes schedules the pod on the gVisor node pool</li><li>gVisor intercepts all system calls from the agent container</li></ul><p><strong>What’s Next</strong></p><p>This setup gives you a strong baseline. To go further, consider:</p><ul><li><strong>Binary Authorization</strong> — Require cryptographic attestation that every image was built by your CI/CD pipeline before it can run.</li><li><strong>Network Policies</strong> — Restrict which external endpoints AI agents can reach (prevent data exfiltration to unknown IPs).</li><li><strong>Cost Alerts with GKE Usage Metering</strong> — Pair GPU limits with budget alerts so you catch misuse even within policy bounds.</li><li><strong>Audit Mode First</strong> — Before enforcing new policies, set enforcementAction: dryrun to see what <em>would</em> be blocked without breaking existing workloads.</li></ul><p>Found this useful? Happy Reading!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7d6d0d4d3eb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thoughtpillars-cloud/securing-ai-workloads-on-gke-opa-gatekeeper-gvisor-sandbox-c7d6d0d4d3eb">Securing AI Workloads on GKE: OPA Gatekeeper + gVisor Sandbox</a> was originally published in <a href="https://medium.com/thoughtpillars-cloud">ThoughtPillars@Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SFTP using CyberDuck via IAP Tunnel in Google Cloud Platform]]></title>
            <link>https://blog.thecloudside.com/sftp-using-cyberduck-via-iap-tunnel-in-google-cloud-platform-cbb13916b86e?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbb13916b86e</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Wed, 16 Feb 2022 11:44:37 GMT</pubDate>
            <atom:updated>2022-02-16T12:07:25.347Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_3dn1rzUdu-zN6-yK_54CA.png" /></figure><p>We have recently migrated a customer to GCP who wants to use an SFTP solution to manage the files in WordPress Server hosted on GCP.</p><p><strong>Solution: </strong>All the VM’s in the GCP environment are in a secure network and have no connectivity using External IP. IAP is also enabled in the account to allow SSH connection.</p><p>To overcome this, we have come up with a solution using third Party Tool CyberDuck, which gives a UI like a file manager to manage your data.</p><p><strong>Tools Used </strong>:</p><ol><li><a href="https://cyberduck.io/">CyberDuck</a> — Cyberduck is an open-source client for FTP and SFTP, WebDAV, and cloud storage, available for macOS and Windows licensed under the GPL.</li><li>SSH Keys</li></ol><h3>Prerequisites :</h3><ol><li>GCP Console Access</li><li>Required permission to edit VM properties in GCP.</li><li>SSH access to the machine[Optional]</li><li>IAP permissions</li></ol><p><strong>Steps to setup the solution:</strong></p><ol><li>Generate SSH Key in your Windows/Linux machine:</li></ol><p><strong>SSH-Keygen:[Linux]</strong></p><p>Generate an SSH key from your laptop using ssh-keygen: <a href="https://cloud.google.com/compute/docs/connect/create-ssh-keys">https://cloud.google.com/compute/docs/connect/create-ssh-keys</a></p><p><strong>Puttygen</strong>:[<strong>Windows</strong>]</p><p>Generating key using putty</p><p><a href="https://www.ssh.com/academy/ssh/putty/windows/puttygen">https://www.ssh.com/academy/ssh/putty/windows/puttygen</a></p><p>2. Login into your GCP account, navigate to the VM console and add your SSH public key to the instance by clicking on EDIT of the desired VM :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bHXbTE0S5UC21sCM" /><figcaption>GCP VM Console</figcaption></figure><p>3. If you want to access the files with ROOT privileges, then follow this step:</p><p>Login into the VM by clicking on the SSH button it will open an SSH connection in a new browser window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_VATgkGEaGwe--zV" /></figure><p>4. Switch to root user and add insert your pub key into the .ssh/authorized_keys file</p><pre>root@wp-connector:~# cd .ssh/<br>root@wp-connector:~/.ssh# ls<br>-rw - - - - 1 root root 0 Jan 20 03:05 authorized_keys<br>vim authorized_keys &lt; paste your pub key here&gt;</pre><h3><strong>Now we are set to start our IAP tunnel:</strong></h3><pre>gcloud compute start-iap-tunnel - zone &lt;&quot;asia-south1-a&quot;&gt; &lt;&quot;wp-connector&quot;&gt; 22 - local-host-port=localhost:2202 - project &lt;&quot;wp-apps&quot;&gt;</pre><p>*&lt;&gt; — Modify it according to the VM name, zone, and project. Also, you can use a different port for localhost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*14nQ6iuMyZnEuxEb" /><figcaption>Terminal Connection</figcaption></figure><ol><li>Once you get the message Listening on Port[2202], start the Cyberduck application:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/0*qkwEbtKS7rRc3OJy" /></figure><p>2. Click on <strong>OpenConnection</strong> and choose SFTP from the drop-down box. Mention the Port you have used above to initiate the IAP tunnel, and select the SSH Private key generated in the first step.</p><p>Port:2202</p><p><strong>Username</strong>: If you have added the SSH key in the GCP console, you will be able to get the username from the GCP console. In case you have selected the other option with Root Privileges, use <strong>root</strong> as the username.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/0*7UpLZFnw20zW51tN" /><figcaption>CyberDuck UI</figcaption></figure><p>In place of Server address: use <strong>localhost </strong>as we have created a tunnel between the local machine and GCP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/0*ZqXn39wWlcbj5KSU" /></figure><p>3. Once the connection is established, we will be able to view a user&#39;s home directories and we will be able to browse other partitions via the address bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q05yeXYs68GhQ_yD" /></figure><p>Hope this solution helps you with a secure way to connect VM’s using IAP without using External IP also keeping the traffic secure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbb13916b86e" width="1" height="1" alt=""><hr><p><a href="https://blog.thecloudside.com/sftp-using-cyberduck-via-iap-tunnel-in-google-cloud-platform-cbb13916b86e">SFTP using CyberDuck via IAP Tunnel in Google Cloud Platform</a> was originally published in <a href="https://blog.thecloudside.com/">The Cloudside View</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WordPress attacks & Cloud Armor protection on GCP— True story.]]></title>
            <link>https://blog.thecloudside.com/wordpress-attacks-cloud-armor-protection-on-gcp-true-story-59ba25ffb7f8?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/59ba25ffb7f8</guid>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[google-cloud]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Tue, 01 Feb 2022 17:55:56 GMT</pubDate>
            <atom:updated>2022-02-01T17:55:56.257Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wsqduoCb2YE2AxgpyG17Q.png" /><figcaption>A sad 😔, attacked wordpress</figcaption></figure><p>It is well known how prevalent WordPress is on the interweb. Owing to it’s popularity, it is also unfortunately one of the <a href="https://www.bleepingcomputer.com/news/security/massive-attack-against-16-million-wordpress-sites-underway/">most</a> <a href="https://www.wordfence.com/blog/2021/12/massive-wordpress-attack-campaign/">attacked</a> applications too. Just go to Shodan.io, and search for wordpress org:”Google LLC&quot;. Yup, they are all available for “examination” for an enterprising attacker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lIeyTdmwr9x5PkLvUq8NRQ.png" /><figcaption>And these are just Google Cloud alone!</figcaption></figure><p>We recently faced a similar scenario, one of the WordPress sites underwent an attack. This post is our experiences finding, troubleshooting, recovering and implementing preventive measures. Read on.</p><h3>The Incident</h3><ol><li>During one of our migrations, our monitoring systems picked up unusual activity on one of the WordPress sites which went live recently. We noticed that the count of files suddenly spiked in ~/public_html/ folder. Some of the files had weird and innovative names like dud.php 🙄. It was not really a dud, as it turned out.</li><li>Looking at the code in dud.php, we quickly realized that it was backdoor code that is being used for Google bot to non-index all the pages. This turns out to be an SEO attack which is an unethical practiceto sabotage a competitor’s rankings in search engines. Or some script kid’s plain mischief!</li><li>We were not able to change anything in the .htaccess file as it was getting re-written automatically.</li><li>When we searched for the attacked website on Google, we saw some Japanese keywords with hyperlinks</li><li>After sometime, things worsened and Wp-admin portal was not loading with all the themes and plugins.</li><li>Also, we have seen the file owner permissions for <strong>cd ~/public_html/</strong> which we generally assign to apache/nginx[www-data] as per most of the wordpress setup guideline, which is very open and easy for hackers to upload any contents.</li><li>We did a preliminary scan using <a href="https://sitecheck.sucuri.net/">Sucuri</a> (Thank you, Sucuri — for such a useful tool) and realized we were affected by what is popularly known as Japanese Keyword Hack. Google Developers site has a very good article on <a href="https://developers.google.com/web/fundamentals/security/hacked/fixing_the_japanese_keyword_hack">how to fix it</a>. Also, read more about this on <a href="https://blog.sucuri.net/2020/04/japanese-keyword-hack.html">Sucuri’s blog</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HFjzpQ2diIGophbPPF2Kdw.png" /><figcaption>Sample results for an attacked site</figcaption></figure><p>7. If it’s not fixed, it can lead you to get blacklisted by Google, and your SEO will go down.It basically injects your website with spam keywords and pages in order to boost the rankings of other websites.</p><h3>The Recovery</h3><p>We checked all the plugins installed on the server, fortunately there were no changes. We also found out that the site we migrated from on-premise did not have any security plugins installed to safeguard the website from such attacks.</p><ol><li>We started our initial search to find the effect of the ​​malware. We have started tracking the files that got recently changed and confirmed with our customer the time of last new post post our handover to them.</li></ol><pre>find . -mtime -10 -print</pre><p>2. Check your wp-content/uploads directory for files like .php, .js and .ico. If you find such files, check the content for characters like base64_decode, rot13, eval, strrev, gzinflate. These can potentially be be malicious. In our case we have seen base64_decode.</p><p>3. We were using CloudSQL and we quickly scanned the database for any vulnerabilities — whether any new users were created, permissions altered, triggers created etc. We found one new user got created!!</p><pre>SELECT * FROM information_schema.user_privileges;</pre><p>4. We also found that the existing passwords were not so strong and can be <a href="https://nordpass.com/most-common-passwords-list/">predicted</a> or cracked using a dictionary attack. Some of them were most common password</p><p>5. We have <a href="https://www.tecmint.com/install-rootkit-hunter-scan-for-rootkits-backdoors-in-linux/">used</a> rkhunter as well, but since our plugins and content is on an NFS mount, rkhunter will not be able to scan these by default.</p><h4>Backups to the Rescue</h4><p>There are some wordpress plugins which will help recover from situations like these, but unfortunately our wp-admin panel was not loading properly, so we took made use of our backups</p><ol><li>When we handed over the site to the customer, we made sure that all backup schedules, monitoring and alerting is in place. We had a recent <a href="https://blog.thecloudside.com/managing-gcp-filestore-in-production-backups-monitoring-e08ffa09e7f6">backup of Cloud Filestore</a>, CloudSQL</li><li>Using backups, we went back to the day before our not so dud.php file got added</li><li>We were back online in notime, but the real problem was not addressed yet. There was still a chance of getting attacked again.</li></ol><h3>Hardening Wordpress</h3><p><strong>File/Folder Permissions Hardening</strong></p><ul><li>Root public folder — Owner will be Root unless, you have any specific requirement from Plugins to change the permissions</li><li>Wp-admin — This will be Root</li><li>Wp-content — This will be shared with web-hosting, so this can be www-data:www-data</li><li>Wp-includes — Root will be the owner.</li></ul><pre>chown -R www-data:www-data &lt;directory-name&gt;</pre><p>The permissions should look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*6WbuptZSloAaqAmfbBadAQ.png" /></figure><p>The file/folder permissions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*lSd-c0F3UKj1vn9LeFxOSw.png" /></figure><p>Allow initially to www-data to read and connect to the database from wp-config.php, after that change owner to Root. <strong>Never give 777 permission to any of the folders/files</strong>.</p><blockquote>These permissions may need to be changed during the upload of new content to WordPress, depending on the plugins being used. This is also a good reminder to review carefully what kind of plugins you use</blockquote><h4><strong>Disable file editing in WordPress admin</strong></h4><p>Add this at the bottom of your wp-config. php file :</p><pre>define(‘DISALLOW_FILE_EDIT’, true);</pre><h4><strong>Change all the SALT Security Keys</strong></h4><p>Use <a href="https://api.wordpress.org/secret-key/1.1/salt/">this generator</a> and update all the tokens in the wp-config.php file. This will ask to re-login all your users.</p><h4><strong>Update database passwords in wp-config.php</strong></h4><p>Change all the admin passwords as well the connection details in wp-config.php with new passwords. Use a password generator for strong passwords.</p><h3>Implement WAF (Cloud Armor on GCP)</h3><p>You should implement a WAF to protect your wordpress website. Our customer was hosted on Google Cloud, so it made sense for us to use Cloud Armour — the WAF and DDoS mitigation service from GCP.</p><p>CloudArmor comes with pre-configured rules against each of the vulnerabilities which can be tuned according to your use case — <a href="https://cloud.google.com/armor/docs/rule-tuning">https://cloud.google.com/armor/docs/rule-tuning</a></p><p>Our policy snapshot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cDXi2jja7nvMnKL9" /></figure><p>Here are some live attack protection logs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5sQYJd-_7wf9gIbL" /></figure><p>Finally, update all the Wordpress plugins.</p><p><strong>Enable security plugins</strong></p><p>We have also enabled security plugins like wordfence, sucuri to protect the websites against the dynamic threat and vulnerabilities.</p><p>Some of the tools you can use to scan are — Virus Total, Aw-snap.info, Sucuri Site Check, Quttera</p><p>Finally, here is our highly available, scalable, secure and happy Wordpress site 😃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FMX1GOy6KrgUu2PelFimgw.png" /><figcaption>Secure wordpress is happy wordpress 😃</figcaption></figure><p>Hope this helped! I hope you never run into situations like these. Happy Vigilance :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59ba25ffb7f8" width="1" height="1" alt=""><hr><p><a href="https://blog.thecloudside.com/wordpress-attacks-cloud-armor-protection-on-gcp-true-story-59ba25ffb7f8">WordPress attacks &amp; Cloud Armor protection on GCP— True story.</a> was originally published in <a href="https://blog.thecloudside.com/">The Cloudside View</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clustering in Autoscaled environment for web-socket application on AWS]]></title>
            <link>https://medium.com/thoughtpillars-cloud/clustering-in-autoscaled-environment-for-web-socket-application-on-aws-27bbaeef3b62?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/27bbaeef3b62</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[autoscaling]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Thu, 24 May 2018 07:33:59 GMT</pubDate>
            <atom:updated>2019-04-15T11:52:58.902Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog post, we review concepts and architectural patterns relevant to a chat application communicating over the web socket.</p><p><strong>Why do we need to get private IP of the neighbour servers in Auto scaling group?</strong></p><p>As multiple applications manage the client WebSocket connections, the applications must communicate among themselves to redistribute messages, for this purpose they will require the IP’s which are currently active under the autoscaling group.</p><p>Here is the solution we came up with and able to fetch the private IPs of the servers in AWS Autoscaling group.</p><p>Service Required:</p><p>1. Autoscaling group</p><p>2. Cloudwatch Event</p><p>3. Lambda</p><p>4. Redis</p><p>A simple architecture to understand the workflow:</p><p><strong>Autoscaling Group -&gt; CloudWatch Events -&gt; Lambda Function -&gt; Redis</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*5KOuyguM1_uDSUlMdAggbg.png" /><figcaption>AWS Workflow</figcaption></figure><p>Let’s start with the <strong>Lambda function</strong> which will read the auto scaling group from the VPC.(Launch the lambda inside VPC)</p><p>Python code: To add the active autoscaled servers to Redis.</p><pre>import boto3<br>import redis<br>import os</pre><pre>ec2 = boto3.resource(‘ec2’)</pre><pre>def get_instances():<br> client = boto3.client(‘autoscaling’)<br> paginator = client.get_paginator(‘describe_auto_scaling_groups’)<br> groups = paginator.paginate().build_full_result()</pre><pre>for asg in groups[‘AutoScalingGroups’]:<br> #print asg[‘AutoScalingGroupName’]</pre><pre>instance_ids = [i for i in asg[‘Instances’]]<br> #print instance_ids<br> running_instances = ec2.instances.filter(Filters=[{‘Name’:’tag-value’, ‘Values’:[‘test-ASG’]}])<br> for instance in running_instances:<br> print(instance.private_ip_address)</pre><pre>try:<br> conn = redis.StrictRedis(<br> host=’10.10.5.120&#39;,port=6379) //change the IP as per your infra<br> print conn<br> conn.ping()<br> print ‘Connected!’</pre><pre>except Exception as ex:<br> print ‘Error:’, ex<br> exit(‘Failed to connect, terminating.’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SRxZz4VE698SP8bDBJm9Ag.png" /><figcaption>Fetch IP lambda screenshot</figcaption></figure><p>As, deletion is not possible from the Redis, we can use below code for deletion of the inactive servers from Redis key immediately.</p><pre>import boto3<br>import redis<br>import os<br>ec2 = boto3.resource(‘ec2’)<br>def get_instances():<br>client = boto3.client(‘autoscaling’)<br>paginator = client.get_paginator(‘describe_auto_scaling_groups’)<br>groups = paginator.paginate().build_full_result()<br>for asg in groups[‘AutoScalingGroups’]:<br>#print asg[‘AutoScalingGroupName’]<br>instance_ids = [i for i in asg[‘Instances’]]<br>#print instance_ids<br>running_instances = ec2.instances.filter(Filters=[{‘Name’:’tag-value’, ‘Values’:[‘test-ASG’]}])<br>iplist=[]<br>for instance in running_instances:<br>print(instance.private_ip_address)<br>datalist=instance.private_ip_address<br>iplist.append(datalist)<br>print iplist<br>try:<br>conn = redis.StrictRedis(<br>host=’10.10.5.120&#39;,port=6379) //change the redis IP <br>data01=conn.ping()<br>print data01<br>print “Delete”, conn.delete(‘iplist-key’)<br>for i in iplist:<br>print i<br>print “Push:”, conn.rpush(‘iplist-key’, i)<br>except Exception as ex:<br>print ‘Error:’, ex<br>exit(‘Failed to connect, terminating.’)<br>if __name__ == ‘__main__’:<br>get_instances()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QAPvxNehd0GKYQdXJkeTkg.png" /><figcaption>delete IP lambda screenshot</figcaption></figure><p>Attach a <strong>IAM-role</strong> with permissions to read EC2 autoscaling group and write data into CloudWatch, as for our testing I have given below role which is having read only and CloudWatch full access:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*5N1fTy-WdU0HoB6S." /><figcaption>IAM role</figcaption></figure><p>Once Lambda function created next, let’s go to <strong>CloudWatch</strong> event which will trigger for lambda function we have created above.</p><p>Add both the lambda function created above — Update and Delete</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lmPnclo-xsKQi3Utvf-XNA.png" /><figcaption>cloudwatch event rule</figcaption></figure><p>Which will show below event pattern once selected the trigger point in CloudWatch event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*Cc6FqvH6I9kyEwWn." /><figcaption>Cloudwatch rule</figcaption></figure><p>Now, our lambda is ready, once the CloudWatch event is triggered it will add private IPs in Redis via CloudWatch.</p><p>To verify the IP ranges in the redis connect to the Redis instance and use the below command to list the IP’s.</p><p><em>LRANGE iplist-key 0–1</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*lCAv751pyVZT5pM6.png" /><figcaption>redis server</figcaption></figure><p>Verify all the private IPs under autoscaling should be listed.</p><p>Next, add module in your respective code, to read the data from the Redis end-point to fetch the active IP’s</p><p><strong><em>Hope this is useful!!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27bbaeef3b62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thoughtpillars-cloud/clustering-in-autoscaled-environment-for-web-socket-application-on-aws-27bbaeef3b62">Clustering in Autoscaled environment for web-socket application on AWS</a> was originally published in <a href="https://medium.com/thoughtpillars-cloud">ThoughtPillars@Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuring OpenSwan/LibreSwan IPSec Tunnel Between AWS and ON-PREM]]></title>
            <link>https://medium.com/thoughtpillars-cloud/configuring-openswan-libreswan-ipsec-tunnel-between-aws-and-on-prem-d54c1b1e6221?source=rss-cda90b4a52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d54c1b1e6221</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[vpn]]></category>
            <dc:creator><![CDATA[Raju Banerjee]]></dc:creator>
            <pubDate>Mon, 21 May 2018 15:46:16 GMT</pubDate>
            <atom:updated>2018-07-21T02:53:06.354Z</atom:updated>
            <content:encoded><![CDATA[<h4>TUNNELING AWS-ONPREM</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lxURW8cri2rRSZ6cQd3eEA.png" /><figcaption>IPSEC Tunnel</figcaption></figure><p><strong>Introduction</strong>Walk through the creating IPSEC tunnel between AWS and ON-PREM</p><p><strong>Site to Site Tunnel between AWS and ON-Prem :</strong></p><p><strong>Prerequisite:</strong></p><p>Get the connection information from the client :</p><pre>Sample connection details -</pre><pre>Public IP Address : 200.114.100.106/ 182.**.**.***</pre><pre>Local Subnet :- <a href="http://192.168.48.0/20">172.0.0.0/</a>16</pre><pre>Pre-Shared : “FrdfBhf22” #get the details from client network admin</pre><pre>IKE Version :1, Main Mode</pre><pre>Phase1 Proposal:</pre><pre>Algo :- Aes256, Sha1</pre><pre>Dh Group : 2</pre><pre>Key Lifetime :- 86400 seconds</pre><pre>Phase2 Proposal:</pre><pre>Encyption : Aes256 , Sha1</pre><pre>Dh Group :2</pre><pre>Enable PFS :- Yes</pre><pre>Auto KeepAlive :- Yes</pre><pre>Auto negotiate :- Yes</pre><pre>Key Lifetime :- 43200 seconds</pre><p><strong>AWS Setup Configuration :</strong></p><ol><li>Select the region from AWS Dashboard, choose the region which is near for your DC, if it’s located in India, choose Mumbai Region from AWS console to avoid latency.</li><li>Create a VPC from the AWS Dashboard</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t-NJPydcIfbT4Z4M." /></figure><p>3. In the above diagram, we have selected VPC with Public and Private subnet, in this case one subnet will have Internet gateway and other machine will be in private subnet. You can add other subnets as well once the VPC setup done.</p><p>4. Now go to your AWS EC2 dashboard console. Select EC2 AMI from the list- Centos or Ubuntu and launch a server with min configuration of 2 core and 4GB RAM.</p><p>5. Make sure you have selected the same VPC and Subnets that we have created for this setup. Proceed with launching the machine in public subnet.Once launched, let’s assign a static IP i.e EIP with the machine, so that it won’t change in further. Let’s assume AWS EIP — 35.201.104.15</p><p>6. Now time to configure Security group : As it’s very crucial machine make sure we have proper firewall/security rule in place to protect the machine from vulnerabilities.</p><p>Open the below ports in the security group :</p><ol><li>SSH — 22 for internal office IP</li><li>UDP — 4500 to the DC router/firewall/Host IP</li><li>UDP — 500 to the DC router/firewall/Host IP</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*mzelmurdxpm-JPig.png" /></figure><h4>In our case :</h4><pre>AWS tunnel IP : 35.201.104.15</pre><pre>AWS Range : 10.100.0.0/16</pre><pre>On-Prem IP : 200.114.100.106</pre><pre>Subnet OnPrem : 172.100.0.0/16</pre><p>7. Time for command line action:</p><p>Login into your EC2 machine and execute below commands from a root user :</p><pre># Disable send redirects</pre><pre>echo 0 &gt; /proc/sys/net/ipv4/conf/all/send_redirects</pre><pre>echo 0 &gt; /proc/sys/net/ipv4/conf/default/send_redirects</pre><pre>echo 0 &gt; /proc/sys/net/ipv4/conf/eth0/send_redirects</pre><pre>echo 0 &gt; /proc/sys/net/ipv4/conf/lo/send_redirects</pre><pre># Disable accept redirects</pre><pre>echo 0 &gt; /proc/sys/net/ipv4/conf/all/accept_redirects</pre><pre>echo 0 &gt; /proc/sys/net/ipv4/conf/default/accept_redirects</pre><pre>echo 0 &gt; /proc/sys/net/ipv4/conf/eth0/accept_redirects</pre><pre>echo 0 &gt; /proc/sys/net/ipv4/conf/lo/accept_redirects</pre><p>8. vim /etc/sysctl.conf and change:</p><pre>net.ipv4.ip_forward = 1</pre><p>And then append below lines in the config file:</p><pre>net.ipv4.conf.all.accept_redirects = 0</pre><pre>net.ipv4.conf.all.send_redirects = 0</pre><p>9. Now install libreswan or openswan in the EC2 machine using yum :</p><pre>yum install libreswan</pre><pre>yum install openswan</pre><p>10. Once installation is done, let’s start configuring As now we have all the connection information, let’s get started with configuring the tunnel</p><pre>cd /etc/ipsec.d/</pre><p>11. Create a connection file, better to create a separate file for each connection :</p><pre>vim awsdconnection.conf</pre><p>12. And append the below config and modify accordingly the connection details :</p><pre>conn awsdconnection</pre><pre>type=tunnel</pre><pre>authby=secret</pre><pre>ike=aes256-sha1;modp1024</pre><pre>left=%defaultroute</pre><pre>leftid=35.201.104.15 #your ec2 instance EIP</pre><pre>leftsourceip=10.100.1.112 #you instance private ip</pre><pre>leftnexthop=%defaultroute</pre><pre>leftsubnet=10.100.0.0/16#Refer AWS Console VPC range</pre><pre>right= #DC network details</pre><pre>rightsubnet=172.100.0.0/16 Take the values from the above shared details</pre><pre>esp=aes256-sha1</pre><pre>ikelifetime=86400s</pre><pre>keylife=”43200&quot;</pre><pre>pfs=yes</pre><pre>auto=start</pre><pre>rekey=yes</pre><pre>keyingtries=%forever</pre><p>13. Add or modify the config file — sysctl.conf :</p><p>vim /etc/sysctl.conf</p><pre># /etc/ipsec.conf — Libreswan IPsec configuration file</pre><pre># This file: /etc/ipsec.conf</pre><pre># Enable when using this configuration file with openswan instead of libreswan</pre><pre>#version 2</pre><pre># Manual: ipsec.conf.5</pre><pre># basic configuration</pre><pre>config setup</pre><pre># Debug-logging controls: “none” for (almost) none, “all” for lots.</pre><pre>klipsdebug=all</pre><pre>plutodebug=all</pre><pre># For Red Hat Enterprise Linux and Fedora, leave protostack=netkey</pre><pre>protostack=netkey</pre><pre>nat_traversal=yes</pre><pre>#virtual_private=</pre><pre>virtual_private=%v4:10.100.0.0/16%v4:172.0.0.0/16 #whitelist your subnet range</pre><pre>oe=off</pre><pre># Enable this if you see “failed to find any available worker”</pre><pre>#nhelpers=0</pre><pre># It is best to add your IPsec connections as separate files in /etc/ipsec.d/</pre><pre>include /etc/ipsec.d/*.conf</pre><p>14. Now add the PSK key that’s been shared :</p><p>vim /etc/ipsec.secrets : take a backup and empty the content of the file</p><pre>Add in the below format :</pre><pre>#include /etc/ipsec.d/*.secrets</pre><pre>AWSleftIP OnpremrightIP : shared pre-shared key from the above config</pre><pre>35.201.104.15 200.114.100.106: PSK ‘FrdfBhf22’</pre><pre>Once the value is added, now let’s start the IPSEC service in the system.</pre><pre>/etc/init.d/ipsec restart</pre><p>15. Once the above service is up, we will now make the network ip</p><pre>ipsec auto — add awsnetmagic</pre><p>After this command execute :</p><pre>ipsec auto — up awsnetmagic</pre><p>Once the above steps completed, disable the source and destination check:</p><ol><li>Go to ec2 console, right click on the instance and select Networking : change source/destination check disable.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*CMewKnBXGvWz91xH.png" /><figcaption>Networking source/destination</figcaption></figure><p>2. Now go to VPC section, and Filter your VPC and click on route table add the entry of your destination subnet range and add the target as the instance where we have configured our solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*uxrAQ1DVz3sQucdV.png" /><figcaption>Route Table</figcaption></figure><p>Vice versa entry will be added in the DC firewall rules as well, to allow AWS network.</p><h4>Few important commands to check the status of the tunnel for troubleshooting :</h4><pre>ipsec — status whack</pre><pre>Route -n</pre><pre>ipsec auto — status</pre><pre>ipsec setup status</pre><pre>ipsec version</pre><h4>Host to Host Tunnel :</h4><p>In this case, follow the same steps just you don’t have to disable source and destination check and also no need of changing route table.</p><p>In you <strong>datacentre</strong> Box, add the route table to allow traffic from the AWS machine IP :</p><p>Something like :</p><pre>iptables -A INPUT -s 35.201.104.15-j ACCEPT</pre><p>Note: Mentioned IP’s are just example and subjected to change as per your network infrastructure.</p><p>Hope this is useful!! Please share your feedback :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d54c1b1e6221" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thoughtpillars-cloud/configuring-openswan-libreswan-ipsec-tunnel-between-aws-and-on-prem-d54c1b1e6221">Configuring OpenSwan/LibreSwan IPSec Tunnel Between AWS and ON-PREM</a> was originally published in <a href="https://medium.com/thoughtpillars-cloud">ThoughtPillars@Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>