<?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"><channel><title><![CDATA[blog.Kasun]]></title><description><![CDATA[blog.Kasun]]></description><link>https://blog.kasun.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1752457127340/25f93d28-8c91-4ec3-a00a-463c870e4936.png</url><title>blog.Kasun</title><link>https://blog.kasun.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sun, 17 May 2026 04:02:32 GMT</lastBuildDate><atom:link href="https://blog.kasun.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Simplify AWS Lambda Deployments Using GitHub Actions]]></title><description><![CDATA[Hey, serverless builders! 🚀 Exciting news from AWS!
AWS has launched a feature that direct support for deploying AWS Lambda functions using GitHub Actions. This new capability significantly streamlines the deployment process, eliminating the need fo...]]></description><link>https://blog.kasun.dev/simplify-aws-lambda-deployments-using-github-actions</link><guid isPermaLink="true">https://blog.kasun.dev/simplify-aws-lambda-deployments-using-github-actions</guid><category><![CDATA[github-actions]]></category><category><![CDATA[aws lambda]]></category><category><![CDATA[ci-cd]]></category><category><![CDATA[#AWSCommunityBuilders]]></category><dc:creator><![CDATA[Kasun de Silva]]></dc:creator><pubDate>Fri, 15 Aug 2025 00:25:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1755217462072/f85880c0-c099-424d-ac08-fd96eb0b22cf.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey, serverless builders! 🚀 Exciting news from AWS!</p>
<p>AWS has launched a feature that <strong>direct support for deploying AWS Lambda functions using GitHub Actions</strong>. This new capability significantly streamlines the deployment process, eliminating the need for complex, custom scripting and boilerplate code.</p>
<p>Before this, deploying a Lambda function from a GitHub workflow required manual steps to package code, configure IAM roles, and handle potential errors. Now, a dedicated GitHub Action handles all of this for you with a simple, declarative YAML configuration. This means less friction, faster deployments, and more time for you to focus on building amazing serverless applications.</p>
<hr />
<h3 id="heading-whats-new">What's New?</h3>
<p>The new <strong>"Deploy Lambda Function" GitHub Action</strong> simplifies your CI/CD pipeline by providing a direct and secure way to update your Lambda functions.</p>
<ul>
<li><p><strong>Declarative Configuration:</strong> Define your deployment settings—like runtime, memory, and environment variables—directly in your GitHub Actions workflow file.</p>
</li>
<li><p><strong>Automatic Packaging:</strong> The action automatically handles the packaging of your function code, supporting both <code>.zip</code> file and container image deployments.</p>
</li>
<li><p><strong>Seamless IAM Integration:</strong> It integrates with AWS IAM using <strong>OpenID Connect (OIDC)</strong> authentication, which is the most secure way to grant your GitHub workflows temporary, short-lived credentials without ever storing long-lived secrets.</p>
</li>
</ul>
<p>This new workflow is a huge win for developer experience, making it easier than ever to adopt a fully automated, Git-based deployment strategy for your serverless projects.</p>
<hr />
<h3 id="heading-step-by-step-guide-deploying-a-lambda-function-with-github-actions">Step-by-Step Guide: Deploying a Lambda Function with GitHub Actions</h3>
<p>Ready to get started? Here's how you can set up a GitHub Actions workflow to automatically deploy your Lambda function.</p>
<h4 id="heading-prerequisites">Prerequisites</h4>
<ol>
<li><p><strong>A Lambda Function:</strong> You need an existing AWS Lambda function. If you don't have one, create it in the AWS Management Console or with the AWS CLI.</p>
</li>
<li><p><strong>IAM Role for OIDC:</strong> Configure an IAM role in your AWS account that trusts GitHub's OIDC provider. This role will grant your workflow the permissions it needs to deploy the function. This is a crucial security step!</p>
</li>
<li><p><strong>A GitHub Repository:</strong> Your Lambda function code should be in a GitHub repository.</p>
</li>
</ol>
<h4 id="heading-step-1-configure-iam-for-oidc">Step 1: Configure IAM for OIDC</h4>
<p>First, set up a trusted relationship between your AWS account and GitHub.</p>
<ul>
<li><p>Navigate to <strong>IAM</strong> in the AWS console.</p>
</li>
<li><p>Under <strong>Access management</strong>, select <strong>Identity providers</strong>.</p>
</li>
<li><p>Choose <strong>Add provider</strong> and configure an <strong>OpenID Connect</strong> provider with the URL: <code>https://token.actions.githubusercontent.com</code>.</p>
</li>
<li><p>Create a new IAM role that uses this provider and grant it the necessary permissions, such as <code>lambda:UpdateFunctionCode</code> and <code>lambda:UpdateFunctionConfiguration</code>.</p>
</li>
</ul>
<h4 id="heading-step-2-create-your-github-actions-workflow-file">Step 2: Create Your GitHub Actions Workflow File</h4>
<p>In your GitHub repository, create a new file at <code>.github/workflows/deploy.yml</code>. This YAML file defines the deployment process.</p>
<p>YAML</p>
<pre><code class="lang-yaml"><span class="hljs-attr">name:</span> <span class="hljs-string">Deploy</span> <span class="hljs-string">Lambda</span> <span class="hljs-string">Function</span>

<span class="hljs-attr">on:</span>
  <span class="hljs-attr">push:</span>
    <span class="hljs-attr">branches:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">main</span> <span class="hljs-comment"># This workflow runs on pushes to the 'main' branch</span>

<span class="hljs-attr">jobs:</span>
  <span class="hljs-attr">deploy:</span>
    <span class="hljs-attr">runs-on:</span> <span class="hljs-string">ubuntu-latest</span>
    <span class="hljs-attr">permissions:</span>
      <span class="hljs-attr">id-token:</span> <span class="hljs-string">write</span> <span class="hljs-comment"># Required for OIDC authentication</span>
      <span class="hljs-attr">contents:</span> <span class="hljs-string">read</span>  <span class="hljs-comment"># Required to check out the repository</span>

    <span class="hljs-attr">steps:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Checkout</span> <span class="hljs-string">repository</span>
        <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/checkout@v4</span>

      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Configure</span> <span class="hljs-string">AWS</span> <span class="hljs-string">credentials</span>
        <span class="hljs-attr">uses:</span> <span class="hljs-string">aws-actions/configure-aws-credentials@v4</span>
        <span class="hljs-attr">with:</span>
          <span class="hljs-attr">role-to-assume:</span> <span class="hljs-string">arn:aws:iam::123456789012:role/GitHubActionRole</span> <span class="hljs-comment"># Replace with your IAM role ARN</span>
          <span class="hljs-attr">aws-region:</span> <span class="hljs-string">us-east-1</span> <span class="hljs-comment"># Replace with your AWS region</span>

      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Deploy</span> <span class="hljs-string">Lambda</span> <span class="hljs-string">Function</span>
        <span class="hljs-attr">uses:</span> <span class="hljs-string">aws-actions/aws-lambda-deploy@v1</span>
        <span class="hljs-attr">with:</span>
          <span class="hljs-attr">function-name:</span> <span class="hljs-string">my-lambda-function</span> <span class="hljs-comment"># Replace with your function name</span>
          <span class="hljs-attr">code-artifacts-dir:</span> <span class="hljs-string">./dist</span> <span class="hljs-comment"># The directory containing your packaged code</span>
</code></pre>
<h4 id="heading-step-3-push-your-code-and-watch-it-deploy">Step 3: Push Your Code and Watch it Deploy!</h4>
<p>That's it! When you push new code to the <code>main</code> branch of your repository, GitHub Actions will automatically trigger this workflow. The <code>aws-lambda-deploy</code> action will package the code from your specified directory (<code>./dist</code> in this example) and deploy it to your Lambda function.</p>
<hr />
<h3 id="heading-beyond-the-basics">Beyond the Basics</h3>
<p>The <code>aws-lambda-deploy</code> action is highly configurable. You can:</p>
<ul>
<li><p><strong>Deploy via Amazon S3:</strong> For larger deployment packages, you can specify an S3 bucket to use as an intermediate location.</p>
</li>
<li><p><strong>Configure Function Settings:</strong> Update your Lambda function's runtime, memory, timeout, and environment variables directly within the workflow.</p>
</li>
<li><p><strong>Use Dry Run Mode:</strong> Test your deployment configuration and permissions without making any changes to the function itself.</p>
</li>
</ul>
<p>With this new feature, AWS is making it simpler and more secure to manage the entire lifecycle of your serverless applications. Happy coding! 💻✨</p>
<p>For more details and advanced examples, check out the <strong>AWS Lambda Deploy GitHub Action</strong> repository: <a target="_blank" href="https://github.com/aws-actions/aws-lambda-deploy">https://github.com/aws-actions/aws-lambda-deploy</a>.</p>
<hr />
]]></content:encoded></item></channel></rss>