<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Eks on LFH</title>
    <link>http://lfhernandez.com/tags/eks/</link>
    <description>Recent content in Eks on LFH</description>
    <image>
      <title>LFH</title>
      <url>http://lfhernandez.com/og-card.png</url>
      <link>http://lfhernandez.com/og-card.png</link>
    </image>
    <generator>Hugo</generator>
    <language>en-us</language>
    <copyright>Luis Felipe Hernandez</copyright>
    <lastBuildDate>Sun, 28 Jun 2026 13:18:50 -0400</lastBuildDate>
    <atom:link href="http://lfhernandez.com/tags/eks/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Getting a Service on EKS access to Bedrock</title>
      <link>http://lfhernandez.com/posts/eks-pod-identity-bedrock/</link>
      <pubDate>Sun, 28 Jun 2026 11:00:00 -0400</pubDate>
      <guid>http://lfhernandez.com/posts/eks-pod-identity-bedrock/</guid>
      <description>How to wire up a service running on EKS to call Amazon Bedrock.</description>
      <content:encoded><![CDATA[<p>Recently, I needed to get a service running on an EKS cluster to talk to Amazon Bedrock. The code was in place, I just needed to figure out how the service would reach out to Bedrock. The pod had no AWS credentials, so I knew I had to set up authentication&hellip; I just wasn&rsquo;t sure which mechanism.</p>
<p>Normally, you&rsquo;d solve this using IAM Roles for Service Accounts (IRSA). You&rsquo;d annotate the service account, stand up an OpenID Connect (OIDC) provider, maintain a per-cluster trust policy. But as I dug a little into what options were available, Pod Identity stuck out as a more straightforward approach. I went with EKS Pod Identity, which does the same job as IRSA with a lot less ceremony. Here&rsquo;s the path that worked for me.</p>
<p>In simple terms, both IRSA and Pod Identity let a pod assume an IAM role, the difference is the plumbing. IRSA depends on an OIDC provider and a trust policy you wire up per cluster, while Pod Identity hands that off to an EKS-managed agent so you skip the OIDC setup.</p>
<p><strong>1. Install the agent</strong>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>aws eks create-addon --cluster-name my-cluster --addon-name eks-pod-identity-agent
</span></span></code></pre></div><p><strong>2. Create an IAM role</strong> whose trust policy allows the EKS service principal. This is the same generic trust for every Pod Identity role:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;Version&#34;</span>: <span style="color:#e6db74">&#34;2012-10-17&#34;</span>,
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">&#34;Statement&#34;</span>: [
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;Effect&#34;</span>: <span style="color:#e6db74">&#34;Allow&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;Principal&#34;</span>: { <span style="color:#f92672">&#34;Service&#34;</span>: <span style="color:#e6db74">&#34;pods.eks.amazonaws.com&#34;</span> },
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">&#34;Action&#34;</span>: [<span style="color:#e6db74">&#34;sts:AssumeRole&#34;</span>, <span style="color:#e6db74">&#34;sts:TagSession&#34;</span>]
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  ]
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>Then attach a permissions policy for Bedrock (<code>bedrock:InvokeModel</code>, <code>bedrock:InvokeModelWithResponseStream</code>).</p>
<p><strong>3. Create the service account</strong> and associate the role with it:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>kubectl create serviceaccount bedrock-caller -n my-app
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>aws eks create-pod-identity-association <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  --cluster-name my-cluster <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  --namespace my-app <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  --service-account bedrock-caller <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  --role-arn arn:aws:iam::111122223333:role/bedrock-pod-identity
</span></span></code></pre></div><p><strong>4. Use that service account</strong> in the pod (<code>serviceAccountName: bedrock-caller</code>). No need for an annotation on the service account; the association lives in the EKS API. The agent injects credentials and the AWS SDK picks them up automatically&hellip; like magic.</p>
<p>One gotcha that is easy to miss, make sure that the model is actually enabled in the Bedrock console. Model access is a separate toggle from IAM permissions.</p>
<p>And Bob&rsquo;s your uncle, I hope this was helpful and definitely give the docs a read and dive deeper!</p>
<hr>
<p>Are you leveling up on Kubernetes, Linux, or cloud-native skills? You can use my code <strong><code>LFHERNANDEZ</code></strong> for a discount on the <a href="https://training.linuxfoundation.org/full-catalog/">full catalog</a> of training courses and certifications (CKA, CKAD, CKS, LFCS, and many many more).</p>
<p>Docs: <a href="https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html">EKS Pod Identities</a></p>
]]></content:encoded>
    </item>
  </channel>
</rss>
