<?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 Dhilipsingh G on Medium]]></title>
        <description><![CDATA[Stories by Dhilipsingh G on Medium]]></description>
        <link>https://medium.com/@dhilipsingh92?source=rss-8c799b9dde11------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*RTeS-JnujcXtmDOF.jpg</url>
            <title>Stories by Dhilipsingh G on Medium</title>
            <link>https://medium.com/@dhilipsingh92?source=rss-8c799b9dde11------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:30:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dhilipsingh92/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[Multi-Tenant Cluster? Best practices]]></title>
            <link>https://medium.com/@dhilipsingh92/multi-tenant-cluster-best-practices-bb55ae69a660?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb55ae69a660</guid>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[k8s]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 16:56:50 GMT</pubDate>
            <atom:updated>2026-11-18T16:56:50.762Z</atom:updated>
            <content:encoded><![CDATA[<p>Multi-tenancy in Kubernetes means running workloads from multiple teams or users in the same cluster — with secure separation, clear access boundaries, and consistent governance.</p><p>“Multiple teams within an organization can run their workloads in the same cluster. Resources belonging to each team are isolated from one another”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jw192a4SztdD7Zqk7vT0_g.png" /></figure><p><strong>Cluster shared by multiple independent teams, </strong>while keeping their workloads logically isolated.</p><h3>Main isolation controls</h3><p>A production multi-tenant EKS design commonly uses:</p><ol><li><strong>Namespaces</strong> → separate tenant workloads</li><li><strong>Kubernetes RBAC</strong> → control who can access each namespace</li><li><strong>NetworkPolicy</strong> → prevent unauthorized tenant-to-tenant communication</li><li><strong>ResourceQuota</strong> → prevent one tenant consuming all CPU/memory</li><li><strong>Pod Security Standards</strong> → restrict unsafe pod configurations</li><li><strong>EKS Pod Identity / IRSA</strong> → give each tenant controlled access to AWS resources</li><li><strong>Node Groups</strong> → optionally dedicate worker nodes to specific tenants</li></ol><p>Single-tenant vs multi-tenant:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z_uQjyLFYQy34LPIAGp4Lg.png" /></figure><h3>1. Namespace isolation</h3><p>Create a dedicated namespace for each tenant.</p><pre>kubectl create namespace tenant-a<br>kubectl create namespace tenant-b<br>kubectl create namespace tenant-c<br></pre><h3>Best practices</h3><ul><li>Use <strong>one namespace per tenant</strong> where namespace-level isolation is appropriate.</li><li>Never deploy different tenants into the same general-purpose default namespace.</li><li>Apply tenant-specific RBAC.</li><li>Apply NetworkPolicies to each namespace.</li><li>Apply ResourceQuota and LimitRange.</li><li>Label namespaces consistently.</li></ul><h3>2. RBAC isolation</h3><p>Tenant A users should not be able to modify Tenant B resources.</p><p>Use Kubernetes:</p><ul><li>Role</li><li>RoleBinding</li><li>ClusterRole</li><li>ClusterRoleBinding</li></ul><pre>kind: Role<br>metadata:<br>  namespace: tenant-a<br>  name: tenant-a-developer<br>rules:<br>- apiGroups: [&quot;apps&quot;]<br>  resources: [&quot;deployments&quot;]<br>  verbs: [&quot;get&quot;,&quot;list&quot;,&quot;watch&quot;,&quot;create&quot;,&quot;update&quot;]</pre><h3>Best practices</h3><ul><li>Follow <strong>least privilege</strong>.</li><li>Avoid giving tenant users cluster-admin.</li><li>Avoid tenant-specific permissions through unnecessary ClusterRoleBinding.</li><li>Separate admin, developer, read-only and application identities.</li><li>Regularly review RBAC permissions.</li><li>Avoid wildcard permissions</li></ul><p><strong>Network isolation</strong></p><p>Network isolation prevents a pod belonging to one tenant from communicating with another tenant unless you explicitly allow it.</p><p>Main methods to achieve network isolation</p><ol><li>Kubernetes NetworkPolicy</li><li>Ingress</li></ol><p>Start with a <strong>default-deny ingress + egress</strong> policy per tenant and add only the required flows.</p><pre>apiVersion: networking.k8s.io/v1<br>kind: NetworkPolicy<br>metadata:<br>  name: default-deny<br>  namespace: tenant-a<br>spec:<br>  podSelector: {}<br>  policyTypes:<br>    - Ingress<br>    - Egress</pre><h3>Ingress isolation</h3><p>Tenants will often have different DNS names.</p><pre>customer-a.example.com<br>customer-b.example.com<br>customer-c.example.com</pre><h3>Best practices</h3><ul><li>TLS/HTTPS only for application traffic.</li><li>Use ACM certificates.</li><li>Put AWS WAF in front of internet-facing application endpoints when appropriate.</li><li>Keep tenant routing rules explicit.</li><li>Don’t expose internal services unnecessarily.</li></ul><h3>4.Resource isolation</h3><p>One tenant shouldn’t be able to consume all cluster CPU and memory.</p><p>Apply:</p><ul><li>ResourceQuota</li><li>LimitRange</li><li>CPU requests/limits</li><li>Memory requests/limits</li></ul><pre>apiVersion: v1<br>kind: ResourceQuota<br>metadata:<br>  name: tenant-a-quota<br>spec:<br>  hard:<br>    requests.cpu: &quot;10&quot;<br>    requests.memory: 20Gi<br>    limits.cpu: &quot;20&quot;<br>    limits.memory: 40Gi<br>    pods: &quot;50&quot;</pre><h3>Best practices</h3><p>Every production workload should have appropriate:</p><p>Don’t blindly use those exact figures. Set requests based on actual workload measurements.</p><h3>5. AWS IAM isolation</h3><p>This is especially important in EKS.</p><p>Don’t give all pods access through a broad IAM role.</p><p>Ex: Tenant A shouldn’t be able to access Tenant B’s bucket.</p><h3>Best practices</h3><p>Use <strong>EKS Pod Identity</strong> or IRSA rather than giving workloads broad permissions through the EC2 worker-node IAM role.</p><h3>6. Node isolation</h3><p>There are two major approaches.</p><p>Option 1: Shared worker nodes</p><p>Option 2: Dedicated node groups</p><p>Control placement with:</p><ul><li>Labels</li><li>Taints</li><li>Tolerations</li><li>Node affinity</li></ul><p><strong>Shared nodes</strong> → suitable when tenants are within the same trust boundary and cost efficiency matters.</p><p><strong>Dedicated nodes</strong> → use when you need stronger workload separation, predictable compute allocation, or specialized hardware.</p><p><strong>Dedicated cluster/account</strong> → consider when tenant isolation requirements are very strong.</p><h3>7. Secrets isolation</h3><p>Don’t put tenant credentials directly into application manifests.</p><h3>Best practices</h3><p>Use:</p><ul><li>AWS Secrets Manager</li><li>AWS KMS</li><li>EKS Pod Identity/IRSA</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb55ae69a660" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure virtual network Peering]]></title>
            <link>https://medium.com/@dhilipsingh92/azure-virtual-network-peering-1e494c5a5a6b?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e494c5a5a6b</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[vpc-peering]]></category>
            <category><![CDATA[vnet]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Sun, 15 Nov 2026 16:31:54 GMT</pubDate>
            <atom:updated>2026-11-15T16:31:54.733Z</atom:updated>
            <content:encoded><![CDATA[<p>What is Virtual Network peering?</p><p>Azure Virtual Network peering enables you to seamlessly connect two or more virtual networks in Azure.</p><p>Types of peering</p><ol><li>Regional VNet Peering</li><li>Global VNet Peering</li><li>Cross-subscription peering</li><li>Cross-tenant peering</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhL0PhGLYdvi8fYnXIkX8g.png" /></figure><p><strong>Benefits of using virtual network peering</strong></p><ol><li>A low-latency, high-bandwidth connection between resources in different virtual networks.</li><li>The ability for resources in one virtual network to communicate with resources in a different virtual network.</li><li>Network traffic between peered virtual networks is private.</li><li>Traffic between the virtual networks is kept on the Microsoft backbone network. No public internet, gateways, or encryption are required in the communication between the virtual networks.</li></ol><p><strong>1.Regional VNet Peering</strong></p><p><strong>Regional VNet Peering</strong> connects two Azure VNets located in the <strong>same Azure region.</strong></p><p>Both VNets are located in the same Azure region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gT_DOxeDimkJIUdoJn_v0A.png" /></figure><p>Regional VNet Peering — Step-by-Step Configuration</p><h3>Prerequisites</h3><ul><li>Two VNets must exist in the <strong>same Azure region</strong>.</li><li>VNet address spaces must <strong>not overlap</strong>.</li></ul><h3>Step 1: Open Virtual Networks</h3><ol><li>Sign in to the <strong>Azure Portal</strong>.</li><li>Search for <strong>Virtual networks</strong>.</li><li>Select the first VNet.</li><li>From the left menu, select <strong>Peerings</strong>.</li></ol><h3>Step 2: Add Peering</h3><ol><li>Select <strong>+ Add</strong>.</li><li>Enter the peering details.</li></ol><p><strong>Remote virtual network</strong></p><ul><li>Peering link name: VNet1-to-VNet2</li><li>Subscription: Select the required subscription</li><li>Virtual network: Select VNet2</li></ul><p><strong>Local virtual network</strong></p><ul><li>Peering link name: VNet2-to-VNet1</li></ul><h3>Step 3: Configure Peering Settings</h3><p>For standard regional VNet peering:</p><ul><li><strong>Allow virtual network access:</strong> Enabled</li><li><strong>Allow forwarded traffic:</strong> Disabled</li><li><strong>Allow gateway transit:</strong> Disabled</li><li><strong>Use remote gateways:</strong> Disabled</li></ul><h3>Step 4: Create the Peering</h3><ol><li>Review the configuration.</li><li>Select <strong>Add</strong>.</li><li>Wait for Azure to create the peering.</li></ol><p><strong>2.Global VNet Peering:</strong></p><p>Global VNet Peering connects Azure VNets located in <strong>different Azure regions</strong> through the Microsoft private backbone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jP0AcfTw8QuoTrTPcC25YA.png" /></figure><h3>Step 1: Open the First Virtual Network</h3><ol><li>Sign in to the <strong>Azure Portal</strong>.</li><li>Search for <strong>Virtual networks</strong>.</li><li>Select the first VNet.</li><li>Select <strong>Peerings</strong> from the left menu.</li><li>Select <strong>+ Add</strong>.</li></ol><h3>Step 2: Configure Global Peering</h3><p>Under <strong>Remote virtual network summary</strong>:</p><ul><li>Peering link name: VNet-EastUS-to-VNet-WestEurope</li><li>Subscription: Select the required subscription</li><li>Virtual network: Select the VNet located in the other Azure region</li></ul><p>Under <strong>Local virtual network summary</strong>:</p><ul><li>Peering link name: VNet-WestEurope-to-VNet-EastUS</li></ul><h3>Step 3: Configure Peering Settings</h3><p>For standard regional VNet peering:</p><ul><li><strong>Allow virtual network access:</strong> Enabled</li><li><strong>Allow forwarded traffic:</strong> Disabled</li><li><strong>Allow gateway transit:</strong> Disabled</li><li><strong>Use remote gateways:</strong> Disabled</li></ul><h3>Step 4: Create the Peering</h3><ol><li>Review the configuration.</li><li>Select <strong>Add</strong>.</li><li>Wait for Azure to create the peering.</li></ol><p>Note :</p><p><strong>Regional and Global VNet Peering look almost identical in the Azure Portal configuration.</strong> Azure determines which type it is automatically from the <strong>regions of the two VNets</strong>.</p><p><strong>3. Cross-Subscription VNet Peering:</strong></p><p><strong>Cross-subscription peering</strong> connects two Azure VNets that belong to <strong>different Azure subscriptions</strong>. Azure supports VNet peering across subscriptions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dlNhaxCDJeqgKJfOvcN0ww.png" /></figure><h3>Step-by-Step Configuration</h3><h3>Step 1: Check Prerequisites</h3><ul><li>Ensure both VNets are already created.</li><li>Confirm the VNet address spaces <strong>do not overlap</strong>.</li></ul><h3>Step 2: Open the First VNet</h3><ol><li>Sign in to the Azure Portal.</li><li>Go to <strong>Virtual networks</strong>.</li><li>Select the VNet in <strong>Subscription-A</strong>.</li><li>Select <strong>Peerings</strong>.</li><li>Select <strong>+ Add</strong>.</li></ol><h3>Step 3: Select the VNet in the Other Subscription</h3><ol><li>Enter the peering link name, for example VNet-A-to-VNet-B.</li><li>Under <strong>Subscription</strong>, select <strong>Subscription-B</strong>.</li><li>Under <strong>Virtual network</strong>, select the required VNet.</li><li>Enter the reverse peering name, for example VNet-B-to-VNet-A.</li></ol><p>Azure supports peering VNets across Azure subscriptions.</p><h3>Step 4: Create the Peering</h3><ol><li>Review the VNet and subscription details.</li><li>Select <strong>Add</strong>.</li><li>Wait for the peering deployment to complete.</li></ol><p><strong>Different Subscription + Same Region = Cross-subscription Regional VNet Peering</strong></p><p><strong>Different Subscription + Different Region = Cross-subscription Global VNet Peering</strong></p><h3>Cross-Tenant VNet Peering:</h3><p>Cross-tenant VNet peering connects Azure VNets belonging to <strong>different Microsoft Entra ID tenants</strong>, including VNets in different subscriptions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YZibSI_XQvUytkb2M8A3Jg.png" /></figure><h3>Step 1: Verify Prerequisites</h3><p>Ensure both VNets exist in different subscriptions.<br> Confirm that VNet address spaces <strong>do not overlap</strong>.<br> Ensure <strong>Network Contributor</strong> or equivalent permissions are available on both VNets/subscriptions.</p><h3>Step 2: Open VNet Peering</h3><p>Sign in to <strong>Azure Portal → Virtual Networks</strong>.<br> Select the VNet in <strong>Subscription-A</strong>.<br> Go to <strong>Peerings → + Add</strong>.</p><h3>Step 3: Select Remote VNet</h3><p>Enter the peering name, such as VNet-A-to-VNet-B.<br> Select <strong>Subscription-B → Remote VNet</strong>.<br> Enter the reverse peering name, such as VNet-B-to-VNet-A.</p><h3>Step 4: Create Peering</h3><p>Review the local and remote VNet information.<br> Select <strong>Add</strong> to create the peering.<br> Wait until the deployment completes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e494c5a5a6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Datadog API Key Rotation with OpenTelemetry, ESO and Reloader]]></title>
            <link>https://medium.com/@dhilipsingh92/datadog-api-key-rotation-with-opentelemetry-eso-and-reloader-11c30175d190?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/11c30175d190</guid>
            <category><![CDATA[aws-secrets-manager]]></category>
            <category><![CDATA[ami]]></category>
            <category><![CDATA[otel]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Sat, 03 Oct 2026 10:04:13 GMT</pubDate>
            <atom:updated>2026-10-03T10:04:13.924Z</atom:updated>
            <content:encoded><![CDATA[<p>We have an OpenTelemetry (OTel) Collector running inside Kubernetes. The Collector is responsible for collecting application telemetry, such as metrics, traces, and logs, and sending it to Datadog.</p><p>To send telemetry to Datadog, the OTel Collector needs a <strong>Datadog API key </strong>and we rotate the Datadog API key to reduce the risk associated with long-lived credentials. If a key is exposed or access requirements change, we can replace the old key with a new one, automatically propagate it through ESO and Reloader to the OTel Collector, verify telemetry, and then revoke the old key.”</p><p>Instead of manually placing this key inside Kubernetes configuration, we use a secure and automated chain involving an <strong>external secret backend, External Secrets Operator (ESO), a Kubernetes Secret, and Reloader</strong>.</p><p><strong>The complete flow looks like this:</strong></p><p><strong>External Secret Backend → ESO → Kubernetes Secret → Reloader → OTel Collector → Datadog</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-NV4oGcsV8vA8yTbUyYkw.png" /></figure><h3>OpenTelemetry (OTel)</h3><p><strong>OpenTelemetry</strong>, often called <strong>OTel</strong>, is an open-source observability framework.</p><p>Its job is to collect telemetry from applications.</p><p>Telemetry generally includes:</p><ul><li><strong>Metrics</strong> — CPU usage, request count, latency, etc.</li><li><strong>Logs</strong> — application and system logs.</li><li><strong>Traces</strong> — information about how a request travels through different services.</li></ul><h3>Datadog API Key</h3><p>A <strong>Datadog API key</strong> is a credential used by applications or agents to authenticate when sending data to Datadog.</p><h3>Secret Backend?</h3><p>A <strong>secret backend</strong> is a system designed to securely store sensitive information such as:</p><ul><li>API keys</li><li>Passwords</li><li>Tokens</li><li>Certificates</li><li>Database credentials</li></ul><p>Examples include:</p><ul><li>HashiCorp Vault</li><li>AWS Secrets Manager</li><li>Azure Key Vault</li><li>Google Secret Manager</li></ul><h3>ESO?</h3><p><strong>ESO stands for External Secrets Operator.</strong></p><p>ESO is a Kubernetes operator that allows Kubernetes to retrieve secrets from external secret-management systems.</p><blockquote><strong><em>ESO connects Kubernetes to external secret stores</em></strong></blockquote><h3>Reloader</h3><p>Reloader is a Kubernetes controller that watches resources such as:</p><ul><li>Secrets</li><li>ConfigMaps</li></ul><p>When a watched Secret changes, Reloader can trigger a rollout of the Deployment</p><h3>Step by step implementation :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iJDXJ2QEYIWEX4WRptYLew.png" /></figure><ol><li>Create key in Datadog</li></ol><p>New Api key need to created in Datadog and put into secret backed (AWS secret Manager , Vault etc).</p><p>either created by Manual or automated.</p><p>2. Create Namespace in Kubernetes</p><pre>kubectl create namespace observability</pre><p>3. Install External Secrets Operator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*VxS83TMRjc9Fz1qYNtBIOA.png" /></figure><p>ESO is responsible for connecting Kubernetes to our external secret manager.</p><ol><li>Create IAM role in AWS to get secret form secret manager</li><li>Create service account with IAM role</li></ol><pre>apiVersion: v1 <br>kind: ServiceAccount <br>metadata: <br>  name: external-secrets<br>  namespace: external-secrets<br>  annotations: eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/ESO-Datadog-Role</pre><p>For example, if we use Helm:</p><pre>helm repo add external-secrets https://charts.external-secrets.io<br>helm install external-secrets \ <br>external-secrets/external-secrets \ <br>-n external-secrets \ <br>--create-namespace<br>--set serviceAccount.create=false \<br>--set serviceAccount.name=external-secrets</pre><p>After installation, we verify that ESO is running:</p><pre>kubectl get pods -n external-secrets</pre><p>4. Configure the external secret store</p><p>The external secret provider is AWS Secrets Manager.”</p><pre>apiVersion: external-secrets.io/v1<br>kind: ClusterSecretStore<br>metadata:<br>  name: aws-secrets-manager<br>spec:<br>  provider:<br>    aws:<br>      service: SecretsManager<br>      region: ap-south-1</pre><p><strong>Important:</strong> the exact authentication configuration can vary with the ESO version/provider configuration you’re using. The ServiceAccount provides the AWS identity to the ESO controller; the ClusterSecretStore describes the provider.</p><p>5. Configure ExternalSecret</p><pre>apiVersion: external-secrets.io/v1<br>kind: ExternalSecret<br>metadata:<br>  name: datadog-api-key<br>  namespace: observability<br>spec:<br>  refreshInterval: 1m<br><br>  secretStoreRef:<br>    name: aws-secrets-manager<br>    kind: ClusterSecretStore<br><br>  target:<br>    name: datadog-api-key<br>    creationPolicy: Owner<br><br>  data:<br>    - secretKey: api-key<br>      remoteRef:<br>        key: prod/observability/datadog<br>        property: api-key</pre><p>6. Install Reloader</p><p><strong>Reloader watches Kubernetes Secrets and ConfigMaps.</strong></p><p>When our Datadog Secret changes, Reloader triggers a rollout of the OTel Collector.</p><p>Install Stakater Reloader:</p><pre>helm repo add stakater \<br>  https://stakater.github.io/stakater-charts</pre><pre>helm repo update</pre><pre>helm upgrade --install reloader \<br>  stakater/reloader \<br>  --namespace reloader \<br>  --create-namespace</pre><p>Check:</p><pre>kubectl get pods -n reloader</pre><p>7. Deploy the OTel Collector</p><p>The Collector needs the Datadog API key.</p><p>Instead of putting key.</p><p>directly into the Deployment, we reference the Kubernetes Secret.</p><p>Example:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: otel-collector<br>  namespace: observability</pre><pre>spec:<br>  replicas: 2</pre><pre>  selector:<br>    matchLabels:<br>      app: otel-collector</pre><pre>  template:<br>    metadata:<br>      labels:<br>        app: otel-collector</pre><pre>      annotations:<br>        secret.reloader.stakater.com/reload: &quot;datadog-api-key&quot;</pre><pre>    spec:<br>      containers:<br>        - name: otel-collector<br>          image: otel/opentelemetry-collector-contrib:&lt;approved-version&gt;</pre><pre>          env:<br>            - name: DD_API_KEY<br>              valueFrom:<br>                secretKeyRef:<br>                  name: datadog-api-key<br>                  key: api-key</pre><p>The important section is:</p><pre>valueFrom:<br>  secretKeyRef:<br>    name: datadog-api-key<br>    key: api-key</pre><p>This tells Kubernetes:</p><blockquote><em>“Get the </em><em>api-key value from the </em><em>datadog-api-key Secret.&quot;</em></blockquote><p>8. Configure the OTel Collector</p><p>The OTel Collector configuration references the environment variable.</p><p>For example:</p><pre>exporters:<br>  datadog:<br>    api:<br>      key: ${env:DD_API_KEY}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11c30175d190" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vault AWS Secrets Engine to generate temporary AWS credentials by assuming an IAM role.]]></title>
            <link>https://medium.com/@dhilipsingh92/vault-aws-secrets-engine-to-generate-temporary-aws-credentials-by-assuming-an-iam-role-9cb970f9966c?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cb970f9966c</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[hashicorp-vault]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Sat, 02 May 2026 06:13:44 GMT</pubDate>
            <atom:updated>2026-05-02T06:13:44.896Z</atom:updated>
            <content:encoded><![CDATA[<p>Vault uses <strong>AWS Security Token Service</strong> to dynamically generate <strong>temporary AWS credentials</strong> by assuming an IAM role.<br> This eliminates static keys and provides short-lived, secure access controlled via <strong>AWS Identity and Access Management</strong>.</p><p><strong>Prerequisites</strong></p><ul><li><strong>Vault installed and running</strong> (with AWS secrets engine enabled)</li><li><strong>AWS account access</strong></li><li><strong>IAM Role created</strong> (e.g., s3full, IAM full access) with required permissions and attached to EC2 (Vault running on Ec2)</li><li><strong>Trust policy</strong> allowing Vault (IAM user/EC2 role) to assume the role</li><li><strong>Vault AWS configuration</strong> (aws/config/root set via access key or IAM role)</li><li><strong>Vault policy/token</strong> with permission to access aws/creds/*</li></ul><h3>How It Works</h3><ol><li>User/Application requests credentials from Vault</li><li>Vault authenticates to AWS using IAM (Access Key or EC2 Role)</li><li>Vault calls <strong>STS AssumeRole</strong></li><li>AWS returns temporary credentials</li><li>Vault delivers credentials to the user</li></ol><p><strong>Flow Diagram</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61MvDaPQFATY4_qmQmcayw.png" /></figure><p>Step 1: Verify EC2 IAM Role (IMDSv2)</p><p>Generate Metadata TOKEN</p><pre>TOKEN=$(curl -X PUT &quot;http://169.254.169.254/latest/api/token&quot; \<br>  -H &quot;X-aws-ec2-metadata-token-ttl-seconds: 21600&quot;)</pre><p>Check IAM role</p><pre>curl -H &quot;X-aws-ec2-metadata-token: $TOKEN&quot; \<br>http://169.254.169.254/latest/meta-data/iam/security-credentials/</pre><p>if Output is empty then role not attached to EC2.</p><p>then create IAM role with required permission and attached to EC2 where vault running.</p><p><strong>Create role in Vault :</strong></p><pre>vault write aws/roles/s3sandbox \<br>    credential_type=assumed_role \<br>    role_arn=arn:aws:iam::521671046599:role/s3full \<br>    ttl=1200 \<br>    max_ttl=3600<br></pre><p>This command creates a Vault role (s3sandbox) that tells Vault to assume the IAM role s3full and generate temporary AWS credentials with a TTL of 20 minutes.<br> In <strong>AWS Security Token Service</strong>, Vault calls AssumeRole to fetch short-lived keys instead of using static credentials.</p><p>From GUI:</p><p>Enable AWS secret engine if not enabled</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbE6tIC4jyJiMMT2Oc45og.png" /></figure><p>Select AWS engine -&gt; Create role</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oHbm8Bb5pu6dKOsIT27xzg.png" /></figure><p>Give role name and role ARN (which created in AWS account and will used by application)</p><p>Example application want list the bucket then create IAM role in AWS account either list or full access (always go with minimal)</p><p>then note down the ARN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fbW2ypWOMR-Qv8tugb2Kiw.png" /></figure><p><strong>Use case:</strong> Applications (e.g., CI/CD or Kubernetes pods) can securely access S3 by requesting dynamic credentials from Vault without storing AWS keys.</p><p><strong>utilize in Terraform:</strong></p><p>Terraform <strong>directly fetches short-lived AWS credentials from Vault</strong> (no manual export, no static keys).</p><p>Vault → <strong>AWS Security Token Service</strong> → temp creds → Terraform</p><p>Step by step integration with terraform:</p><p><strong>Add Vault provider in Terraform:</strong></p><pre>provider &quot;vault&quot; {}</pre><p><strong>Fetch AWS credentials from Vault</strong></p><pre>data &quot;vault_aws_access_credentials&quot; &quot;creds&quot; {<br>  backend = &quot;aws&quot;<br>  role    = &quot;s3sandbox&quot;<br>}<br>#Sandbox is role name</pre><p><strong>Configure AWS provider using Vault creds</strong></p><pre>provider &quot;aws&quot; {<br>  region     = &quot;ap-sout-*&quot;<br>  access_key = data.vault_aws_access_credentials.creds.access_key<br>  secret_key = data.vault_aws_access_credentials.creds.secret_key<br>  token      = data.vault_aws_access_credentials.creds.security_token<br>}</pre><p>Add a test resource</p><pre>resource &quot;aws_s3_bucket&quot; &quot;test&quot; {<br>  bucket = &quot;vault-terraform-demo-bucket-12345&quot;<br>}</pre><h3>Important Points</h3><h3>1️⃣ TTL awareness</h3><ul><li>You set ttl = 1200</li><li>Terraform must complete within 20 minutes</li></ul><h3>2️⃣ Vault token permissions</h3><p>Your token must allow:</p><pre>path &quot;aws/creds/s3sandbox&quot; {<br>  capabilities = [&quot;read&quot;]<br>}</pre><h3>Summary</h3><ul><li>Vault generates <strong>short-lived credentials via STS</strong></li><li>Terraform fetches them using Vault provider</li><li>AWS provider uses them dynamically</li><li>No static credentials anywhere</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cb970f9966c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenTelemetry Collector Architecture for Datadog (Logs, Metrics, Traces)]]></title>
            <link>https://medium.com/@dhilipsingh92/opentelemetry-collector-architecture-for-datadog-logs-metrics-traces-ed8ec86393ca?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed8ec86393ca</guid>
            <category><![CDATA[datadog]]></category>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[auto-instrumentation]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Fri, 13 Mar 2026 17:26:23 GMT</pubDate>
            <atom:updated>2026-03-13T17:26:23.087Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern Kubernetes observability requires collecting <strong>logs, metrics, and traces</strong> from applications and infrastructure. A common production architecture uses <strong>OpenTelemetry Collectors</strong> deployed as both <strong>DaemonSets and Deployments</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-lhnYXtAcbo6rMHO1p9hEg.png" /></figure><h3>1. Application Layer (Auto-Instrumentation)</h3><p>Applications are instrumented using <strong>OpenTelemetry auto-instrumentation</strong>.</p><p>Examples include:</p><ul><li>Java agent</li><li>Python auto instrumentation</li><li>Node.js OpenTelemetry SDK</li></ul><p>These automatically capture:</p><ul><li>HTTP request latency</li><li>database queries</li><li>external API calls</li><li>service dependencies</li></ul><p>The telemetry is sent using the <strong>OTLP protocol</strong>.</p><h3>2. Trace Processing Layer (Deployment)</h3><p>Traces are sent to a centralized <strong>OpenTelemetry Collector Deployment</strong>.</p><p>Why use a Deployment?</p><p>Because trace processing requires:</p><ul><li>batching</li><li>sampling</li><li>centralized processing</li><li>horizontal scaling</li></ul><h3>3. Node Observability Layer (DaemonSet)</h3><p>Logs and host metrics must run <strong>on every node</strong>.</p><p>Therefore the collector is deployed as a <strong>DaemonSet</strong>.</p><p>Each node runs one collector pod.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j79LveuQidhAg3DRow6CCg.png" /></figure><p><strong>step-by-step production setup</strong> using <strong>OpenTelemetry Collector</strong>, <strong>OpenTelemetry Operator</strong> (for auto-instrumentation), and exporting telemetry to <strong>Datadog</strong>.</p><p>Architecture used:</p><ul><li><strong>DaemonSet collector</strong> → logs + node metrics</li><li><strong>Deployment collector (gateway)</strong> → traces</li><li><strong>Operator</strong> → auto instrumentation for applications</li></ul><p><strong>Add Helm Repositories:</strong></p><pre>helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts<br>helm repo update</pre><p><strong>Create Datadog API Key Secret</strong></p><pre>kubectl create secret generic datadog-secret \<br>  --from-literal=api-key=DATADOG_API_KEY</pre><h3>Deploy OTEL Agent (DaemonSet)</h3><p>Purpose:</p><ul><li>Collect <strong>logs</strong></li><li>Collect <strong>node metrics</strong></li></ul><p>otel-agent-values.yaml</p><pre>mode: daemonset<br><br>image:<br>  repository: otel/opentelemetry-collector-contrib<br><br>extraEnvs:<br>  - name: DD_API_KEY<br>    valueFrom:<br>      secretKeyRef:<br>        name: datadog-secret<br>        key: api-key<br><br>config:<br>  receivers:<br><br>    filelog:<br>      include:<br>        - /var/log/containers/*.log<br>      start_at: beginning<br><br>    hostmetrics:<br>      collection_interval: 10s<br>      scrapers:<br>        cpu: {}<br>        memory: {}<br>        filesystem: {}<br>        disk: {}<br>        network: {}<br><br>  processors:<br>    memory_limiter:<br>      check_interval: 1s<br>      limit_mib: 512<br>    batch:<br><br>  exporters:<br>    datadog:<br>      api:<br>        key: ${DD_API_KEY}<br>        site: datadoghq.com<br><br>  service:<br>    pipelines:<br><br>      logs:<br>        receivers: [filelog]<br>        processors: [memory_limiter, batch]<br>        exporters: [datadog]<br><br>      metrics:<br>        receivers: [hostmetrics]<br>        processors: [memory_limiter, batch]<br>        exporters: [datadog]<br><br>extraVolumes:<br>  - name: varlog<br>    hostPath:<br>      path: /var/log<br><br>extraVolumeMounts:<br>  - name: varlog<br>    mountPath: /var/log<br>    readOnly: true</pre><pre>helm install otel-agent open-telemetry/opentelemetry-collector \<br>-f otel-agent-values.yaml<br>#collector pod per node<br>#3 nodes → 3 otel-agent pods</pre><p><strong>Deploy OTEL Gateway (Deployment)</strong></p><p>Purpose:</p><ul><li>Receive traces from applications</li><li>Perform batching</li><li>Export traces to Datadog</li></ul><p>otel-gateway-values.yaml</p><pre>mode: deployment<br><br>replicaCount: 3<br><br>image:<br>  repository: otel/opentelemetry-collector-contrib<br><br>extraEnvs:<br>  - name: DD_API_KEY<br>    valueFrom:<br>      secretKeyRef:<br>        name: datadog-secret<br>        key: api-key<br><br>service:<br>  enabled: true<br>  type: ClusterIP<br>  ports:<br>    otlp:<br>      enabled: true<br>      containerPort: 4317<br><br>config:<br><br>  receivers:<br>    otlp:<br>      protocols:<br>        grpc:<br>        http:<br><br>  processors:<br>    memory_limiter:<br>      check_interval: 1s<br>      limit_mib: 1024<br>    batch:<br><br>  exporters:<br>    datadog:<br>      api:<br>        key: ${DD_API_KEY}<br>        site: datadoghq.com<br><br>  service:<br>    pipelines:<br>      traces:<br>        receivers: [otlp]<br>        processors: [memory_limiter, batch]<br>        exporters: [datadog]<br># Replicas as per requirement , prodcution 3+</pre><pre>helm install otel-gateway open-telemetry/opentelemetry-collector \<br>-f otel-gateway-values.yaml</pre><p><strong>Install OpenTelemetry Operator (for Auto Instrumentation)</strong></p><pre>helm install otel-operator \<br>open-telemetry/opentelemetry-operator</pre><p><strong>Create Auto-Instrumentation Configuration:</strong></p><p>instrumentation.yaml</p><pre>apiVersion: opentelemetry.io/v1alpha1<br>kind: Instrumentation<br>metadata:<br>  name: otel-auto-instrumentation<br>spec:<br><br>  exporter:<br>    endpoint: http://otel-gateway:4317 # Deployemnt service<br><br>  propagators:<br>    - tracecontext<br>    - baggage<br>    - b3<br><br>  sampler:<br>    type: parentbased_traceidratio<br>    argument: &quot;1&quot;<br><br>  java:<br>    image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-java:latest<br><br>  nodejs:<br>    image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:latest<br><br>  python:<br>    image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:latest</pre><p><strong>Enable Auto Instrumentation for an Application</strong></p><p>Annotation based</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: checkout-service<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: checkout<br>  template:<br>    metadata:<br>      labels:<br>        app: checkout<br>      annotations:<br>        instrumentation.opentelemetry.io/inject-java: &quot;true&quot; # Annotaion for auto instrumentation <br>    spec:<br>      containers:<br>      - name: app<br>        image: myapp:latest<br>        ports:<br>        - containerPort: 8080</pre><p>No manual instrumentation needed.</p><p>The operator automatically injects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed8ec86393ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Dynamic Block]]></title>
            <link>https://medium.com/@dhilipsingh92/terraform-dynamic-block-bb353b53444f?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb353b53444f</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Mon, 05 Jan 2026 11:24:28 GMT</pubDate>
            <atom:updated>2026-01-05T11:24:28.490Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a Dynamic Block?</h3><p>A <strong>dynamic block</strong> in Terraform is used to <strong>programmatically generate repeated nested blocks</strong> inside a resource, data source, or module. It helps when the number of nested blocks is not fixed and depends on input variables.</p><blockquote><em>Think of a dynamic block as a </em><strong><em>for loop for nested blocks</em></strong><em>.</em></blockquote><h3>Why Dynamic Blocks Are Used</h3><p>Dynamic blocks are used to:</p><ul><li>Avoid repetitive copy‑paste nested blocks</li><li>Handle variable or conditional configurations</li><li>Make modules reusable and scalable</li></ul><p>Terraform itself is static, but dynamic blocks allow flexibility within resource definitions.</p><h3>Where Dynamic Blocks Can Be Used</h3><p>Dynamic blocks can be used <strong>only inside</strong>:</p><ul><li>resource</li><li>data</li><li>module</li></ul><p>They <strong>cannot</strong> be used:</p><ul><li>At top‑level</li><li>To create resources</li></ul><h3>Common Nested Blocks (Examples)</h3><blockquote><em>These blocks are </em><strong><em>provider‑specific</em></strong><em>, not Terraform keywords.</em></blockquote><h4>AWS Security Group</h4><ul><li>ingress</li><li>egress</li></ul><h4>AWS Load Balancer</h4><ul><li>listener</li><li>default_action</li><li>condition</li><li>access_logs</li></ul><h4>AWS Auto Scaling Group</h4><ul><li>launch_template</li><li>tag</li><li>instance_refresh</li></ul><h4>AWS IAM</h4><ul><li>statement</li><li>condition</li><li>principal</li></ul><h4>Kubernetes Resources</h4><ul><li>metadata</li><li>spec</li><li>container</li><li>env</li><li>volume</li></ul><h4>Helm Release</h4><ul><li>set</li><li>set_sensitive</li><li>values</li></ul><h3>When a Block Can Be Dynamic</h3><p>A block can be used with dynamic if:</p><ul><li>It is a <strong>nested block</strong></li><li>It is <strong>repeatable</strong></li><li>It exists in the <strong>resource schema</strong></li></ul><p>If documentation shows:</p><pre>ingress {}<br>ingress {}</pre><p>Then dynamic &quot;ingress&quot; is allowed.</p><h3>Advantages</h3><ul><li>Reduces duplicated configuration (DRY)</li><li>Supports variable and conditional blocks</li><li>Improves module reusability</li><li>Scales easily with input changes</li></ul><h3>Disadvantages</h3><ul><li>Reduces readability for beginners</li><li>Harder to debug during terraform plan</li><li>Overuse leads to complex code</li><li>Unnecessary for small/static configs</li></ul><p>Example :</p><pre>main.tf<br>resource &quot;aws_security_group&quot; &quot;SG&quot; {<br>    vpc_id      = var.vpc_id<br>    name        = &quot;allow_tls&quot;<br>    description = &quot;Allow TLS inbound traffic and all outbound traffic&quot;<br>dynamic &quot;ingress&quot; {<br>  for_each = var.ingress1<br>  content {<br><br>    description      = &quot;allow traffic sandbox&quot;<br>    from_port        = ingress.value.port<br>    to_port          = ingress.value.port<br>    protocol         = ingress.value.protocol<br>    cidr_blocks      = ingress.value.cidr_blocks<br>    <br>  }<br>}<br><br>variable.tf<br><br>variable &quot;vpc_id&quot; {<br>  description      =  &quot;put your vpc id&quot;<br>}<br>variable &quot;ingress1&quot; {<br>    type = map(object({<br>    port = number<br>    protocol = string<br>    cidr_blocks = list(string)<br>  }))<br>    default = {<br>  <br>    }<br>}<br><br>terraform.tfvars<br>ingress1 = {<br>  &quot;http&quot; = {<br>    port        = 80<br>    protocol    = &quot;tcp&quot;<br>    cidr_blocks = [&quot;0.0.0.0/0&quot;]<br><br>  }<br>}</pre><h3>Summary</h3><blockquote><em>A Terraform dynamic block generates repeatable nested blocks based on a collection, without creating resources.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb353b53444f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform State File — Where Can We Store It?]]></title>
            <link>https://medium.com/@dhilipsingh92/terraform-state-file-where-can-we-store-it-1ae3c42fb86f?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ae3c42fb86f</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[iac]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 17:23:18 GMT</pubDate>
            <atom:updated>2026-01-03T17:23:18.733Z</atom:updated>
            <content:encoded><![CDATA[<h3>Terraform State File — Where Can We Store It?</h3><p>Terraform uses a <strong>state file (</strong><strong>terraform.tfstate)</strong> to keep track of the real infrastructure it manages.<br> This state must be stored <strong>safely and centrally</strong>, especially when working in teams or CI/CD.</p><h3>1. Local State (Default)</h3><p>The state file is stored on your local machine.</p><pre>terraform {<br>  backend &quot;local&quot; {<br>    path = &quot;terraform.tfstate&quot;<br>  }<br>}</pre><p><strong>Use case</strong></p><ul><li>Learning or small POCs</li></ul><p><strong>Limitations</strong></p><ul><li>No locking</li><li>Easy to lose</li><li>Not suitable for teams</li></ul><h3>2. AWS S3 Backend</h3><p>State is stored in an <strong>S3 bucket</strong>, with locking handled by <strong>DynamoDB</strong>.</p><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket         = &quot;my-tf-state-bucket&quot;<br>    key            = &quot;prod/terraform.tfstate&quot;<br>    region         = &quot;us-east-1&quot;<br>    use_lockfile   = true<br>    encrypt        = true<br>  }<br>}</pre><p><strong>Why it’s popular</strong></p><ul><li>Highly reliable</li><li>Secure and encrypted</li><li>Supports state locking</li></ul><p><strong>Best for</strong></p><ul><li>Production workloads on AWS</li></ul><h3>3. GitLab Managed Terraform State</h3><p>GitLab stores the state <strong>inside the GitLab project</strong> using an HTTP backend.</p><pre>terraform {<br>  backend &quot;http&quot; {}<br>}</pre><p><strong>Why teams use it</strong></p><ul><li>No extra infrastructure</li><li>Built-in locking</li><li>Native GitLab CI/CD support</li></ul><p><strong>Best for</strong></p><ul><li>Teams already using GitLab pipelines</li></ul><p>we have to configure with terraform init</p><pre>terraform init \<br>        -backend-config=&quot;address=$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/$TF_STATE_NAME&quot; \<br>        -backend-config=&quot;lock_address=$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/$TF_STATE_NAME/lock&quot; \<br>        -backend-config=&quot;unlock_address=$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/$TF_STATE_NAME/lock&quot; \<br>        -backend-config=&quot;username=gitlab-ci-token&quot; \<br>        -backend-config=&quot;password=$CI_JOB_TOKEN&quot; \<br>        -backend-config=&quot;lock_method=POST&quot; \<br>        -backend-config=&quot;unlock_method=DELETE&quot;</pre><h3>4. Terraform Cloud / Enterprise</h3><p>State is managed by <strong>HashiCorp Terraform Cloud</strong>.</p><pre>terraform {<br>  backend &quot;remote&quot; {<br>    organization = &quot;my-org&quot;<br><br>    workspaces {<br>      name = &quot;prod&quot;<br>    }<br>  }<br>}</pre><p><strong>Key advantages</strong></p><ul><li>Remote runs</li><li>RBAC and audit logs</li><li>Drift detection and policies</li></ul><p><strong>Best for</strong></p><ul><li>Large teams and enterprise setups</li></ul><h3>5. Azure Blob Storage</h3><p>State is stored in an <strong>Azure Storage Account</strong>.</p><pre>terraform {<br>  backend &quot;azurerm&quot; {<br>    storage_account_name = &quot;tfstate&quot;<br>    container_name       = &quot;state&quot;<br>    key                  = &quot;prod.tfstate&quot;<br>  }<br>}</pre><p><strong>Best for</strong></p><ul><li>Azure-based infrastructure</li></ul><h3>6. Google Cloud Storage (GCS)</h3><p>State is stored in a <strong>GCS bucket</strong>.</p><pre>terraform {<br>  backend &quot;gcs&quot; {<br>    bucket  = &quot;tf-state-prod&quot;<br>    prefix  = &quot;network&quot;<br>  }<br>}</pre><p><strong>Best for</strong></p><ul><li>GCP environments</li></ul><h3>What NOT to Do</h3><ul><li>Do not commit state to Git</li><li>Do not store state in Jenkins or runner workspaces</li><li>Do not share the same state across environments</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ae3c42fb86f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Read secret from Vault -Vault Setup & Terraform Integration]]></title>
            <link>https://medium.com/@dhilipsingh92/read-secret-from-vault-vault-setup-terraform-integration-cb86e5837257?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb86e5837257</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[vault]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Wed, 31 Dec 2025 12:19:17 GMT</pubDate>
            <atom:updated>2026-01-02T03:22:12.483Z</atom:updated>
            <content:encoded><![CDATA[<p>HashiCorp Vault is used to securely store secrets, while Terraform retrieves those secrets at runtime using <strong>AppRole authentication</strong>.<br> This setup avoids hard-coding secrets.</p><p>Vault Installation on Amazon EC2 (Amazon Linux).</p><p>Spin up the EC2 machine .</p><p><strong>Update System Packages:</strong></p><pre>sudo yum update -y<br>sudo yum install -y yum-utils shadow-utils</pre><ul><li>Ensures latest security patches</li><li>yum-utils is required to manage repositories</li></ul><p><strong>Add HashiCorp Repository:</strong></p><pre>sudo yum-config-manager --add-repo \<br>https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo</pre><ul><li>Adds official HashiCorp RPM repository</li><li>Ensures trusted Vault binaries</li></ul><p><strong>Install Vault:</strong></p><pre>sudo yum install -y vault</pre><p><strong>Verify Vault Version:</strong></p><pre>vault version</pre><p><strong>Create Vault Data Directory:</strong></p><pre>sudo mkdir -p /opt/vault/data<br>sudo chown -R vault:vault /opt/vault<br>sudo chmod 750 /opt/vault</pre><ul><li>Vault runs as vault user</li><li>File storage requires write access</li></ul><p><strong>Configure Vault:</strong></p><p>Edit the configuration : sudo vi /etc/vault.d/vault.hcl</p><pre>ui = true<br><br>storage &quot;file&quot; {<br>  path = &quot;/opt/vault/data&quot;<br>}<br><br>listener &quot;tcp&quot; {<br>  address     = &quot;0.0.0.0:8200&quot;<br>  tls_disable = 1<br>}<br><br>api_addr = &quot;http://PRIVATE IP:8200&quot;<br><br>✔ File backend<br>✔ UI enabled<br>✔ Listening on all interfaces<br>✔ TLS disabled</pre><p><strong>Start and Enable Vault Service:</strong></p><pre>sudo systemctl enable vault<br>sudo systemctl start vault</pre><p>Check status : sudo systemctl status vault</p><p><strong>Configure Vault CLI Environment:</strong></p><pre>export VAULT_ADDR=http://127.0.0.1:8200<br><br>or<br>echo &#39;export VAULT_ADDR=http://127.0.0.1:8200&#39; &gt;&gt; ~/.bashrc</pre><p><strong>Verify Vault Status:</strong></p><pre>vault status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*S3INhhKsDuG70uqbKX-RoA.png" /></figure><p>Vault up and Running .</p><p><strong>Initialize Vault:</strong></p><pre>vault operator init</pre><p>It <strong>generates the master key shares (unseal keys) and the initial root token</strong>, which are required to <strong>unseal and access Vault securely</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*SySwadKf9wqhbmQ_8F5I4Q.png" /></figure><p>Before access the vault ui — key should be unsealed either by ui or cli.</p><p>Root Token for login.</p><p>When you run vault operator init, Vault <strong>splits the master key into 5 share.</strong></p><p>Vault sets a <strong>threshold = 3</strong>, meaning <strong>any 3 of the 5 shares</strong> can reconstruct the master key.</p><p>Loin Vault:</p><p>access with : ip:8200 (54.91.25.199:8200/)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*GueqEt8ch1lFUSkfCTdMXA.png" /></figure><p>Give root token for login .</p><h3>Vault integration with Terraform</h3><p>Terraform integrates with Vault using the <strong>Vault provider</strong> to <strong>authenticate securely (usually via AppRole)</strong> and <strong>read secrets at apply time</strong> without hardcoding them in code or state.</p><p><strong>Enable KV v2 secrets engine:</strong></p><p>CLI:</p><pre>vault secrets enable -path=kv kv-v2</pre><p>GUI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7PSyIXyObWy3eW0GwdMLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GkmQ2NzTMzw1Fuj61TuvuQ.png" /></figure><p>Select KV and save .</p><p><strong>Store a secret:</strong></p><p>by CLI:</p><p>vault kv put kv/sandbox username=”admin” password=”secret123&quot;</p><p>GUI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWsghiuUe17mV-cLPBgwxg.png" /></figure><p><strong>AppRole Authentication:</strong></p><pre>vault auth enable approle</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FeGytxkIRqkbXRV6IQQNYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*3JDyua2UbQ46rhPx.png" /></figure><p><strong>Create policy for Terraform:</strong></p><p>HashiCorp Vault does not support the creation of users in the UI, In <strong>HashiCorp Vault</strong>, you don’t create a “user” the way you do in Linux or a database.<br> Instead, <strong>users are identities created via an <em>auth method</em></strong> (userpass, LDAP, OIDC, AWS, Kubernetes, AppRole, etc.).(we are trying with AppRole)</p><p>Before creating the role, we need to create a policy for that role. This policy enables Terraform to access the ‘kv’ and ‘secret’ folders in Vault.</p><pre>vault policy write terraform - &lt;&lt;EOF<br>path &quot;*&quot; {<br>  capabilities = [&quot;list&quot;, &quot;read&quot;]<br>}<br><br>path &quot;secrets/data/*&quot; {<br>  capabilities = [&quot;create&quot;, &quot;read&quot;, &quot;update&quot;, &quot;delete&quot;, &quot;list&quot;]<br>}<br><br>path &quot;kv/data/*&quot; {<br>  capabilities = [&quot;create&quot;, &quot;read&quot;, &quot;update&quot;, &quot;delete&quot;, &quot;list&quot;]<br>}<br><br><br>path &quot;secret/data/*&quot; {<br>  capabilities = [&quot;create&quot;, &quot;read&quot;, &quot;update&quot;, &quot;delete&quot;, &quot;list&quot;]<br>}<br><br>path &quot;auth/token/create&quot; {<br>capabilities = [&quot;create&quot;, &quot;read&quot;, &quot;update&quot;, &quot;list&quot;]<br>}<br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*fu7Q_S67_UCvSTjq7YSK2w.png" /></figure><p>create a role:</p><pre>vault write auth/approle/role/terraform \<br> secret_id_ttl=30m \<br> token_num_uses=10 \<br> token_ttl=20m \<br> token_max_ttl=30m \<br> secret_id_num_uses=40 \<br> token_policies=terraform</pre><p><strong>Fetch Role ID &amp; Secret ID:</strong></p><pre>vault read auth/approle/role/terraform/role-id<br>vault write -f auth/approle/role/terraform/secret-id</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*S8OI2bitHLoBu4Cd9NuNbQ.png" /></figure><p>Now that we are done with Vault, the next step is to write down the Terraform project and check whether Terraform is able to read the secret from Vault.</p><pre>#main.tf<br><br>provider &quot;aws&quot; {<br>  region = &quot;us-east-1&quot;<br>}<br><br>provider &quot;vault&quot; {<br>  address = &quot;http://&lt;your-ip_address&gt;:8200&quot;<br>  skip_child_token = true<br><br>  auth_login {<br>    path = &quot;auth/approle/login&quot;<br><br>    parameters = {<br>      role_id = &quot;&lt;your-role_id&gt;&quot;<br>      secret_id = &quot;&lt;your-secret_id&gt;&quot;<br>    }<br>  }<br>}<br><br>data &quot;vault_kv_secret_v2&quot; &quot;example&quot; {<br>  mount = &quot;kv&quot; // change it according to your mount<br>  name  = &quot;sandbox&quot; // change it according to your secret<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*DB9sSc5vuEv1Kpxlom0NNQ.png" /></figure><p>Terraform securely consumes Vault secrets <strong>without hardcoding.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb86e5837257" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Provider & Alias Usage in Terraform (with Modules and DR)]]></title>
            <link>https://medium.com/@dhilipsingh92/provider-alias-usage-in-terraform-with-modules-and-dr-065cd8005f63?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/065cd8005f63</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[disaster-recovery]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Fri, 26 Dec 2025 17:17:14 GMT</pubDate>
            <atom:updated>2026-03-17T09:26:35.843Z</atom:updated>
            <content:encoded><![CDATA[<p>This setup uses <strong>Terraform modules</strong> with <strong>multiple AWS regions</strong> to support <strong>DR (Disaster Recovery)</strong>.<br> The <strong>root module</strong> controls <em>which provider (region)</em> is used, while the <strong>child module</strong> stays <strong>provider-agnostic and reusable</strong>.</p><p>Use provider aliases in the root, keep child modules provider-agnostic, and control DR at the module level.</p><p>Provider Flow (Important Concept)</p><pre>Root providers<br>   ↓<br>Module &quot;providers&quot; mapping<br>   ↓<br>Child module resources</pre><p>Example :</p><p>Creating DR resource based on condition if prod else it will create any environment .</p><p>ECR repository creating if env type prod — Repo will be created PROD and DR else it will create only given environment</p><p>Provider.tf</p><pre>provider &quot;aws&quot; {<br>  region = var.primary_region<br>}<br>provider &quot;aws&quot; {<br>  alias  = &quot;secondary&quot;<br>  region = var.secondary_region<br>}</pre><ul><li>aws → primary region</li><li>aws.secondary → DR region</li><li>Providers are defined <strong>only in the root</strong></li></ul><p>main.tf</p><pre>module &quot;ecr_primary&quot; {<br>  source = &quot;./modules/ecr&quot;<br>  repo_name = &quot;app-backend&quot;<br>  envtype   = var.envtype<br>}<br>#Always runs<br>#Uses default AWS provider<br>#Creates ECR in the primary region<br>module &quot;ecr_secondary&quot; {<br>  source = &quot;./modules/ecr&quot;<br><br>  count = var.envtype == &quot;prod&quot; ? 1 : 0<br><br>  providers = {<br>    aws = aws.secondary<br>  }<br><br>  repo_name = &quot;app-backend&quot;<br>  envtype   = var.envtype<br>}<br>#Runs only when envtype = prod<br>#Uses aliased provider<br>#Creates ECR in the secondary (DR) region</pre><p>Child Module :</p><p>modules/ecr/main.tf</p><pre>resource &quot;aws_ecr_repository&quot; &quot;ECR&quot; {<br>  name = &quot;${var.repo_name}-${var.envtype}&quot;<br><br>  image_scanning_configuration {<br>    scan_on_push = true<br>  }<br>}</pre><p>The resource uses <strong>provider.aws implicitly</strong>, which is supplied by the parent module.</p><p>Warning :</p><p>Warning: Reference to undefined provider │ │ on main.tf line 15, in module “ecr_secondary”: │ 15: aws = aws.secondary │ │ There is no explicit declaration for local provider name “aws” in module.ecr_secondary, so Terraform is assuming you mean to pass a configuration for “hashicorp/aws”. ? │ │ If you also control the child module, add a required_providers entry named “aws” with the source address “hashicorp/aws”.</p><p>Workaround : <strong>child module does NOT strictly need </strong><strong>terraform.tf</strong>, but <strong>you should add it for this warning .</strong></p><p><strong><em>modules/ecr/terraform.tf</em></strong></p><pre>terraform {<br>  required_providers {<br>    aws = {<br>      source = &quot;hashicorp/aws&quot;<br>    }<br>  }<br>}</pre><h3>Summary</h3><ul><li>Root module defines <strong>providers and aliases</strong></li><li>Root decides <strong>when DR runs</strong></li><li>Child module:</li><li>Declares required_providers</li><li>Does <strong>not</strong> define providers or aliases</li><li>This results in:</li><li>Clean state</li><li>Simple mental model</li><li>Production-ready DR design</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=065cd8005f63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securely Share an S3 Bucket with AWS SSO Users — Without ACL]]></title>
            <link>https://medium.com/@dhilipsingh92/securely-share-an-s3-bucket-with-aws-sso-users-without-acl-acdd63467b95?source=rss-8c799b9dde11------2</link>
            <guid isPermaLink="false">https://medium.com/p/acdd63467b95</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Dhilipsingh G]]></dc:creator>
            <pubDate>Mon, 22 Dec 2025 15:35:04 GMT</pubDate>
            <atom:updated>2025-12-22T15:35:04.860Z</atom:updated>
            <content:encoded><![CDATA[<h3>Securely Share an S3 Bucket with AWS SSO Users — Without ACL</h3><p>Sharing S3 buckets across teams is a common challenge in AWS.<br> With <strong>modern best practices</strong>, you can give <strong>AWS SSO users access</strong> to your bucket safely, without using ACLs, and maintain <strong>auditable, scalable access control</strong>.</p><p>The below steps involve creating an Amazon S3 bucket and granting access to AWS SSO users using AWS-recommended best practices</p><ul><li>Create an S3 bucket (private by default)</li><li>Configure Object Ownership as <strong>BucketOwnerEnforced</strong> to disable ACLs</li><li>Enable S3 Public Access Block to prevent ACL-based access</li><li>Identify the AWS SSO IAM role created by the permission set</li><li>Grant access to the SSO role using an S3 bucket policy</li></ul><h3>Step 1: Create the S3 Bucket</h3><p>Start by creating a bucket. Buckets are private by default, which is a good starting point.</p><pre>resource &quot;aws_s3_bucket&quot; &quot;s3secure&quot; {<br>  bucket = &quot;devops-1222202509&quot;<br>}<br>#Bucket names must be globally unique</pre><h3>Step 2: Enforce Bucket Ownership</h3><p>Modern AWS recommends <strong>BucketOwnerEnforced</strong> for all new buckets. This disables ACLs and ensures the bucket owner owns all objects.</p><pre>resource &quot;aws_s3_bucket_ownership_controls&quot; &quot;example&quot; {<br>  bucket = aws_s3_bucket.s3secure.id<br><br>  rule {<br>    object_ownership = &quot;BucketOwnerEnforced&quot;<br>  }<br>}</pre><ul><li>ACLs are disabled (less complexity, more security)</li><li>All objects are owned by the bucket owner</li><li>Prevents accidental public exposure</li></ul><h3>Step 3: Configure Public Access Block</h3><p>AWS blocks public access by default. To allow explicit bucket policies while still being secure:</p><pre>resource &quot;aws_s3_bucket_public_access_block&quot; &quot;example&quot; {<br>  bucket = aws_s3_bucket.s3secure.id<br><br>  block_public_acls       = trueb<br>  ignore_public_acls      = true<br>  block_public_policy     = false<br>  restrict_public_buckets = false<br>}</pre><p>Public access is now controlled <strong>only by bucket policies</strong>, not ACLs.</p><p><strong>Step 4: Identify the SSO Role</strong></p><p>AWS SSO users <strong>assume a role in the account</strong>, created automatically based on the permission set.</p><p>Example SSO role ARN:</p><p>arn:aws:iam::123456789012:role/AWSReservedSSO_DevTeam_ABC123</p><h3>Step 5: Create a Bucket Policy for the SSO Role</h3><p>Grant the SSO role access to the bucket. This is the modern, best-practice way to share access</p><pre>resource &quot;aws_s3_bucket_policy&quot; &quot;sso_access&quot; {<br>  bucket = aws_s3_bucket.s3secure.id<br><br>  policy = jsonencode({<br>    Version = &quot;2012-10-17&quot;<br>    Statement = [<br>      {<br>        Sid = &quot;AllowSSOUsersFullAccess&quot;<br>        Effect = &quot;Allow&quot;<br>        Principal = { AWS = [&quot;arn:aws:iam::123456789012:role/AWSReservedSSO_DevTeam_ABC123&quot;] }<br>        Action = [<br>          &quot;s3:GetObject&quot;,<br>          &quot;s3:PutObject&quot;,<br>          &quot;s3:DeleteObject&quot;<br>        ]<br>        Resource = &quot;${aws_s3_bucket.s3secure.arn}/*&quot;<br>      },<br>      {<br>        Sid = &quot;AllowSSOUsersListBucket&quot;<br>        Effect = &quot;Allow&quot;<br>        Principal = { AWS = [&quot;arn:aws:iam::123456789012:role/AWSReservedSSO_DevTeam_ABC123&quot;] }<br>        Action = &quot;s3:ListBucket&quot;<br>        Resource = &quot;${aws_s3_bucket.s3secure.arn}&quot;<br>      }<br>    ]<br>  })<br>}</pre><p>By following these steps, S3 access for AWS SSO users is implemented using <strong>AWS best practices</strong>. The bucket remains private, object ownership is enforced at the bucket level, and access is granted through <strong>role-based bucket policies</strong> rather than ACLs. This approach ensures <strong>clear ownership, better security, easier auditing, and scalability</strong>, while allowing teams to collaborate safely using AWS SSO–managed roles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acdd63467b95" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>