<?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 Aviral Agarwal on Medium]]></title>
        <description><![CDATA[Stories by Aviral Agarwal on Medium]]></description>
        <link>https://medium.com/@agarwalaviral065?source=rss-b075fd32a71f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4T647837gIjtmE9o</url>
            <title>Stories by Aviral Agarwal on Medium</title>
            <link>https://medium.com/@agarwalaviral065?source=rss-b075fd32a71f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 16:45:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@agarwalaviral065/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[Deep Dive into Kubernetes Secrets Store CSI Driver]]></title>
            <link>https://medium.com/@agarwalaviral065/deep-dive-into-kubernetes-secrets-store-csi-driver-cf7f5e4e94c4?source=rss-b075fd32a71f------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf7f5e4e94c4</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[csi-secret-store]]></category>
            <category><![CDATA[secret-store-csi-driver]]></category>
            <category><![CDATA[kubernetes-security]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <dc:creator><![CDATA[Aviral Agarwal]]></dc:creator>
            <pubDate>Fri, 22 May 2026 11:33:03 GMT</pubDate>
            <atom:updated>2026-05-22T11:33:03.723Z</atom:updated>
            <content:encoded><![CDATA[<h3>Following the Journey of a Secret from an External Secret Store to Your Pod</h3><p>Every Kubernetes engineer starts with the same assumption: Secrets are simple.</p><p>You create a Kubernetes Secret, mount it into a pod, and move on. For small environments, this works perfectly fine. A database password here, an API token there, maybe a TLS certificate mounted into NGINX. Initially, it all feels manageable.</p><p>But Kubernetes clusters rarely stay small.</p><p>As environments grow, secrets begin spreading everywhere. The same credential gets copied across namespaces. CI/CD pipelines start injecting secrets dynamically. Teams create different versions for staging and production. Rotating credentials suddenly becomes risky because nobody is completely sure which workloads still depend on the old value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*NWV1CFxU1qDITCRU.gif" /><figcaption>source: google.com</figcaption></figure><p>Eventually, someone accidentally commits a secret to Git, and from that moment onward, the platform team starts rethinking the entire approach.</p><p>Native Kubernetes Secrets are still stored inside Etcd. Even though they appear abstracted behind YAML objects, they are ultimately persisted within the Kubernetes control plane itself. As organisations mature, security teams begin asking uncomfortable but important questions:</p><ul><li>Where exactly are secrets stored?</li><li>Who can retrieve them?</li><li>How are secrets rotated safely?</li><li>Can workloads access only the secrets they actually need?</li><li>Why are the same secrets duplicated across multiple clusters and namespaces?</li></ul><p>And this is usually the moment engineers discover the Secrets Store CSI Driver.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdfGvHHbVi2FYvwOvqRlDA.png" /><figcaption>source: <a href="https://secrets-store-csi-driver.sigs.k8s.io/concepts">https://secrets-store-csi-driver.sigs.k8s.io/concepts</a></figcaption></figure><p>Traditionally, the architecture looked something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEGR4wi--Kfjko56_Jjmcw.png" /></figure><p>The secret becomes another Kubernetes object. It gets stored in etcd, replicated across the control plane, cached internally, and managed like every other resource in the cluster.</p><p>The CSI driver changes this model completely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lJrs2AN3eZLh392xqJx6fQ.png" /></figure><p>Now, Kubernetes no longer behaves as the permanent storage layer for secrets. Instead, it becomes a runtime delivery mechanism. Secrets remain inside dedicated secret management systems, like:</p><ul><li>AWS Secrets Manager</li><li>Azure Key Vault</li><li>Google Secret Manager</li><li>HashiCorp Vault</li></ul><p>and are only fetched dynamically when the pod actually starts.</p><p>This sounds like a small architectural change, but operationally it is enormous.</p><p>Secrets become centralized. Rotation becomes cleaner. Persistence reduces dramatically. Workloads retrieve secrets only when needed. And perhaps most importantly, Kubernetes itself stops becoming the long-term home for sensitive credentials.</p><p>To understand why this architecture works so elegantly, we first need to understand CSI itself.</p><h3>CSI — The Invisible Layer Behind Modern Kubernetes Storage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PkNmfgmFwC10H2g81vsvEw.png" /><figcaption>source: x.com/twtayaan</figcaption></figure><p>At a high level, CSI is simply a standardized way for Kubernetes to communicate with external storage systems. Before CSI existed, every storage vendor had its own custom Kubernetes integration. Each implementation behaved differently, upgrades were painful, and Kubernetes itself had storage-specific logic deeply embedded into the platform.</p><p>CSI solved this by introducing a universal interface.</p><p>Kubernetes no longer needs to understand how EBS works internally, or how Ceph provisions storage, or how NFS mounts remote volumes. It simply issues standardized CSI calls, and the driver handles the backend implementation details.</p><p>The clever part is that the <strong>Secrets Store CSI Driver</strong> reuses this exact storage framework for secrets.</p><p>Instead of mounting disks, it mounts secret content.</p><p>That idea sounds unusual initially, but it turns out to be remarkably powerful because Kubernetes already has an extremely mature volume lifecycle system. The CSI driver simply plugs into that lifecycle.</p><p>Most engineers install the Secrets Store CSI Driver using Helm and never think much about what actually runs underneath. But if you inspect the pods deployed on the node, you immediately notice something interesting.</p><p>The driver pod is not a single container.</p><p>It contains multiple containers working together:</p><pre>- node-driver-registrar<br>- secrets-store<br>- liveness-probe</pre><p>The most misunderstood component is usually the node-driver-registrar ironically one of the most important. To understand why the registrar exists, we need to think about kubelet.</p><h3>Kubelet — The Node Agent Orchestrating Everything</h3><p>Kubelet is the primary node agent running on every Kubernetes worker node. It manages pod lifecycle, volume preparation, networking setup, and container runtime interactions. Whenever a pod starts, the kubelet becomes responsible for preparing everything that the pod needs before containers are launched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*cydVTLqaeGsP_UkAZBEtPw.png" /><figcaption>source: TechiesCamp</figcaption></figure><p>But kubelet cannot magically discover CSI drivers on its own. Some mechanism has to introduce the driver to the kubelet, and that is exactly what the registrar container does. When the main CSI driver starts, it exposes a Unix domain socket: <em>/csi/csi.sock</em></p><p>This socket becomes the communication endpoint for CSI gRPC calls.</p><h3>The Registrar Container — The Part Nobody Explains Properly</h3><p>The registrar container connects to this socket internally and then performs a registration workflow with the kubelet. Conceptually, it tells kubelet:</p><blockquote><em>“A CSI driver called </em><em>secrets-store.csi.k8s.io is running on this node, and this is the socket you should use to communicate with it.”</em></blockquote><p>The flow looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNmFIkq5dECUxrBC-iABBQ.png" /></figure><p>Once kubelet accepts this registration, it stores metadata under:</p><pre>/var/lib/kubelet/plugins_registry/</pre><p>From that moment onward, kubelet officially knows the driver exists and understands how to communicate with it.</p><p>This tiny registration sidecar is essentially the discovery layer between kubelet and the CSI ecosystem.</p><p>The actual “<strong>brain</strong>” of the system is the secrets-store container itself.</p><p>This container implements the CSI Node APIs that kubelet interacts with. Operations like:</p><ul><li>NodePublishVolume</li><li>NodeUnpublishVolume</li><li>NodeGetInfo</li></ul><p>are all handled here.</p><p>These APIs originally existed for storage lifecycle management. Kubernetes uses them for attaching and mounting disks. The fascinating part is that the Secrets Store CSI Driver reuses these exact APIs for runtime secret delivery.</p><p>When a pod finally starts, kubelet begins preparing its volumes. If the pod contains a CSI volume referencing:</p><pre>        - csi:<br>            driver: secrets-store.csi.k8s.io<br>            readOnly: true<br>            volumeAttributes:<br>              secretProviderClass: SecretProviderClassName<br>          name: secrets-store</pre><pre>            - mountPath: /mnt/secrets-store<br>              name: secrets-store<br>              readOnly: true</pre><p>kubelet checks its registered CSI drivers and identifies the Secrets Store CSI Driver as responsible for handling this request.</p><p>Kubelet invokes: NodePublishVolume()</p><p>This is the moment where the secret retrieval journey truly begins.</p><p>The request travels over the Unix socket using gRPC communication. The CSI driver receives the request and immediately queries the Kubernetes API server for another critical resource: SecretProviderClass</p><h3>The SecretProviderClass — The Blueprint Behind Every Mount</h3><p>The SecretProviderClass is a namespaced resource in the Secrets Store CSI Driver that provides driver configurations and provider-specific parameters to the CSI driver.</p><p>SecretProviderClass Custom resource should have the following components:</p><pre>apiVersion: secrets-store.csi.x-k8s.io/v1<br>kind: SecretProviderClass<br>metadata:<br>  name: my-provider<br>spec:<br>  provider: vault                             # accepted provider options: akeyless or azure or vault or gcp<br>  parameters:                                 # provider-specific parameters</pre><p>This CRD acts as the configuration blueprint for the driver. It tells the system:</p><ul><li>which provider to use</li><li>which secret objects to retrieve</li><li>authentication configuration</li><li>optional synchronization behavior</li></ul><p>Below you can find and use a sample for the most common providers:</p><p>AZURE</p><pre>apiVersion: secrets-store.csi.x-k8s.io/v1<br>kind: SecretProviderClass<br>metadata:<br>  name: my-provider<br>  namespace: default<br>spec:<br>  provider: azure<br>  parameters:<br>    usePodIdentity: &quot;false&quot;<br>    useManagedIdentity: &quot;false&quot;<br>    keyvaultName: &quot;$KEYVAULT_NAME&quot;<br>    objects: |<br>      array:<br>        - |<br>          objectName: $SECRET_NAME<br>          objectType: secret<br>          objectVersion: $SECRET_VERSION<br>        - |<br>          objectName: $KEY_NAME<br>          objectType: key<br>          objectVersion: $KEY_VERSION<br>    tenantId: &quot;$TENANT_ID&quot;</pre><p>GCP</p><pre>apiVersion: secrets-store.csi.x-k8s.io/v1<br>kind: SecretProviderClass<br>metadata:<br>  name: gcp-secrets-provider<br>  namespace: default<br><br>spec:<br>  provider: gcp<br><br>  parameters:<br>    secrets: |<br>      - resourceName: &quot;projects/PROJECT_ID/secrets/db-password/versions/latest&quot;<br>        path: &quot;db-password&quot;<br><br>      - resourceName: &quot;projects/PROJECT_ID/secrets/api-key/versions/latest&quot;<br>        path: &quot;api-key&quot;<br><br>      - resourceName: &quot;projects/PROJECT_ID/secrets/oauth-secret/versions/latest&quot;<br>        path: &quot;oauth-secret&quot;</pre><p>AWS</p><pre>apiVersion: secrets-store.csi.x-k8s.io/v1<br>kind: SecretProviderClass<br>metadata:<br>  name: aws-secrets-provider<br>  namespace: default<br>spec:<br>  parameters:<br>    objects: |<br>      - objectName: &quot;/prod/secrets/&quot;<br>        objectType: &quot;secretsmanager&quot;<br>        jmesPath:<br>          - path: &quot;MONGODB_URI&quot;<br>            objectAlias: &quot;MONGODB_ITOPS_URI&quot;<br>          - path: &quot;ELASTICSEARCH_HOSTS&quot;<br>            objectAlias: &quot;ELASTICSEARCH_HOSTS&quot;<br>  provider: aws<br>  secretObjects:<br>    - data:<br>        - key: MONGODB_URI<br>          objectName: MONGODB_URI<br>        - key: ELASTICSEARCH_HOSTS<br>          objectName: ELASTICSEARCH_HOSTS<br>      secretName: kubernetes-secret<br>      type: Opaque</pre><p>The CSI driver itself does not directly know how to communicate with AWS Secrets Manager, Azure Key Vault, or Google Secret Manager. Instead, separate provider plugins exist for each platform.</p><h3>The Provider Plugin — Where Cloud-Specific Logic Lives</h3><p>The CSI driver simply delegates provider-specific work.</p><p>Internally, the architecture now looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*lE-RHBmiUn7ExD5knVXMXw.png" /></figure><p>This separation is extremely important because it keeps the CSI driver generic while allowing providers to evolve independently.</p><p>At this point, the provider plugin takes over.</p><p>Authentication mechanisms vary depending on the cloud platform:</p><ul><li>IRSA on AWS</li><li>Workload Identity on GCP</li><li>Managed Identity on Azure</li></ul><p>But conceptually, the process remains the same.</p><p>The provider obtains temporary credentials tied to the workload identity of the pod itself. This eliminates the need for static credentials embedded inside applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5AihuC5bz7k3ajuor6Edvg.png" /></figure><p>Once authenticated, the provider fetches the requested secret from the external secret store and returns the payload to the CSI driver.</p><p>One common misconception is that since the Secrets Store CSI Driver uses Kubernetes volumes, it must be provisioning persistent storage like EBS, Ceph, SSDs, or local disks. But that’s not actually what happens. One of the most important implementation details of the Secrets Store CSI Driver is that secrets are mounted using tmpfs, which is a memory-backed filesystem. The secret is never written to persistent storage and exists only in RAM during the lifetime of the pod.</p><p>The secret is never written to persistent storage, such as EBS, SSDs, or local disks. Instead, it exists only in RAM during the lifetime of the pod.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SR-wm6jPp-Wb0czOx5S77Q.png" /></figure><p>When the pod is deleted, the mount disappears and the memory is automatically reclaimed. This makes the architecture both operationally lightweight and significantly more secure than traditional persistent secret storage models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KqyWXs7pE8YTg1h0b2QRUQ.png" /></figure><p>Finally, once the mount operation succeeds, kubelet completes the volume lifecycle and starts the application container.</p><p>One of the most interesting parts of the Secrets Store CSI Driver is that while the mounted secrets themselves are ephemeral, Kubernetes still needs a way to track what happened during the mount process.</p><p>Think about the challenges Kubernetes faces internally:</p><ul><li>Which pod mounted which secret?</li><li>Which SecretProviderClass was used?</li><li>Which object versions were retrieved?</li><li>Where exactly was the secret mounted?</li><li>Did the mount succeed?</li><li>What should happen during rotation?</li><li>How does cleanup work when the pod dies?</li></ul><p>This is where another CRD quietly enters the architecture:SecretProviderClassPodStatus</p><h3>What SecretProviderClassPodStatus Actually Does</h3><p>Whenever the CSI driver successfully mounts secrets for a pod, it creates a SecretProviderClassPodStatus resource in the same namespace.</p><p>Conceptually, this resource acts like a runtime tracking record.</p><p>It tells Kubernetes:</p><blockquote><em>“This pod mounted these secret objects using this SecretProviderClass, and here’s where the mount exists on the node.”</em></blockquote><h3>What the Resource Contains</h3><p>A real SecretProviderClassPodStatus contains surprisingly detailed runtime information.</p><p>It tracks:</p><ul><li>whether the mount succeeded</li><li>which secret objects were loaded</li><li>object versions</li><li>pod ownership</li><li>mount target paths</li><li>associated SecretProviderClass</li></ul><p>For example:</p><pre>status:<br>  mounted: true<br><br>  objects:<br>    - id: secret/db-secret<br>      version: a1b2c3d4<br><br>    - id: secret/api-key<br>      version: x9y8z7<br><br>  podName: payments-api<br><br>  secretProviderClassName: app-secrets<br><br>  targetPath: /var/lib/kubelet/pods/.../mount</pre><p>This becomes extremely useful during debugging.</p><p>Suppose a team says:</p><blockquote><em>“Our pod is still using an old database password.”</em></blockquote><p>You can now inspect:</p><ul><li>which version got mounted</li><li>whether rotation occurred</li><li>which pod consumed which secret version</li><li>and whether the mount updated correctly.</li></ul><p>Without this CRD, troubleshooting runtime secret state would become much harder.</p><h3>The Clever Cleanup Mechanism</h3><p>Another elegant detail is ownership management.</p><p>The SecretProviderClassPodStatus resource automatically sets the pod as its owner reference.</p><p>Meaning:</p><pre>Pod deleted → PodStatus resource deleted automatically</pre><p>This aligns perfectly with the ephemeral design philosophy of the CSI driver. The system cleans itself up automatically. No stale tracking resources remain behind after workload deletion.</p><h3>But What About Applications That Still Need Environment Variables?</h3><p>At this point in the story, we realize something important.</p><p>Mounted secret files are great for modern applications but many existing applications still expect env vars. This is especially common with:</p><ul><li>third-party Helm charts</li><li>legacy applications</li><li>Java applications</li><li>older twelve-factor apps</li><li>frameworks that only support env vars</li></ul><p>So naturally the next question becomes:</p><blockquote><em>“Can the CSI driver still create Kubernetes Secrets?”</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/0*BK8nzPXGibNY6vBS.gif" /></figure><h3>Bridging External Secrets with Native Kubernetes Secrets</h3><p>The CSI driver can optionally synchronize mounted secrets into a native Kubernetes Secret object. This creates a fascinating hybrid model.</p><p>Internally the flow becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLY7xetEF57EGSZTlYSqLw.png" /></figure><h3>How secretObjects Works</h3><p>Inside the SecretProviderClass, you can define:</p><pre>secretObjects:<br>  - secretName: kubernetes-secret<br>    type: Opaque<br><br>    data:<br>      - key: MONGODB_URI<br>        objectName: MONGODB_URI<br><br>      - key: ELASTICSEARCH_HOSTS<br>        objectName: ELASTICSEARCH_HOSTS</pre><p>This tells the CSI driver:</p><blockquote><em>“After mounting these external secrets, also create a Kubernetes Secret containing these keys.”</em></blockquote><p>The CSI driver performs this synchronization automatically during the mount lifecycle.</p><h3>Finally — Using the Synced Secret as Environment Variables</h3><p>Once the Kubernetes Secret exists, workloads can consume it normally.</p><p>For example:</p><pre>env:<br>  - name: MONGODB_URI<br>    valueFrom:<br>      secretKeyRef:<br>        name: kubernetes-secret<br>        key: MONGODB_URI<br><br>  - name: ELASTICSEARCH_HOSTS<br>    valueFrom:<br>      secretKeyRef:<br>        name: kubernetes-secret<br>        key: ELASTICSEARCH_HOSTS</pre><p>And this is the moment where the entire architecture finally comes together:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ndrLTL9wlkh8-KT73vcCWw.png" /></figure><p>What initially looked like “just mounting a secret into a pod” turns out to be a deeply orchestrated workflow involving kubelet, CSI lifecycle APIs, provider plugins, workload identity, external secret stores, Kubernetes reconciliation logic, and ephemeral in-memory mounts — all working together in real time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*UQDbffZ2J5eCZhOh1dhDrw.gif" /></figure><h3>Glossary &amp; Further Reading</h3><p>If you want to explore the internals of the Secrets Store CSI Driver more deeply, these are some of the best resources across official documentation, provider implementations, and real-world engineering writeups.</p><h4>Secrets Store CSI Driver Concepts</h4><p>The best starting point: <a href="https://secrets-store-csi-driver.sigs.k8s.io/concepts.html?utm_source=chatgpt.com">Secrets Store CSI Driver Concepts Documentation</a></p><h4>Secrets Store CSI Driver GitHub Repository</h4><p>Official project repository: <a href="https://github.com/kubernetes-sigs/secrets-store-csi-driver?utm_source=chatgpt.com">Secrets Store CSI Driver GitHub Repository</a></p><h4>CSI (Container Storage Interface) Documentation</h4><p>Official project repository: <a href="https://github.com/container-storage-interface/spec?utm_source=chatgpt.com">CSI Specification GitHub Repository</a></p><h3>Cloud Provider Integrations</h3><p>AWS: <a href="https://github.com/aws/secrets-store-csi-driver-provider-aws?utm_source=chatgpt.com">AWS Provider for Secrets Store CSI Driver</a></p><p>Azure Key Vault: <a href="https://github.com/Azure/secrets-store-csi-driver-provider-azure?utm_source=chatgpt.com">Azure Key Vault Provider for Secrets Store CSI Driver</a></p><p>GCP: <a href="https://github.com/GoogleCloudPlatform/secrets-store-csi-driver-provider-gcp?utm_source=chatgpt.com">GCP Provider for Secrets Store CSI Driver</a></p><h3>Secrets Store CSI Driver vs External Secrets Operator</h3><p>A good comparison of:</p><ul><li>runtime mounts</li><li>synced Kubernetes Secrets</li><li>operational tradeoffs</li></ul><p><a href="https://www.kubeblog.com/kubernetes/secrets-store-csi-driver-vs-external-secrets-operator/?utm_source=chatgpt.com">Secrets Store CSI Driver vs External Secrets Operator</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf7f5e4e94c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering AWS Direct Connect: A Step-by-Step Guide to Seamless Connectivity]]></title>
            <link>https://medium.com/@agarwalaviral065/mastering-aws-direct-connect-a-step-by-step-guide-to-seamless-connectivity-9b6dbff5f5bc?source=rss-b075fd32a71f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b6dbff5f5bc</guid>
            <category><![CDATA[network-connectivity]]></category>
            <category><![CDATA[network-connection]]></category>
            <category><![CDATA[cloud-services]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-direct-connect]]></category>
            <dc:creator><![CDATA[Aviral Agarwal]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 17:01:13 GMT</pubDate>
            <atom:updated>2025-01-16T17:09:14.442Z</atom:updated>
            <content:encoded><![CDATA[<p>This article offers a streamlined guide to setting up AWS Direct Connect, covering the key components like Virtual Interfaces (VIFs), AWS Transit Gateway, and route propagation. It walks through the process of establishing a secure, high-performance connection between your on-premises network and AWS, ensuring efficient communication across multiple VPCs. Whether you’re optimizing for lower latency, improved bandwidth, or better cloud integration, this guide provides clear instructions and best practices to help you successfully configure AWS Direct Connect for your infrastructure.</p><p>What is AWS Direct Connect?</p><p>AWS Direct Connect links your internal network to an AWS Direct Connect location over a standard Ethernet fibre-optic cable. One end of the cable is connected to your router, the other to an AWS Direct Connect router. With this connection, you can create <em>virtual interfaces</em> directly to public AWS services (for example, to Amazon S3) or to Amazon VPC, bypassing internet service providers in your network path. [1]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*Uk7AZcg0C-LHKG8SKu7Ieg.png" /><figcaption>Image src: Amazon</figcaption></figure><p>Let’s do a component by component breakdown of the above diagram, to understand the AWS direct connect architecture in a better manner.<br> <br> There are three major components in this, AWS VPC on the left side, direct connect setup in the centre and finally the customer/on-prem router on the right side.<br> <br>Lets start with the centrepiece of the puzzle, the direct connect.</p><p>It has the following components:<br> <br><strong> a) The DX connection</strong></p><p>The DX connection is the actual fibre cable link setup b/w aws router and your on-prem router. Create a <em>connection</em> in an AWS Direct Connect location to establish a network connection from your premises to an AWS Region.<br> <br> So there are two ways to create a connection on AWS Direct connect, either create a connection or accept a connection <br> <br> <strong>Scenario 1 — Create a Connection</strong></p><p>1. Select <strong>Connection ordering type<br> </strong>Connection ordering type can be of two types :<br> &lt;&gt; Connection Wizard<br> &lt;&gt; Classic <br> Connection Wizard is generally preferred for high availability, it provides three levels of resiliency.<br> <br> i) Maximum Resiliency<br> You can achieve maximum resiliency for critical workloads by using separate connections that terminate on separate devices in more than one location (as shown in the figure). This topology provides resiliency against device, connectivity, and complete location failures.[4]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*ijQ0M6lzGmKyth26zHzQ8w.png" /><figcaption>Image src: Amazon</figcaption></figure><p>ii) High Resiliency <br> You can achieve high resiliency for critical workloads by using two single connections to multiple locations (as shown in the figure). This topology provides resiliency against connectivity failures caused by a fiber cut or a device failure. It also helps prevent a complete location failure.[4]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*AAmcsDxXtZEIoxupv5vXRA.png" /><figcaption>Image src: AWS</figcaption></figure><p>iii) Development and Test<br> <br> You can achieve development and test resiliency for non-critical workloads by using separate connections that terminate on separate devices in one location (as shown in the figure). This topology provides resiliency against device failure, but does not provide resiliency against location failure.[4]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*lmGw83gLUJ7a7LXJx4gXHg.png" /><figcaption>Image src: AWS</figcaption></figure><p>2. Select <strong>Connections Settings<br> <br> </strong>You need to configure connection settings, based on type of resiliency selected, have to set the connection bandwidth and data centre to connect with<br> <br> Sample Connection settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*QxLMyE7ghAtWtl5dio2LFw.png" /><figcaption>Note: Make sure to Select the correct on-prem centre</figcaption></figure><p><strong>Scenario 2— </strong>Accept a Direct Connect Connection</p><p>If the partner has initiated a direct connect connection in your account, you need to accept the connection.After Having a successful connection this will come in available state and now its good to use.</p><p>As stated earlier Direct Connect connections are like a lease line so you need an interface to interact with it, for this we need to create a direct connect gateway and virtual interface.</p><p><strong>b) Direct Connect Gateway</strong></p><p>A Direct Connect gateway is a globally available resource. You can connect to any Region globally using a Direct Connect gateway.<br> <br> We can use AWS Direct Connect gateway to connect your VPCs. You associate an AWS Direct Connect gateway with either of the following gateways:</p><ul><li>A transit gateway when you have multiple VPCs in the same Region</li><li>A virtual private gateway</li></ul><p>To know more about Transit gateway and virtual private gateway visit respective <a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/how_it_works.html">aws documentation</a>.[2]<br> <br> For creating a direct Connect Gateway, you need to specify the name and amazon side ASN.</p><p><strong>Amazon side ASN</strong>: Specify the ASN for the Amazon side of the BGP session. The ASN must be in the 64,512 to 65,534 range or 4,200,000,000 to 4,294,967,294 range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*1oN6RdN4oOWWbRSTtk6uSQ.png" /><figcaption>Image src: AWS</figcaption></figure><p>The next step is creating the actual interface which will interact with the DX connection.</p><p><strong>c) Virtual Interface</strong></p><p>A virtual interface in AWS Direct Connect is essentially a logical connection that allows your on-premises network (your company’s data centre or office network) to interact with AWS’s cloud services. It acts as the “gateway” between your network and AWS, but how it’s set up and used depends on wether you want to access public or private AWS resources.</p><p>There are three main types of virtual interfaces in AWS Direct Connect:</p><p><strong>Private Virtual Interface (Private VIF)</strong>:</p><ul><li>This is used to connect directly to your <strong>Amazon Virtual Private Cloud (VPC)</strong>.</li><li>Think of it as a private, dedicated connection between your on-premises network and your cloud infrastructure. It gives you more control over traffic, improves performance, and is generally more secure than going over the public internet.</li><li>It allows you to access internal AWS resources, like EC2 instances, databases, or any private services within your VPC.</li></ul><p><strong>Public Virtual Interface (Public VIF)</strong>:</p><ul><li>This is used to access <strong>AWS public services</strong> that are hosted outside of your VPC, like S3 (Simple Storage Service), DynamoDB, or AWS’s public APIs.</li><li>With a public VIF, you’re essentially connecting to AWS over a private link, but you’re still accessing publicly available services (like using the internet but in a more reliable, private way).</li></ul><p><strong>IN — Transit VIF<br> </strong><br> This type of interface is used to access one or more Amazon VPC Transit Gateways associated with Direct Connect gateways. With a transit virtual interface you connect multiple Amazon VPC Transit Gateways across multiple accounts and AWS Regions (except the AWS China Regions).</p><p><strong>Cross-Account Access</strong>: You might want to transfer data between two different AWS accounts but keep it private and secure, without going over the public internet.</p><p><strong>Cross-Region Access</strong>: If you’re working with resources in different AWS regions and want to connect them directly without routing the traffic over the public internet.</p><p>A virtual interface has some less popular configuration that people are not very familiar with but lets understand each parameter one by one.</p><p>First thing is to select <strong>Virtual interface type<br> </strong>There are three types, a) Private b) Public c) In-Transit<br> <br> A private virtual interface should be used to access an Amazon VPC using private IP addresses.<br> <br>A public virtual interface can access all AWS public services using public IP addresses.<br> <br> A transit virtual interface is a VLAN that transports traffic from a Direct Connect gateway to one or more transit gateways.<br> <br> So we will be creating a Transit Virtual Interface because it will help us understand transit gateway as well which is a black box for many of the readers.<br> <br> First give a name to the virtual interface and then select the direct connect Connection,This will be the physical connection on which the new virtual interface will be provisioned.</p><ol><li>For <strong>Virtual interface name</strong>, enter a name for the virtual interface.</li><li>For <strong>Connection</strong>, choose the Direct Connect connection that you want to use for this interface.</li><li>For <strong>Virtual interface owner</strong>, choose <strong>My AWS account</strong> if the virtual interface is for your AWS account.</li><li>For <strong>Direct Connect gateway</strong>, select the Direct Connect gateway.</li><li>For <strong>VLAN</strong>, enter the ID number for your virtual local area network (VLAN).</li><li>For <strong>BGP ASN</strong>, enter the Border Gateway Protocol Autonomous System Number of your on-premises peer router for the new virtual interface, The valid values are 1 to 2147483647.[3]</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*K2slezY7mm6h8PrdsfauhQ.png" /><figcaption>Image src: AWS</figcaption></figure><p>Under <strong>Additional Settings</strong>, do the following:</p><ol><li>To configure an IPv4 BGP or an IPv6 peer, do the following:</li></ol><p>[IPv4] To configure an IPv4 BGP peer, choose <strong>IPv4</strong> and do one of the following:</p><ul><li>To specify these IP addresses yourself, for <strong>Your router peer ip</strong>, enter the destination IPv4 CIDR address to which Amazon should send traffic.</li><li>For <strong>Amazon router peer ip</strong>, enter the IPv4 CIDR address to use to send traffic to AWS.<br><strong>Important</strong></li><li>If you let AWS auto-assign IPv4 addresses, a /29 CIDR will be allocated from 169.254.0.0/16 IPv4 Link-Local according to RFC 3927 for point-to-point connectivity. AWS does not recommend this option if you intend to use the customer router peer IP address as the source and/or destination for VPC traffic. Instead you should use RFC 1918 or other addressing (non-RFC 1918), and specify the address yourself, For more information about RFC 1918, see <a href="https://datatracker.ietf.org/doc/html/rfc1918">Address Allocation for Private Internets</a>, For more information about RFC 3927, see <a href="https://datatracker.ietf.org/doc/html/rfc3927">Dynamic Configuration of IPv4 Link-Local Addresses</a>. [3]</li></ul><p>[IPv6] To configure an IPv6 BGP peer, choose <strong>IPv6</strong>. The peer IPv6 addresses are automatically assigned from Amazon’s pool of IPv6 addresses. You cannot specify custom IPv6 addresses.</p><p>2. To change the maximum transmission unit (MTU) from 1500 (default) to 8500 (jumbo frames), select <strong>Jumbo MTU (MTU size 8500)</strong>.</p><p>3. (Optional) Under <strong>Enable SiteLink</strong>, choose <strong>Enabled</strong> to enable direct connectivity between Direct Connect points of presence.[3]</p><p>4. (Optional) Add or remove a tag.</p><p>5. [Add a tag] Choose <strong>Add tag</strong> and do the following:</p><ul><li>For <strong>Key</strong>, enter the key name.</li><li>For <strong>Value</strong>, enter the key value.</li></ul><p>[Remove a tag] Next to the tag, choose <strong>Remove tag</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*-T2fF74WV6FCQQfjdhCoqw.png" /><figcaption>Image src: AWS</figcaption></figure><p>Choose <strong>Create virtual interface</strong>.</p><p>Once you create the virtual interface successfully, can check in your direct connect gateway in virtual interface attachments you will be seeing your virtual interface attached. <br> Once all of the above configurations are completed correctly, state for your device would be available and your BGP status is up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*Db_6O6cQQ1TQgk6xqPB27Q.png" /></figure><p>Now the centrepiece of the diagram is complete, let’s move to the left side our very own aws vpc and it resources. Next, we will understand how to actually publish your routes over the direct connect using a transit gateway. Since, I want to touch base on transit gateway as well in this read, I will be using a transit vif to setup connectivity b/w aws vpc and direct connect.</p><p>Let’s first start with creating a transit gateway….<br> <br>Think of AWS Transit Gateway (TGW) as a central train station in a city, connecting various neighborhoods (VPCs) and on-premises networks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*ZEo5CRDe5xUqxZxE-q0iag.gif" /></figure><p>Key Points</p><ul><li>Central Hub: Just like a train station where all lines converge, TGW serves as the central point for connecting multiple VPCs and networks.</li><li>Efficient Routing: Passengers transfer easily at the station to reach different neighborhoods without direct tracks. Similarly, data routes through TGW without needing individual connections between each VPC.</li><li>Scalability: New neighborhoods can connect to the central station easily. In the same way, new VPCs can integrate with TGW effortlessly.</li><li>Reduced Complexity: Instead of maintaining numerous direct train tracks, the central station simplifies travel. TGW reduces operational complexity by managing connections centrally.</li><li>Interconnectivity: The station allows travel between different city regions without separate lines. TGW facilitates communication between VPCs across different AWS regions.<br> <br> To create a Transit Gateway ,<br> <br> &lt;&gt; Give the name<br> &lt;&gt; Enter Description<br> &lt;&gt; Enter the Amazon Side ASN <br> &lt;&gt; In the Transit Gateway CIDR block give the CIDR needs to be advertised over the Direct Connect Gateway. This will essentially be your vpc cidr or a particular subnet in your vpc.<br> <br> Note: This the Amazon side ASN given while configuring the virtual interface must be different from the ASN entered here, else the connection establishment will fail.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*WeEBf-hqV7E6gfXC02Dfvg.png" /><figcaption>Image src: AWS</figcaption></figure><p>Once transit Gateway is created, it will show as available</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*FQ7Y_BiviltaR_8IO8K0FA.png" /></figure><p>Now we have the resource which will attach our internal resources to the direct connect, there will be two connections:</p><p>1. VPC connection to the transit gateway via a transit gateway attachement</p><p>2. Direct connect gateway connection to the transit gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yxS0cee6S0pAcjbVv7zaog.png" /><figcaption>Direct Connect Connection Setup</figcaption></figure><p>lets start making vpc connection, create a transit gateway attachment.<br> Note: Assuming VPC is created here <br> <br> To create a Transit Gateway attachment, <br> <br> a) Enter Name <br> b) Select the attachment Type- Here we will select as VPC <br> c) Select the VPC ID to be attached with<br> d) Click on Create transit gateway attachment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*5mQ4yPyciQW5hpAJXdKMHg.png" /><figcaption>Image src: AWS</figcaption></figure><p>Now we are ready for associating our transit gateway to the direct connect gateway which is the final bridge for connecting our VPC resources to the client network via Direct Connect. <br> <br> a) Open up the Direct Connect gateway, and select gateway associations. Tab.<br> <br> b) Select Associate Gateway and select the Transit gateway from the drop down.<br> <br> c) Add the same CIDR you entered while creating transit gateway to be published in allowed prefixes. <br> <br> d) It will be simply the VPC cidr but you can enter additional cidrs as well one use case is natting, if we want to perform natting on our end, send and advertise the natted ips to client we would need to add it here. (Feel free to reach out to me, incase you need some further help with this kind of natting)</p><p>e) Now simply click on Associate Gateway</p><p>Important notes: <br> <br> 1. The transit gateway propagation route table is the place where you will see routes being published from both sides and it will be categorized as route type propagated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*3fkmaEy5Gf7yq-UuLqN7FQ.png" /></figure><p>2. If you want to fwd some request from an ec2 instance to the customer advertised CIDR destination, in the route table of the ec2 instance can fwd traffic to the advertised destination to the transit gateway, rest AWS will take care.</p><p>In conclusion, AWS Direct Connect offers a powerful way to establish secure, high-performance connectivity between your on-premises network and the AWS Cloud. By leveraging the right components — such as Virtual Interfaces and Transit Gateways — you can streamline your network architecture for improved efficiency and scalability. With the right setup, Direct Connect can enhance both your cloud and on-premises infrastructure, delivering faster, more reliable data transfer for your business needs.</p><p>Glossary and Related Links:</p><p>[1]<a href="https://docs.aws.amazon.com/directconnect/latest/UserGuide/Welcome.html">https://docs.aws.amazon.com/directconnect/latest/UserGuide/Welcome.html</a></p><p>[2] <a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/how_it_works.html">https://docs.aws.amazon.com/vpn/latest/s2svpn/how_it_works.html</a></p><p>[3] <a href="https://docs.aws.amazon.com/directconnect/latest/UserGuide/create-transit-vif-dx.html">https://docs.aws.amazon.com/directconnect/latest/UserGuide/create-transit-vif-dx.html</a></p><p>[4] <a href="https://aws.amazon.com/directconnect/resiliency-recommendation/">https://aws.amazon.com/directconnect/resiliency-recommendation/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b6dbff5f5bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>