<?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 Ilya Liverts on Medium]]></title>
        <description><![CDATA[Stories by Ilya Liverts on Medium]]></description>
        <link>https://medium.com/@ilya_liverts?source=rss-622689aca3d2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nrSHD4-7bjQxlKrWnaFqPw.jpeg</url>
            <title>Stories by Ilya Liverts on Medium</title>
            <link>https://medium.com/@ilya_liverts?source=rss-622689aca3d2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 14:18:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ilya_liverts/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[AWS Lambda deployment with Terraform & Terragrunt — Tutorial]]></title>
            <link>https://medium.com/@ilya_liverts/aws-lambda-deployment-with-terraform-terragrunt-tutorial-42d1ca3334c0?source=rss-622689aca3d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/42d1ca3334c0</guid>
            <dc:creator><![CDATA[Ilya Liverts]]></dc:creator>
            <pubDate>Tue, 12 Oct 2021 06:46:36 GMT</pubDate>
            <atom:updated>2021-10-12T16:31:55.402Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Lambda deployment with Terraform &amp; Terragrunt — Tutorial</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5irSxxdj1-krOAzZ1pXorw.jpeg" /></figure><h3><strong>This tutorial shows how to deploy a </strong><strong>Python function on </strong><strong>AWS Lambda with </strong><strong>Terraform and </strong><strong>Terragrunt.</strong></h3><p>Git link: <a href="https://github.com/edonosotti/terraform-terragrunt-aws-lambda-tutorial.git">https://github.com/edonosotti/terraform-terragrunt-aws-lambda-tutorial.git</a></p><p>Credits going to <a href="https://github.com/edonosotti">Edoardo Nosotti</a> . This article was extended by me <a href="https://medium.com/u/622689aca3d2">Ilya Liverts</a> .</p><p><strong>Terragrunt is a wrapper for </strong><strong>Terraform which helps to manage multiple environments.</strong></p><p>The Terraform configuration can also:</p><ul><li>install the required Python dependencies</li><li>keep track of changes to the code and dependencies to avoid re-deploying an unchanged function</li></ul><h3>Prerequisites</h3><ul><li><a href="https://www.python.org/downloads/release/python-386/">Python 3.8</a></li><li><a href="https://releases.hashicorp.com/terraform/0.13.5/">Terraform v0.13.5</a></li><li><a href="https://aws.amazon.com/cli/?nc1=h_ls">AWS CLI 1.18.69</a></li><li><a href="https://github.com/gruntwork-io/terragrunt/releases/tag/v0.26.2">Terragrunt v0.26.2</a> <em>(optional)</em></li></ul><p>Optional:</p><ul><li><a href="https://docs.conda.io/en/latest/miniconda.html">Miniconda</a>, <a href="https://docs.conda.io/en/latest/">Conda</a></li></ul><h3>Setup</h3><ul><li>Create an AWS account and get a Access Key ID and Secret Access Key pair (<a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html">read the docs</a>)</li><li>Install and configure the AWS CLI (<a href="https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html">read the docs</a>)</li><li>Install Terraform (<a href="https://learn.hashicorp.com/tutorials/terraform/install-cli?in=terraform/aws-get-started">read the docs</a>)</li><li>Install Python or, with Miniconda or Conda, run:</li></ul><pre>conda env create -n tflambda -f environment.yml<br>source activate tflambda</pre><ul><li>(<a href="https://wiki.python.org/moin/BeginnersGuide">Python docs</a>)</li><li>Terragrunt is optional, install it for a more advanced setup (<a href="https://terragrunt.gruntwork.io/docs/getting-started/install/#install-terragrunt">read the docs</a>)</li></ul><h3>Usage</h3><h3>Running locally</h3><pre>cd lambda<br>pip install -r requirements.txt<br>python lambda.py</pre><p>to view the log output on screen, run:</p><pre>$ LOG_LEVEL=INFO python lambda.py</pre><h3>Deploying to AWS Lambda with Terraform</h3><p>Run:</p><pre>cd terraform<br>terraform init<br>terraform apply</pre><p>If you have multiple AWS profiles and you want to set the profile to use:</p><pre>$ AWS_PROFILE=myprofilename terraform apply</pre><p>The Terraform AWS provider offers a number of options to set credentials, <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication">check the docs</a> for further details.</p><p>To deploy to a specific AWS region (see <a href="https://github.com/edonosotti/terraform-terragrunt-aws-lambda-tutorial/blob/master/terraform/variables.tf">variables.tf</a> for defaults):</p><pre>$ terraform apply -var aws_region=&quot;eu-west-1&quot;</pre><h3>Deploying to AWS Lambda with Terragrunt</h3><p>2 sample Terragrunt configurations are provided:</p><ul><li><a href="https://github.com/edonosotti/terraform-terragrunt-aws-lambda-tutorial/blob/master/terragrunt/eu">terragrunt/eu</a> sets the AWS region to eu-west-1</li><li><a href="https://github.com/edonosotti/terraform-terragrunt-aws-lambda-tutorial/blob/master/terragrunt/us">terragrunt/us</a> sets the AWS region to us-east-1</li></ul><p>Run:</p><pre>cd terragrunt/eu<br>terragrunt apply</pre><p>change /eu to /us and repeat to try another region.</p><p>AWS profiles selection also applies to Terragruntif you want to deploy terraform config (in out case lambda) on different AWS accounts :</p><pre>AWS_PROFILE=myprofilename terragrunt apply</pre><h3>Cleaning up</h3><p>Run:</p><pre>cd terraform<br>terraform destroy</pre><p>Or in case of Terragrunt for eu :</p><pre>cd terragrunt/eu<br>terragrunt destroy</pre><p>Or in case of Terragrunt for us :</p><pre>cd terragrunt/us<br>terragrunt destroy</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42d1ca3334c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>