<?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 Sarath Tamminana on Medium]]></title>
        <description><![CDATA[Stories by Sarath Tamminana on Medium]]></description>
        <link>https://medium.com/@tams67680?source=rss-5809a46fb841------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*yR4TfLznxrTLcqGXqMI7ow.jpeg</url>
            <title>Stories by Sarath Tamminana on Medium</title>
            <link>https://medium.com/@tams67680?source=rss-5809a46fb841------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 20:26:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tams67680/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[Integrating AWS CodeConnections and CodeBuild with Terraform: Building Two Pipelines for Automated…]]></title>
            <link>https://medium.com/@tams67680/integrating-aws-codeconnections-and-codebuild-with-terraform-building-two-pipelines-for-automated-635539f65d95?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/635539f65d95</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Fri, 20 Nov 2026 18:16:46 GMT</pubDate>
            <atom:updated>2026-11-20T18:19:46.070Z</atom:updated>
            <content:encoded><![CDATA[<h3>Integrating AWS CodeConnections and CodeBuild with Terraform: Building Two Pipelines for Automated Validation and Infrastructure Drift Detection</h3><p>Infrastructure as Code (IaC) has become an essential part of modern cloud infrastructure management. Tools such as Terraform allow teams to provision and manage cloud resources through version-controlled configuration files.</p><p>However, maintaining infrastructure through Terraform does not always guarantee that the actual cloud environment remains aligned with the desired configuration.</p><p>For example, an engineer might manually modify an AWS resource through the AWS Management Console. Such changes can introduce configuration differences between the Terraform configuration and the actual infrastructure.</p><p>This is commonly referred to as <strong>infrastructure drift</strong>.</p><p>In this article, we will build an automated solution using AWS Developer Tools to address two important requirements:</p><ol><li>Automate Terraform validation whenever code changes are pushed to GitHub.</li><li>Periodically detect infrastructure drift and notify the team when discrepancies are identified.</li></ol><p>We will use <strong>AWS CodeConnections</strong> , <strong>AWS CodeBuild, Amazon EventBridge Scheduler, Amazon SNS, </strong>and <strong>Terraform</strong> to implement these workflows.</p><p>The focus of this implementation is to demonstrate how AWS Developer Tools can be integrated to automate infrastructure validation and drift detection.</p><blockquote><strong>Note: For demonstration purposes, broader permissions have been used for simplicity. In production environments, always follow the principle of least privilege and grant only the permissions required for each service.</strong></blockquote><h4>Table of contents</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*-UI3OoIwqwzAl89fWjPaWQ.png" /></figure><h4>What are we planning to implement?</h4><p>We are going to create TWO Workflows</p><p><strong>Workflow 1</strong> : Whenever a developer pushes changes to the Terraform repository, AWS CodeConnections will receive the GitHub webhook event and trigger an AWS CodeBuild project.</p><p>It perform Terraform init/fmt/validate/plan</p><p><strong>Workflow 2 </strong>: An eventbridge schedule will trigger the CodeBuild Project which will check for Terraform Drift and if it finds it will send the notification through SNS.</p><p>Amazon EventBridge Scheduler → AWS CodeBuild → Terraform Plan JSON → Python drift analysis → Amazon SNS notification.</p><h4>Architecture Diagram</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JP2pQJyocKvIAuzxNxZrQg.png" /></figure><ol><li><strong>Pipeline 1 — Terraform Validation:</strong> GitHub push → CodeConnections webhook → CodeBuild → ( init/fmt/validate/plan ).</li><li><strong>Pipeline 2 — Drift Detection:</strong> EventBridge Scheduler → CodeBuild → Terraform plan → Python drift analysis → SNS email alert (only when drift is detected).</li><li><strong>Shared Terraform backend:</strong> S3 for remote state and DynamoDB for state locking.</li></ol><h4><strong>Source Code for the Implementation</strong></h4><p>Entire source code for the implementation is available <a href="https://github.com/sarathtam242/learning-repo/tree/project-2-terraform-drift">here</a> . Please clone the repository and consider using project-2-terraform-drift branch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ba2cWv7Krn6tXSzlmOveg.png" /><figcaption>Github Repository for implementation</figcaption></figure><p>project-2-terraform-drift will be the source folder. Here is how it looks and short explanation of each file nested inside.</p><pre><br>project-2-terraform-drift/<br>│<br>├── scripts/<br>│   └── detect-drift.py<br>│       └── Analyses Terraform plan JSON to detect infrastructure drift.<br>│<br>├── terraform/<br>│   ├── .terraform.lock.hcl<br>│   │   └── Locks Terraform provider versions for consistent execution.<br>│   │<br>│   ├── backend.tf<br>│   │   └── Configures the S3 remote backend and state locking.<br>│   │<br>│   ├── main.tf<br>│   │   └── Defines the AWS infrastructure resources.<br>│   │<br>│   ├── outputs.tf<br>│   │   └── Defines output values from Terraform execution.<br>│   │<br>│   └── variables.tf<br>│       └── Declares input variables for the Terraform configuration.<br>│<br>├── README.md<br>│   └── Documents the project architecture and implementation.<br>│<br>├── buildspec-drift.yml<br>│   └── Defines CodeBuild steps for drift detection and SNS notifications.<br>│<br>└── buildspec-validate.yml<br>    └── Defines CodeBuild steps for Terraform formatting, initialization,<br>        validation, and plan generation.</pre><h4>Create an S3 Backend Bucket and DynamoDB Table for Terraform state storing and locking functionality.</h4><pre><br># 1. Create S3 bucket for Terraform state<br><br>aws s3api create-bucket \<br>  --bucket enminto-p2-tfstate-dummy \<br>  --region ap-south-1 \<br>  --create-bucket-configuration LocationConstraint=ap-south-1<br><br><br># 2. Enable S3 bucket versioning<br><br>aws s3api put-bucket-versioning \<br>  --bucket enminto-p2-tfstate-dummy \<br>  --versioning-configuration Status=Enabled \<br>  --region ap-south-1<br><br><br># 3. Enable server-side encryption (AES256)<br><br>aws s3api put-bucket-encryption \<br>  --bucket enminto-p2-tfstate-dummy \<br>  --server-side-encryption-configuration &#39;{<br>    &quot;Rules&quot;: [<br>      {<br>        &quot;ApplyServerSideEncryptionByDefault&quot;: {<br>          &quot;SSEAlgorithm&quot;: &quot;AES256&quot;<br>        }<br>      }<br>    ]<br>  }&#39; \<br>  --region ap-south-1<br><br><br># 4. Block public access<br><br>aws s3api put-public-access-block \<br>  --bucket enminto-p2-tfstate-dummy \<br>  --public-access-block-configuration \<br>  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true \<br>  --region ap-south-1<br><br>##########################################################<br><br># 5. Create DynamoDB table<br><br>aws dynamodb create-table \<br>  --table-name enminto-p2-terraform-lock \<br>  --attribute-definitions AttributeName=LockID,AttributeType=S \<br>  --key-schema AttributeName=LockID,KeyType=HASH \<br>  --billing-mode PAY_PER_REQUEST \<br>  --region ap-south-1<br><br><br>##########################################################<br><br># 6. Verify S3 bucket<br><br>aws s3api head-bucket \<br>  --bucket enminto-p2-tfstate-dummy<br><br># 7. Verify DynamoDB table<br><br>aws dynamodb describe-table \<br>  --table-name enminto-p2-terraform-lock \<br>  --region ap-south-1<br><br><br>##########################################################<br><br># 8. Initialize Terraform with remote backend<br><br>terraform init \<br>  -backend-config=&quot;bucket=enminto-p2-tfstate-dummy&quot; \<br>  -backend-config=&quot;key=project-2/terraform.tfstate&quot; \<br>  -backend-config=&quot;region=ap-south-1&quot; \<br>  -backend-config=&quot;encrypt=true&quot; \<br>  -backend-config=&quot;dynamodb_table=enminto-p2-terraform-lock&quot;</pre><p><strong>NOTE: Please replace the enminto-p2-tfstate-dummy with your own preferred bucket name.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*FzsACh3YJeMv4kKir7B2SA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHrVVsW_J9G9zq7KXnGA0g.png" /></figure><h4>IAM Roles and Permissions Setup</h4><ol><li>TerraformValidationCodeBuildRole</li><li>TerraformDriftCodeBuildRole</li><li>Amazon_EventBridge_Scheduler_CODEBUILD</li></ol><p>TerraformValidationCodeBuildRole should have below permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_J8irKq3FFdaY67CID712g.png" /></figure><p>CodeConnection custom policy</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;ReadGitHubConnection&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;codeconnections:GetConnection&quot;,<br>                &quot;codeconnections:GetConnectionToken&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:codeconnections:ap-south-1:580******:connection/a8e600b6-39f6-4490-98fe-4a5686313078&quot;<br>        }<br>    ]<br>}</pre><p><strong>NOTE: I considered Full Access for Demonstration purpose only, but you can consider principal of least previlege. Also replace the account number with yours.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FE5pwLq2RhGO9GpQ3LP2lg.png" /></figure><p><strong>TerraformDriftCodeBuildRole</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m33inEbALitpOwSH31-qTg.png" /></figure><p><strong>Sample CodeConnection Policy</strong></p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;codestar-connections:GetConnectionToken&quot;,<br>                &quot;codestar-connections:GetConnection&quot;,<br>                &quot;codeconnections:GetConnectionToken&quot;,<br>                &quot;codeconnections:GetConnection&quot;,<br>                &quot;codeconnections:UseConnection&quot;<br>            ],<br>            &quot;Resource&quot;: [<br>                &quot;arn:aws:codestar-connections:ap-south-1:5800***307:connection/a8e600b6-39f6-4490-98fe-4a5686313078&quot;,<br>                &quot;arn:aws:codeconnections:ap-south-1:5800*****07:connection/a8e600b6-39f6-4490-98fe-4a5686313078&quot;<br>            ]<br>        }<br>    ]<br>}</pre><p>CodeConnection Policy will be attached to the role automatically once the integration is done at the build project level. Above snippet is only for visibility.</p><p><strong>Trust Relationship</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3nMJ5v6fDs8EUbV8OGphg.png" /></figure><p><strong>Amazon_EventBridge_Scheduler_CODEBUILD</strong></p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;codebuild:StartBuild&quot;<br>            ],<br>            &quot;Resource&quot;: [<br>                &quot;arn:aws:codebuild:ap-south-1:58006****307:project/project-2-terraform-drift-detection&quot;<br>            ]<br>        }<br>    ]<br>}</pre><p><strong>Trust Relationship</strong></p><pre>{<br> &quot;Version&quot;: &quot;2012-10-17&quot;,<br> &quot;Statement&quot;: [<br>  {<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Principal&quot;: {<br>    &quot;Service&quot;: &quot;scheduler.amazonaws.com&quot;<br>   },<br>   &quot;Action&quot;: &quot;sts:AssumeRole&quot;,<br>   &quot;Condition&quot;: {<br>    &quot;StringEquals&quot;: {<br>     &quot;aws:SourceAccount&quot;: &quot;580****07&quot;<br>    }<br>   }<br>  }<br> ]<br>}</pre><h4><strong>Configure GitHub integration using AWS CodeConnections</strong></h4><p>AWS CodeConnections is a service that enables secure connectivity between AWS services and external code repositories such as GitHub, GitLab and Bitbucket.</p><p>In our implementation, we use AWS CodeConnections to establish a connection between GitHub and AWS CodeBuild.</p><p>Lets create connection with Github first before using in CodBuild Pipeline.</p><p>Go to settings section and then connections. Once you land into the dashboard click on Create Connection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RQmlOPaRZ5Y34Wrco6sWQA.png" /></figure><p>Select Github and give a name and click on connect to github</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oS-p50vf6CQeYE6RkRi05g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D0ZEHLvFoNteUk5DkA3SpA.png" /></figure><p>Once you click on Install a new app, it will take you to the Github Page as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*jD8D2tq1GduRIYS2k_F2dw.png" /></figure><p>click on the id and select the repository as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*lCsOmd9yTdEOYwzW6wIgBQ.png" /></figure><p>Once you authorize the connection, it looks like below in the dashboad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPqCLFNXffSene7HCl4V9A.png" /></figure><h4>Pipeline 1 — Terraform Validation</h4><p>Follow the below settings and create a build pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9oSglqfOO81YRXuTaZcvyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zO91gokL0guFrpXH6fzUyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-Ge51gxsZxenfcqYppvDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RIh5z1aUZ0WnpZ485DUQvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fD1r3HILH1BBx7Fn6YACSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9tMSSRjVdgBVGJe0Nyluw.png" /></figure><p>Once the pipeline is created, it will be listed as shown below in codebuild dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rtRY4y3RDlWgw8rp00L1KQ.png" /></figure><p><strong>Note:</strong> When webhook integration is enabled through AWS CodeBuild, AWS automatically manages the GitHub webhook configuration, including the Payload URL and Content Type. You do not need to configure these values manually. The webhook event types and branch filters can be configured through the CodeBuild project settings.</p><p>Webhook will be listed as below in your repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*KxVztaVyld8zvYpIO5UZtw.png" /></figure><h4>Demonstrating Automated Pipeline Execution Through GitHub Webhooks</h4><p>We have a simple Terraform configuration to provision an Amazon S3 bucket, enable versioning, block public access, and configure server-side encryption. To demonstrate automated execution, we will push a commit to the GitHub branch configured with the webhook PUSH event trigger.</p><p>The webhook automatically triggers the AWS CodeBuild pipeline, which performs Terraform formatting checks, initialization, validation, and plan generation. The build logs demonstrate successful validation and the Terraform execution plan, identifying the infrastructure changes required.</p><p>I will add a sample comment in README.md for automated Trigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RoLNoUshQZsfJyp4QxhQWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bNCOEhK2ES7QEBbgNY7dJg.png" /></figure><p>You can see a fresh run immediately after the commit is applied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-u3UQrzBhGZ9ofZEyC_Ig.png" /></figure><p>Once the build is completed successfully, you can see each phase and its associated Logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*29yf6wj5TImIuN1xVJo_RA.png" /></figure><p>In the logs, you can validate whether the Terraform plan is showing as expected or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UKGqSb7EzXgx88kDyqLB8w.png" /></figure><p>You can also see webhook delivery status from Github Settings section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pszu5m7UC7PtOi4v3UyHDw.png" /></figure><p>Now i applied the Terraform manually and created resources to make the next demonstration ( drift detection ) easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CeJ4-o-YVvnOE9KylMoA7w.png" /></figure><p>You can trigger the build manually from console and see if the plan is showing any creation events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HWTZMmzzyI82fiIxHhSGPw.png" /></figure><p>Once the manual trigger is done, we can see plan is showing as expected because already the resources are in sync.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*J_ZyXm0jfQIozUQPDhhQPg.png" /></figure><h4><strong>Configure Amazon SNS for Drift Notifications</strong></h4><p>Amazon Simple Notification Service (SNS) is used to deliver notifications when infrastructure drift is detected.</p><p>We will create an SNS topic and configure an email subscription to receive drift alerts. The email subscription must be confirmed before SNS can deliver notifications. Our drift detection CodeBuild project will publish messages to this topic whenever the Python script identifies infrastructure drift.</p><p>Create SNS Topic with below settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cfj3-eOvtaUoAEUviJTBxg.png" /></figure><p>Create a subscription as well and confirm the subscriber.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ygFxojWfB6wERNlYdM9pEw.png" /></figure><p>It should show confirmed status as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*2PhKqFu9Q43pGKRfyNzGDA.png" /></figure><p>Once the SNS Topic setup is completed, we need to update the ARN Value in the buildspec-drift.yml as shown below. This is required for triggering a notification in case of drift is identified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*TAO8vyi20PwGzPe6YZEBlg.png" /></figure><h4>Pipeline 2 — Drift Detection</h4><p>Unlike the validation pipeline, this workflow focuses on identifying changes made directly to AWS infrastructure outside Terraform. We will use a separate AWS CodeBuild project to execute Terraform Plan and analyze the generated plan JSON using a Python script.</p><p>To demonstrate drift detection, we will manually suspend versioning on the Terraform-managed S3 bucket through the AWS Console and manually trigger the CodeBuild project. The pipeline will identify the configuration difference and publish an alert to the configured SNS topic, triggering an email notification.</p><p>Follow the below screenshots for setup. Most of the stuff will be same except the buildspec file we choose for this section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-5eDWhtS7iy1TpR73j0odw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5LP_kSJGSTmS_HTbvkw7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gHZnhBcLitWZG5ytB1XMLA.png" /></figure><p>Note the yml file we referred in below screenshot, it should have the updated ARN value of SNS Topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tB2ZTyZNnAJz7w-qubCung.png" /></figure><p>Provide the Service Role information at the end and click create. Once the build pipeline setup is completed. It looks like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rk7QVbWuH4RXpN-YjbknQQ.png" /></figure><p><strong>Testing Drift Pipeline</strong></p><p>I will intentionally disable versioning for the S3 bucket/change encryption and trigger this build pipeline manually. It will go and compare the desired with existing infra and identify the drift and send the notification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fs9GNFWiwpX61SUveeUqZA.png" /></figure><p>Lets start the build pipeline manually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hZXwYlDnDHlyos6auge6eQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*Z_JJsLIh_W_-a3uUw1t1rQ.png" /></figure><p>We can see the drift detection in the output for the S3 changes we made in previous step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*q5Kip2PTqtmPyshCuuDOKQ.png" /></figure><p>Here is how the sns notification looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*ydXyoq__0hlSlQl9e07FgQ.png" /></figure><p>We can also periodically run the eventbridge schedule to identify the drift and send notification for machine critical infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9RX7K8d484OYZTeUT2MKDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oCU718_e_Z0hzk2S94vy8A.png" /></figure><h4>Resource Cleanup</h4><p>After completing the implementation, the temporary AWS resources created for this implementation can be removed to avoid unnecessary costs.</p><p>Disable and delete the EventBridge schedule, CodeBuild projects and SNS topic. Restore any manually modified infrastructure before running Terraform cleanup. Finally, remove the project-specific IAM roles and, if no longer required, the Terraform remote backend resources.</p><h4>Conclusion</h4><p>In this implementation, we explored how AWS Developer Tools can be integrated to automate Terraform validation and infrastructure drift detection.</p><p>We used AWS CodeConnections to integrate GitHub with AWS CodeBuild, enabling automatic pipeline execution whenever changes are pushed to the configured branch.</p><p>A separate CodeBuild project was implemented to periodically analyse Terraform execution plans and identify infrastructure drift using a Python script. Amazon SNS was integrated to send email notifications whenever drift was detected, while Amazon EventBridge Scheduler enabled automated daily execution.</p><p>Through this hands-on implementation, we demonstrated how different AWS services can work together to reduce manual intervention, improve infrastructure visibility, and identify configuration changes outside the Infrastructure as Code workflow.</p><p>The objective was not just to execute Terraform commands through a pipeline, but to demonstrate how AWS Developer Tools can be integrated to build practical infrastructure automation workflows.</p><p>The complete implementation, Terraform configuration, buildspec files, and Python script are available in the GitHub repository.</p><p>Thank you for reading!</p><p>Repo Link: <a href="https://github.com/sarathtam242/learning-repo/tree/project-2-terraform-drift">https://github.com/sarathtam242/learning-repo/tree/project-2-terraform-drift</a></p><p>CodeBuild Documentation: <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/welcome.html">https://docs.aws.amazon.com/codebuild/latest/userguide/welcome.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=635539f65d95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate Python Package Publishing to AWS CodeArtifact Using AWS CodeBuild]]></title>
            <link>https://medium.com/@tams67680/automate-python-package-publishing-to-aws-codeartifact-using-aws-codebuild-0138930f2b69?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/0138930f2b69</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Wed, 21 Oct 2026 02:32:08 GMT</pubDate>
            <atom:updated>2026-10-21T02:32:08.488Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>In this article, we will learn how to build a simple workflow to <strong>publish</strong> a <strong>Python package</strong> privately using <strong>AWS CodeArtifact</strong> and <strong>AWS CodeBuild</strong>. When we develop Python applications, we often create reusable functions that can be used across multiple projects. Instead of copying the same code into different applications, we can package it and store it in a private repository. In this hands-on project, we will create a small Python package called <strong>health-utils</strong>, write unit tests, and use AWS CodeBuild to run the tests, build the package, and publish it to AWS CodeArtifact.</p><p>Finally, we will install the published package in a separate FastAPI application and verify that it works as expected.By the end of this tutorial, we will have a working workflow for testing, building, and publishing a reusable Python package using AWS services.</p><h4>Architecture and Workflow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZExRNELfNpW43lRK-CP5RQ.png" /><figcaption>Architecture of the private Python package publishing workflow using AWS CodeBuild and AWS CodeArtifact</figcaption></figure><h4>Explore the source code</h4><p>Here is the Github Repository <a href="https://github.com/sarathtam242/learning-repo">Link</a> you can use for the implementation purpose.</p><pre><br>learning-repo/<br>│<br>├── consumer-app/<br>│   └── main.py<br>│       └── FastAPI application that consumes health-utils<br>│<br>├── health_utils/<br>│   ├── __init__.py<br>│   │   └── Exposes the package function<br>│   └── health.py<br>│       └── Contains the is_healthy() function<br>│<br>├── tests/<br>│   └── test_health.py<br>│       └── Unit tests for the health-check function<br>│<br>├── .gitignore<br>│   └── Excludes files and directories from Git<br>│<br>├── buildspec.yml<br>│   └── Defines the AWS CodeBuild workflow<br>│<br>└── pyproject.toml<br>    └── Defines Python package metadata and build settings</pre><h4>CodeArtifact Setup</h4><p>AWS CodeArtifact is a managed artifact repository service that allows us to securely store and share software packages. In this project, we will use CodeArtifact to host our private Python package, health-utils, so that other applications can install and reuse it.</p><p>We will create a CodeArtifact domain named <strong>enminto-domain</strong> and a repository named <strong>python-packages</strong>. We will also configure an upstream connection to public PyPI, allowing the repository to retrieve public Python packages when required.</p><p>Once the repository is configured, we can publish our custom Python package to it using AWS CodeBuild and install it in our separate FastAPI application.</p><p>Follow the below screenshots and complete the setup</p><p>Domain Creation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*62K51vXTR8rqCOMAZjVmFg.png" /></figure><p>Repository Setup</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hzQOT8Ak8hd7lga6swtetw.png" /><figcaption>Repository Creation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cl61Yaw9NOTGmroLfDbyxw.png" /><figcaption>Domain selection</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*egHU1iPUH_U6Rs2_qvCJqQ.png" /><figcaption>Review screen</figcaption></figure><p>Review and Create to complete the code artifact setup.</p><p>Once the setup is done, repositories will be visible as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*QSRYjUeHCYrizZZwRbDyAg.png" /></figure><p><em>pypi-store</em> is an upstream repository connected to public Python Package Index (PyPI), allowing AWS CodeArtifact to fetch and cache public Python packages when required. This will be created automatically.</p><p>Once this is done, we can move to IAM service to configure a service role and a user for the next set of implementation.</p><h4>Configure IAM permissions</h4><p>AWS CodeBuild needs permission to access AWS CodeArtifact and publish the Python package. To enable this, we will configure an IAM service role for our CodeBuild project.</p><p>The role allows CodeBuild to obtain a temporary authorization token, access the CodeArtifact repository, publish the package, and write build logs to Amazon CloudWatch.</p><p>We will attach a permissions policy to the role and configure its trust relationship to allow the AWS CodeBuild service to assume the role.</p><p>I created a role with the name <strong>CodeBuild-HealthUtils-Publish-Role. </strong>We need to attach the custom policy as shown below and Secrets manager read permission as well in case we are storing PAT token as secret for fetching the code from private repository.Below is the policy i attached for updating permission<strong>.</strong></p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;CodeArtifactToken&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;codeartifact:GetAuthorizationToken&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:codeartifact:ap-south-1:5800698****7:domain/enminto-domain&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;CodeArtifactBearerToken&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;sts:GetServiceBearerToken&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;StringEquals&quot;: {<br>                    &quot;sts:AWSServiceName&quot;: &quot;codeartifact.amazonaws.com&quot;<br>                }<br>            }<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;PublishHealthUtils&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;codeartifact:GetRepositoryEndpoint&quot;,<br>                &quot;codeartifact:PublishPackageVersion&quot;,<br>                &quot;codeartifact:PutPackageMetadata&quot;<br>            ],<br>            &quot;Resource&quot;: [<br>                &quot;arn:aws:codeartifact:ap-south-1:5800698****7:repository/enminto-domain/python-packages&quot;,<br>                &quot;arn:aws:codeartifact:ap-south-1:5800698****7:package/enminto-domain/python-packages/pypi//health-utils&quot;<br>            ]<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;CodeBuildCloudWatchLogs&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;logs:CreateLogGroup&quot;,<br>                &quot;logs:CreateLogStream&quot;,<br>                &quot;logs:PutLogEvents&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:logs:ap-south-1:5800698****7:log-group:/aws/codebuild/*&quot;<br>        }<br>    ]<br>}<br></pre><pre><br>#Replace the Policy substitutes as per your account details<br>5800698****7 - your AWS account ID.<br>ap-south-1 — your AWS Region.<br>enminto-domain — your CodeArtifact domain name.<br>python-packages — your CodeArtifact repository name.<br>health-utils — your Python package name wherever it appears in a resource ARN.</pre><p>Once the Policy and secrets manager read permissions are added, it will be listed as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fWXq7vXQWaoiQgt2TQuB_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*djBVBgY9zz0gaMrUjqF62w.png" /></figure><p>We need to setup an IAM User as well, this is going to be used for codeartifact package fetching from local environment. User name is <strong>enminto-codeartifact-local</strong></p><p>I added only basic permissions required by considering security in mind. Below policy need to be added for codeartifact to work from local.</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;GetCodeArtifactToken&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;codeartifact:GetAuthorizationToken&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:codeartifact:ap-south-1:580069****07:domain/enminto-domain&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;AllowCodeArtifactBearerToken&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;sts:GetServiceBearerToken&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;StringEquals&quot;: {<br>                    &quot;sts:AWSServiceName&quot;: &quot;codeartifact.amazonaws.com&quot;<br>                }<br>            }<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;AccessPythonRepository&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;codeartifact:GetRepositoryEndpoint&quot;,<br>                &quot;codeartifact:DescribeRepository&quot;,<br>                &quot;codeartifact:ReadFromRepository&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:codeartifact:ap-south-1:580069****07:repository/enminto-domain/python-packages&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;PublishAndInspectHealthUtils&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;codeartifact:PublishPackageVersion&quot;,<br>                &quot;codeartifact:DescribePackageVersion&quot;,<br>                &quot;codeartifact:ListPackageVersions&quot;,<br>                &quot;codeartifact:GetPackageVersionAsset&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:codeartifact:ap-south-1:580069****07:package/enminto-domain/python-packages/pypi//health-utils&quot;<br>        }<br>    ]<br>}</pre><pre>580069****07 --- Replace with your account id</pre><p>Once the above policy is added to the user, it is listed as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RElh33NxxLtB5vuUEvbPoQ.png" /></figure><h4><strong>CodeBuild Project Setup</strong></h4><p>Follow the below settings while configuring the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnMnEobwO6xR6GI9nAySBA.png" /><figcaption>Project type selection</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FD6RQjj1CPYSoBjhjTL5wA.png" /><figcaption>source type selection</figcaption></figure><p>NOTE: I placed my repo PAT Token as secret and configured the credentials. In case your repository is public you can use middle option ( Public repository ) in repository selection. Consider your branch where code is currently placed.</p><p>I disabled the webhooks for the time being and considering manual trigger for the deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOD157NG4ns9NAr6PAZSAg.png" /><figcaption>No Webhooks enabled</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PFsGfk60-TYB4NctfTp6wA.png" /><figcaption>Default Environment selected</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TsiuzMsjBzThgHiArPf5LQ.png" /><figcaption>I considered Linux and standard environment</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HrUtrGT7ezrEFGMdT30COw.png" /><figcaption>buildspec.yml selection</figcaption></figure><p>NOTE: By default, CodeBuild looks for a file named buildspec.yml in the source code root directory. In case you keep yaml as extension build will fail. so keep an eye on that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mj68NHHzi4yyBltggA9g5Q.png" /><figcaption>No Artifacts as of now configured</figcaption></figure><p>Select the servicerole (CodeBuild-HealthUtils-Publish-Role)we created initially and click on create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsEwwmlzqqeOZIlPaNpARg.png" /></figure><p>Once the project setup is done, we can initiate the pipeline. As of now we have zero package in codeartifact domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JwuLlxqoYyR1amx7hO9a9A.png" /></figure><p>We are going to use the codebuild pipeline to do the package publish activity.</p><p>Once the project is created, it will be listed in console as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iWy5FF4GTv5kRgGnjZoQzQ.png" /></figure><p>Once we opened the project, we will get option to trigger the build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DXcrXpNEDVDVOW5RfK0ddA.png" /></figure><p>Once build is started the phases will be visible as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g4u91bKgy5SrXroUQQ-wXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*liBRU8-mSgrgtdfTSiHlGw.png" /></figure><p>Now you can see the new packages in codeartifact repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7kcQHfDojEuBOrztxRc-A.png" /></figure><p>If you want to publish new version 0.1.2 we need to change in pyproject.toml in root directory as shown below and trigger pipeline again.</p><pre>[build-system]<br>requires = [&quot;setuptools&quot;]<br>build-backend = &quot;setuptools.build_meta&quot;<br><br>[project]<br>name = &quot;health-utils&quot;<br>version = &quot;0.1.2&quot;<br>description = &quot;A simple reusable Python health utility&quot;<br>requires-python = &quot;&gt;=3.10&quot;<br><br>[tool.setuptools.packages.find]<br>include = [&quot;health_utils*&quot;]</pre><p>After updating the code, i triggered the pipeline again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3W5nCD0G4TMOXHYD6g81VA.png" /></figure><p>you can see the <strong>unit tests status</strong> logs as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*H5xNUaRaDmSIs9y10tXNBA.png" /></figure><p>Once the build is completed, we can see the 0.1.2 in the packages section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3cvY2_La8KltFBfFNC6PiA.png" /></figure><h4>FastAPI Testing</h4><p>Clone the repository to your local and switch to consumer-app directory.</p><p>Make sure the aws configure is done before initiating the next steps.</p><pre># Navigate to the consumer application<br>cd consumer-app<br><br># Create a virtual environment<br>python -m venv .venv<br><br># Activate the virtual environment<br>.\.venv\Scripts\Activate.ps1<br><br># Install FastAPI and Uvicorn<br>python -m pip install fastapi uvicorn<br><br># Authenticate pip with AWS CodeArtifact<br>aws codeartifact login `<br>  --tool pip `<br>  --repository python-packages `<br>  --domain enminto-domain `<br>  --domain-owner &lt;AWS_ACCOUNT_ID&gt; `<br>  --region &lt;AWS_REGION&gt; `<br>  --profile enminto-dev<br><br># Install the published Python package<br>python -m pip install health-utils==0.1.2<br><br># Start the FastAPI application<br>python -m uvicorn main:app --reload</pre><p>Execution looks like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E_VTPwwXyV2h_-ELPKLAHw.png" /></figure><p>FastAPI Application will be accessible at <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000</a></p><p>Startup looks like below and we are testing below endpoints.</p><p><a href="http://127.0.0.1:8000/health/200">http://127.0.0.1:8000/health/200</a></p><p><a href="http://127.0.0.1:8000/health/500">http://127.0.0.1:8000/health/530</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TOtE6ByKYuscWeyiWhDGww.png" /></figure><p>I tried to access <a href="http://127.0.0.1:8000/health/200">http://127.0.0.1:8000/health/200</a> and it is showing healthy as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YSObuecrC042h_FAytBCzw.png" /></figure><p>As per logic any code after 500 should show as healthy : False. so to demonstrate that i tested 530 response code it is showing healthy as false.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qmi9Za5ZBIpLk9nV9k4gJA.png" /></figure><h4>Conclusion</h4><p>In this hands-on project, we built a workflow to publish a reusable Python package privately using AWS CodeArtifact and AWS CodeBuild. We configured IAM permissions, automated unit testing and package building, and published the package to CodeArtifact.</p><p>Finally, we installed the published package in a separate FastAPI application and verified its functionality using health-check endpoints.</p><p>This project demonstrates how AWS developer tools can simplify Python package management and make reusable code easier to maintain and share across applications. The workflow can be extended further by triggering builds automatically whenever code changes are pushed to GitHub.</p><h4><strong>Cleanup</strong></h4><p>To avoid unnecessary AWS charges, delete the CodeBuild project, the CodeArtifact package versions, repository, and domain if they are no longer needed. Remove the associated CloudWatch log groups and the Secrets Manager secret if it was created exclusively for this tutorial. Delete the IAM service role and custom policy only if they are not used by other projects. Stop the FastAPI server by pressing Ctrl+C and remove local virtual environments if they are no longer required. Finally, revoke or rotate any temporary GitHub personal access token that is no longer needed. Before deleting resources, ensure they are not shared with other applications, as deleting CodeArtifact repositories or domains can permanently remove stored packages.</p><p><strong>Thank you</strong></p><p><strong>Sarath Kumar Tamminana</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0138930f2b69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS CodePipeline vs Jenkins vs GitHub Actions — A Practical CI/CD Comparison]]></title>
            <link>https://medium.com/@tams67680/aws-codepipeline-vs-jenkins-vs-github-actions-a-practical-ci-cd-comparison-588827990a2e?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/588827990a2e</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 14:22:42 GMT</pubDate>
            <atom:updated>2026-01-04T14:22:42.990Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS CodePipeline vs Jenkins vs GitHub Actions — A Practical CI/CD Comparison</h3><h4>Introduction</h4><p>CI/CD tooling decisions usually start simple and become complicated very quickly. Most teams begin with a single pipeline, but as applications, environments, and compliance requirements grow, the limitations of a tool become visible.</p><p>In AWS-centric setups, the discussion often comes down to three options: AWS CodePipeline, Jenkins, and GitHub Actions. I’ve seen all three used successfully — and also misused — depending on how well the tool matched the team’s ecosystem and maturity.</p><p>This comparison is written from a practical DevOps point of view, focusing on operational responsibility, AWS integration, security boundaries, and long-term maintainability. The table below is intentionally concise so it can be reused in design reviews, blogs, or presentations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vd1qRM2JjmGrEBztL4hksw.png" /><figcaption>GHA vs Code Pipeline vs Jenkins</figcaption></figure><h4>Personal Experience</h4><p>In my experience working on AWS-based platforms, I’ve seen teams start with Jenkins because of its flexibility, only to later struggle with plugin maintenance, security patching, and scaling the infrastructure itself. In contrast, AWS CodePipeline worked extremely well for workloads that were deeply integrated with services like CodeBuild, ECS, and IAM, especially where compliance and least-privilege access were important. More recently, GitHub Actions has proven to be a strong choice for developer productivity, particularly for teams standardizing on GitHub and adopting OIDC-based authentication to AWS. The biggest lesson for me has been that CI/CD success depends less on the tool and more on how well it aligns with the organization’s cloud strategy and operational maturity.</p><h4>CI/CD Tools Comparison Table</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*881EswYDAppzUAbmOlRewQ.png" /><figcaption>CodePipeline Vs Jenkins Vs Github Actions</figcaption></figure><h4>Conclusion</h4><p>There is no single CI/CD tool that fits every team or every architecture. AWS CodePipeline, Jenkins, and GitHub Actions each solve the CI/CD problem from different angles, and their effectiveness depends largely on the environment in which they are used.</p><p>AWS CodePipeline works best when teams want tight integration with AWS services and minimal operational overhead. Jenkins offers unmatched flexibility and control but requires significant effort to manage, secure, and scale. GitHub Actions provides an excellent developer experience and is well suited for teams that have standardized on GitHub and prefer workflow-as-code.</p><p>Ultimately, the right choice is less about features and more about alignment with the team’s cloud strategy, operational maturity, and long-term maintainability goals. Choosing a CI/CD tool should simplify delivery pipelines, not become another system that needs constant attention.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=588827990a2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplifying AWS Deployments: Understanding buildspec.yml and appspec.yml]]></title>
            <link>https://medium.com/@tams67680/simplifying-aws-deployments-understanding-buildspec-yml-and-appspec-yml-cffbb6d091d4?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/cffbb6d091d4</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Mon, 10 Nov 2025 07:14:03 GMT</pubDate>
            <atom:updated>2025-11-10T07:14:03.957Z</atom:updated>
            <content:encoded><![CDATA[<p>When working with AWS CI/CD services like <strong>CodeBuild</strong>, <strong>CodeDeploy</strong>, or <strong>CodePipeline</strong>, you’ll often come across two important YAML files: <strong>buildspec.yml</strong> and <strong>appspec.yml</strong>.</p><p>They look similar, but they serve different purposes in your pipeline. Let’s understand them in simple terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*dd0vuPF8L3LMCGXL.jpg" /></figure><h3>What is buildspec.yml?</h3><p>The <strong>buildspec.yml</strong> file is used by <strong>AWS CodeBuild</strong>.<br>It tells CodeBuild <strong>how to build your application</strong> — for example, how to install dependencies, run tests, and package your code.</p><p>Think of it as a <strong>build instruction file</strong>.</p><pre>version: 0.2<br><br>phases:<br>  install:<br>    commands:<br>      - echo Installing dependencies...<br>      - npm install<br><br>  build:<br>    commands:<br>      - echo Building the application...<br>      - npm run build<br><br>  post_build:<br>    commands:<br>      - echo Build completed on `date`<br><br>artifacts:<br>  files:<br>    - &#39;**/*&#39;<br>  discard-paths: yes</pre><p><strong>What it does:</strong></p><ul><li>Installs dependencies</li><li>Builds the project</li><li>Packages the output (artifacts)</li><li>Uploads them for the next pipeline stage</li></ul><h3>What is appspec.yml?</h3><p>The <strong>appspec.yml</strong> file is used by <strong>AWS CodeDeploy</strong>.<br>It tells CodeDeploy <strong>how to deploy your built application</strong> — for example, where to copy files and what scripts to run during deployment.</p><p>Think of it as a <strong>deployment instruction file</strong>.</p><h3>Example appspec.yml (for EC2 or On-Prem)</h3><pre>version: 0.0<br>os: linux<br>files:<br>  - source: /<br>    destination: /var/www/html<br><br>hooks:<br>  BeforeInstall:<br>    - location: scripts/before_install.sh<br>      runas: root<br>  AfterInstall:<br>    - location: scripts/after_install.sh<br>      runas: root<br>  ApplicationStart:<br>    - location: scripts/start_server.sh<br>      runas: root<br>  ValidateService:<br>    - location: scripts/validate.sh<br>      runas: root</pre><p><strong>What it does:</strong></p><ul><li>Copies files from your build artifact to the target location</li><li>Runs deployment lifecycle scripts (like stop server, copy files, start server, validate)</li></ul><h3>How They Work Together</h3><p>Here’s the simple flow inside a typical <strong>AWS CodePipeline</strong>:</p><ol><li><strong>Source Stage</strong> — Gets the code from GitHub or S3.</li><li><strong>Build Stage (CodeBuild)</strong> — Uses buildspec.yml to build and package the app.</li><li><strong>Deploy Stage (CodeDeploy)</strong> — Uses appspec.yml to deploy the built code to EC2, ECS, or Lambda.</li></ol><p>So, <strong>buildspec.yml builds it</strong>, and <strong>appspec.yml deploys it</strong>.</p><pre>my-app/<br>├── buildspec.yml<br>├── appspec.yml<br>├── scripts/<br>│   ├── before_install.sh<br>│   ├── after_install.sh<br>│   ├── start_server.sh<br>│   └── validate.sh<br>└── src/<br>    └── index.js</pre><h3>Common Mistakes</h3><ul><li>Putting deployment commands inside buildspec.yml<br>→ Keep build and deployment logic separate.</li><li>Forgetting to include appspec.yml in your build artifact<br>→ CodeDeploy won’t know what to do without it.</li><li>Using wrong file paths in hooks<br>→ Always check that script locations match your project folder structure.</li></ul><h3>In Short</h3><ul><li><strong>buildspec.yml</strong> → Used by <strong>CodeBuild</strong> → Defines how to build your code.</li><li><strong>appspec.yml</strong> → Used by <strong>CodeDeploy</strong> → Defines how to deploy your code.</li></ul><p>Together, they make your <strong>AWS CI/CD pipeline</strong> complete and automated.</p><h3>Final Thoughts</h3><p>Understanding these two files is essential when working with <strong>AWS Developer Tools</strong>.<br>They define the heart of your continuous integration and continuous deployment setup.</p><p>Once you master them, setting up automated pipelines with <strong>CodePipeline, CodeBuild, and CodeDeploy</strong> becomes much easier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cffbb6d091d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating App Version Upgrades with AWS CodeDeploy and appspec.yml]]></title>
            <link>https://medium.com/@tams67680/automating-app-version-upgrades-with-aws-codedeploy-and-appspec-yml-4ea7f2746566?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ea7f2746566</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Wed, 15 Oct 2025 09:57:25 GMT</pubDate>
            <atom:updated>2025-10-15T09:57:25.270Z</atom:updated>
            <content:encoded><![CDATA[<p>In modern DevOps workflows, automation and reliability are key when it comes to deploying applications. <strong>AWS CodeDeploy</strong> is a powerful deployment service that helps developers and system administrators automate software deployments to a variety of compute services including Amazon EC2, AWS Lambda, and on-premises servers.</p><p>In this article, I’ll walk you through how I used <strong>AWS CodeDeploy</strong> to upgrade an application from <strong>version 1 to version 2</strong>using the <strong>appspec.yml</strong> file. This file plays a central role in managing lifecycle hooks and defining exactly what happens during each stage of the deployment process.</p><p>Whether you’re just starting with CodeDeploy or looking to refine your deployment strategy, this guide provides a practical example — complete with step-by-step instructions and screenshots — to help you understand how CodeDeploy works in real-world scenarios.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/0*ckpf2Dze91Fh6-Hf.png" /></figure><p>Here are the things we need for this implementation</p><ol><li>CodeDeploy Execution Role with Lambda Permissions</li><li>CodeDeploy access to setup application/deployment group/deployments</li><li>Lambda Function with versions for setting up alias.</li></ol><h4>CodeDeploy Execution Role with Lambda Permissions</h4><p>We need to use this role while setting up code deploy deployment group. It should have permissions for fetching the appspec.yml file from repository or S3 Bucket and component on which it need to deploy which is Lambda in our case.</p><p>As of now for convenience purpose , i added S3 Full access and AWSCodedeployRoleForLambda. These are managed policies which serve our purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XWKg_JCjKaQ-6Yv73wG4tQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hXyArVRbEh0IepQ8d_6rjQ.png" /></figure><h4>Lambda Function with versions for setting up alias.</h4><p>Lets create a sample python function and two versions and an alias for the implementation. Make sure to keep the name as “testfunction” if you want to use the appspec.yml file as it is.</p><p>If not you need to update the yaml file with the function name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jLU-jG6Iky-SKdAJyfN5LQ.png" /></figure><p>I published two versions and created one alias. I did slight modification toe the body by adding Version 2 at the end for difference.</p><h4>Version 1</h4><pre>import json<br><br>def lambda_handler(event, context):<br>    # TODO implement<br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: json.dumps(&#39;Hello from Lambda!&#39;)<br>    }</pre><h4>Version 2</h4><pre>import json<br><br>def lambda_handler(event, context):<br>    # TODO implement<br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: json.dumps(&#39;Hello from Lambda! Version 2&#39;)<br>    }</pre><p>Once versions are created, they look like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eueaw6xE_WyG0mm6x7Rhtw.png" /></figure><p>create an alias with name “prod” and point version 1 completely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J--uGO1B4Jk3zOPv8WYVLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p96cyq8xSe6hdT5ehyQt4w.png" /></figure><p>Now lets complete the CodeDeploy part. Create an application as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8YlyyeldRxBZ1msq55lzA.png" /></figure><p>Once application is created, create a deployment group by providing details like name, service role and deployment configuration. I considered AllAtOnce for convenience purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x4U8yBHKAd5KkIccGXqGIg.png" /></figure><p>Once deployment group is created, we need to create a deployment as a final step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gmFfTySTfD96oddsiuQZMw.png" /></figure><p>For convenice i updated the appspec.yml content directly into editor, you can place in s3 bucket and do the same.</p><p><strong>appspec.yml</strong></p><pre>version: 0.0<br>Resources:<br>  - myLambdaFunction:<br>      Type: AWS::Lambda::Function<br>      Properties:<br>        Name: testfunction<br>        Alias: prod<br>        CurrentVersion: 1<br>        TargetVersion: 2</pre><p>Once the deployment is completed it will show like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I-jerbISDmxzborMYAIR3Q.png" /></figure><p>You can validate the Lambda deployment by checking whether version is changed from 1 to 2 or not from console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U5ZQadZTYzRuH8PhEqiYvg.png" /></figure><h3>Conclusion</h3><p>Upgrading your application from one version to another doesn’t have to be complex or risky. With <strong>AWS CodeDeploy</strong> and a well-structured <strong>AppSpec.yml</strong> file, you can automate deployments, maintain control over each phase, and ensure minimal downtime. This approach not only streamlines your CI/CD pipeline but also adds consistency and reliability to your release process. As you’ve seen in this example, moving from <strong>version 1 to version 2</strong> becomes a smooth, repeatable task — one that’s easy to manage and scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ea7f2746566" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate Docker Image Builds and Push to ECR Using AWS CodeBuild]]></title>
            <link>https://medium.com/@tams67680/automate-docker-image-builds-and-push-to-ecr-using-aws-codebuild-1e22d4363985?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e22d4363985</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Thu, 09 Oct 2025 11:42:24 GMT</pubDate>
            <atom:updated>2025-10-09T11:42:24.567Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>Automating the process of building and publishing Docker images is a key step in modern CI/CD pipelines. This article walks through how to use <strong>AWS CodeCommit</strong> to manage source code, <strong>AWS CodeBuild</strong> to build a Docker image and push it to <strong>Amazon Elastic Container Registry (ECR)</strong>, and <strong>Amazon S3</strong> to store build artifacts. By combining these AWS services, you can create a fully managed and scalable pipeline for containerized applications with minimal manual steps. Whether you’re setting up a new workflow or optimizing an existing one, this guide will help you understand the essential steps to publish Docker images using CodeBuild.</p><p>Here are the things we need for this implementation</p><ol><li>IAM Role for codebuild</li><li>S3 Bucket for storing the artifacts</li><li>Code Commit Repo</li><li>Elastic Container Registry for storing the images</li><li>Code Build Project for publishing the image</li></ol><p><strong>IAM Role for CodeBuild</strong></p><p>Create an IAM Role with below Trust Relationship and Permissions. For convenience purpose i selected full access but in production environment we should provide only those which are required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CpQqiUjgxS5swPVBe4-Omw.png" /><figcaption>Trust Relationship</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z7Pv6X9YB8o5pXWqHVyl8Q.png" /><figcaption>Permissions for Publishing the image</figcaption></figure><p><strong>S3 Bucket for storing Artifacts</strong></p><p>In this bucket we are going to store the Artifacts which are generated in our codebuild pipeline. Just for demonstration purpose i am creating a imagedefinition.json file and placing in the s3 bucket. Usually the jars/zip files with application libraries will be fetched in artifacts section</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7BNkoQWE46F4-FXy6zAuFA.png" /></figure><p><strong>Code Commit Repo</strong></p><p><strong>buildspec.yml</strong></p><pre>version: 0.2<br><br>env:<br>  variables:<br>    AWS_REGION: &quot;eu-west-1&quot;<br>    ACCOUNT_ID: &quot;Place-your-account-id&quot;<br>    REPO_URI: &quot;Place-your-ecr-repo-url&quot;<br><br>phases:<br>  pre_build:<br>    commands:<br>      - echo Logging in to Amazon ECR...<br>      - aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com<br>      - IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)<br>  build:<br>    commands:<br>      - echo Building Docker image...<br>      - docker build -t $REPO_URI:$IMAGE_TAG .<br>      - docker tag $REPO_URI:$IMAGE_TAG $REPO_URI:latest<br>  post_build:<br>    commands:<br>      - echo Pushing image to ECR...<br>      - docker push $REPO_URI:$IMAGE_TAG<br>      - docker push $REPO_URI:latest<br>      - echo Writing image definitions...<br>      - printf &#39;[{&quot;name&quot;:&quot;python-app&quot;,&quot;imageUri&quot;:&quot;%s&quot;}]&#39; $REPO_URI:$IMAGE_TAG &gt; imagedefinitions.json<br><br>artifacts:<br>  files: imagedefinitions.json<br><br>cache:<br>  paths:<br>    - &#39;/root/.cache/pip&#39;</pre><p>Make sure to update below entries in buildspec.yml as per your requirement</p><pre>AWS_REGION: &quot;eu-west-1&quot;<br>    ACCOUNT_ID: &quot;Place-your-account-id&quot;<br>    REPO_URI: &quot;Place-your-ecr-repo-url&quot;</pre><p>This buildspec.yml file defines the steps for AWS CodeBuild to build and push a Docker image to Amazon ECR. It logs into ECR, builds the image using the commit hash as a tag, and also tags it as latest. After building, it pushes both tags to the ECR repository. It then generates an imagedefinitions.json file, which is used in deployment pipelines like CodePipeline with ECS. Finally, it uploads this file as a build artifact for the next stage.</p><p><strong>Dockerfile</strong></p><pre># Use official Python base image<br>FROM python:3.10-slim<br><br># Set working directory<br>WORKDIR /app<br><br># Copy app files<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br><br>COPY . .<br><br># Run the application<br>CMD [&quot;python&quot;, &quot;app.py&quot;]</pre><p><strong>app.py</strong></p><pre>from flask import Flask<br>app = Flask(__name__)<br><br>@app.route(&#39;/&#39;)<br>def hello():<br>    return &#39;Hello from Flask on ECS!&#39;<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(host=&#39;0.0.0.0&#39;, port=80)</pre><p><strong>requirements.txt</strong></p><pre>flask</pre><p>Above files are required for publishing an image into ECR using CodeBuild Pipeline.</p><p><strong>Elastic Container Registry for storing the images</strong></p><p>ECR Repo needs to be created with simple-app name as shown below. consider using default options for ease of use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yiETOmcf3eKZvMuwJrmUpw.png" /></figure><p>Once the repo is created, it looks like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OKLRNPRckibixdxZj00e1w.png" /></figure><h4><strong>Code Build Project for publishing the image</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ealgQbcWcPPViQJZJDdyCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YwUjyCojLQgPx69hIQY5IQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cETiCvHgdGzwAuKLouFlnQ.png" /></figure><p>Make sure you select the service role which we created in the first step for the below option</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v-d8qc-90Y3NbgaGTciXxA.png" /></figure><p>we are using buildspec.yml file in the root folder of the repo, so select the second option as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V-DyeofkpBhe7hFfWZ8cIA.png" /></figure><p>Make sure to select the s3 bucket we created, we need this to store the artifacts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kTqjMC5c0CIlxt2dZowCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cx0itPvOGtx15CydQtDLgw.png" /></figure><p>We need to start build for publishing our first image.once it started running, it will move to inprogress stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*mn_i0DOpj8fU0BBdsDS4DA.png" /></figure><p>After completion, the phases looks like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sQGTD42U1rI0A1JDawHk2w.png" /></figure><p>We can check images as well in ECR Repo as well</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DvgBuDADHHutQwtcyLHpbg.png" /></figure><p>Lets check the artifacts in S3 whether imagedefinitions.json is created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WrDrUo3LFk4woB7vDa0JYQ.png" /></figure><h3>Conclusion</h3><p>By combining <strong>AWS CodeCommit</strong>, <strong>CodeBuild</strong>, <strong>ECR</strong>, and <strong>S3</strong>, we’ve created an automated and reliable workflow for building and publishing Docker images. This setup not only reduces manual effort but also ensures consistency and scalability across development and deployment processes. Whether you’re working on a small project or managing multiple services, integrating these AWS tools can significantly streamline your CI/CD pipeline. With your images now automatically built and pushed to ECR, you’re well-positioned to move toward fully automated deployments and a more efficient DevOps workflow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e22d4363985" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD Pipeline on AWS: Deploy a Static Website to EC2 with CodePipeline]]></title>
            <link>https://medium.com/@tams67680/ci-cd-pipeline-on-aws-deploy-a-static-website-to-ec2-with-codepipeline-15122053a321?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/15122053a321</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Thu, 21 Aug 2025 12:59:05 GMT</pubDate>
            <atom:updated>2025-08-21T12:59:05.208Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we’ll set up a simple CI/CD pipeline using <strong>AWS CodePipeline</strong>, <strong>CodeBuild</strong>, and <strong>CodeDeploy</strong> to automate the deployment of a static website to an EC2 instance. While the app itself is a basic index.html page, this pipeline demonstrates the core principles of automation — preparing files with CodeBuild, and deploying them to a server using CodeDeploy. This setup can be easily extended for more complex applications in the future.</p><p>By end of this implementation we are going to have a static website like below hosted on our EC2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ole5pYCg7DQhqajUnaS5Lw.png" /></figure><h4>Setup EC2 Instance with CodeDeploy Agent Installed and running.</h4><p>Launch an t3.micro EC2 Instance using Amazon Linux Operating System. Make sure the security group have inbound rules for ssh and http. Enable Public IP and attach an IAM Role with CodeDeploy Permission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFcU8mYextTm9W1KVn0V6Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5ihU7Td2jRSobWtf01aIQ.png" /></figure><p>Once the instance is up and running, ssh into the machine and run the below commands to deploy the agent.</p><pre>sudo yum update -y<br>sudo yum install ruby wget -y<br>cd /home/ec2-user<br>wget https://aws-codedeploy-eu-west-1.s3.eu-west-1.amazonaws.com/latest/install<br>chmod +x ./install<br>sudo ./install auto<br>sudo service codedeploy-agent start<br>sudo service codedeploy-agent status</pre><p><strong>NOTE</strong>: Please change the region(eu-west-1) as per your requirement. Once the Agent is running it looks like below when you check the status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHojRYflZ8DAXTQTgoa6Ig.png" /></figure><p><strong>NOTE</strong>: Make sure the IAM Role have all the required permissions as i shown above otherwise the Pipelines will go to Pending Stage.</p><p>Now EC2 Instance Setup is done.</p><h4>Directory Structure we need to follow for this implementation</h4><pre>myapp/<br>├── appspec.yml<br>├── buildspec.yml<br>├── index.html<br>└── scripts/<br>    ├── install_dependencies.sh<br>    ├── start_server.sh<br>    └── stop_server.sh</pre><h4>File Descriptions:</h4><ul><li>index.html Your main static web page, deployed to /var/www/html on the EC2 instance.</li><li>buildspec.yml Used by <strong>CodeBuild</strong> to package the application and define the output artifacts.</li><li>appspec.yml Used by <strong>CodeDeploy</strong> to describe what files to copy and which lifecycle hooks to run.</li><li>scripts/ Contains lifecycle hook scripts for CodeDeploy:</li><li>install_dependencies.sh – Installs any needed packages (e.g., httpd)</li><li>start_server.sh – Starts the web server (sudo systemctl start httpd )</li><li>stop_server.sh – Stops the web server (sudo systemctl stop httpd)</li></ul><h4>Source Code for Implementation</h4><ol><li><strong>index.html</strong></li></ol><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;<br>  &lt;title&gt;Welcome to My App&lt;/title&gt;<br>  &lt;style&gt;<br>    body {<br>      margin: 0;<br>      font-family: &quot;Segoe UI&quot;, Tahoma, Geneva, Verdana, sans-serif;<br>      background: linear-gradient(135deg, #1e3c72, #2a5298);<br>      color: #fff;<br>      display: flex;<br>      flex-direction: column;<br>      justify-content: center;<br>      align-items: center;<br>      height: 100vh;<br>      text-align: center;<br>    }<br><br>    h1 {<br>      font-size: 3rem;<br>      margin-bottom: 0.5rem;<br>    }<br><br>    p {<br>      font-size: 1.25rem;<br>      max-width: 600px;<br>      margin: 0 auto 2rem auto;<br>    }<br><br>    .button {<br>      background-color: #fff;<br>      color: #2a5298;<br>      padding: 0.75rem 1.5rem;<br>      font-size: 1rem;<br>      border: none;<br>      border-radius: 30px;<br>      cursor: pointer;<br>      transition: all 0.3s ease;<br>    }<br><br>    .button:hover {<br>      background-color: #e6e6e6;<br>    }<br><br>    footer {<br>      position: absolute;<br>      bottom: 1rem;<br>      font-size: 0.85rem;<br>      color: #cccccc;<br>    }<br>  &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;h1&gt;🚀 Welcome to My Web App&lt;/h1&gt;<br>  &lt;p&gt;This is a modern, responsive landing page created with just HTML and CSS. Deployed via AWS CodePipeline and CodeDeploy!&lt;/p&gt;<br>  &lt;button class=&quot;button&quot; onclick=&quot;alert(&#39;Thanks for visiting!&#39;)&quot;&gt;Get Started&lt;/button&gt;<br><br>  &lt;footer&gt;<br>    &amp;copy; 2025 MyApp | Built with ❤️ on AWS<br>  &lt;/footer&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>2. <strong>buildspec.yml</strong></p><pre>version: 0.2<br><br>phases:<br>  install:<br>    commands:<br>      - echo Installing dependencies if needed<br>  build:<br>    commands:<br>      - echo Building the app<br>  post_build:<br>    commands:<br>      - echo Skipping zip. CodeDeploy will use raw files directly.<br>artifacts:<br>  files:<br>    - &#39;**/*&#39;</pre><p><strong>NOTE</strong>: This is just for visual representation of buildspec.yml, In realtime buildspec file consist of complex build logic as per project requirement.</p><p>3. <strong>appspec.yml</strong></p><pre>version: 0.0<br>os: linux<br><br>files:<br>  - source: /<br>    destination: /home/ec2-user/myapp<br>    overwrite: true<br>  - source: index.html<br>    destination: /var/www/html<br>    overwrite: true<br><br>hooks:<br>  ApplicationStop:<br>    - location: scripts/stop_server.sh<br>      timeout: 300<br>      runas: ec2-user<br><br>  BeforeInstall:<br>    - location: scripts/install_dependencies.sh<br>      timeout: 300<br>      runas: ec2-user<br><br>  ApplicationStart:<br>    - location: scripts/start_server.sh<br>      timeout: 300<br>      runas: ec2-user</pre><p>4. <strong>clean_directory.sh</strong></p><pre>#!/bin/bash<br><br>echo &quot;Cleaning up /home/ec2-user/myapp&quot;<br>rm -rf /home/ec2-user/myapp/*<br>rm -rf /home/ec2-user/myapp/.* 2&gt;/dev/null || true</pre><p>5. <strong>install_dependencies.sh</strong></p><pre>#!/bin/bash<br>echo &quot;Installing dependencies&quot;<br>sudo yum install -y httpd</pre><p>6. <strong>start_server.sh and stop_server.sh</strong></p><pre>#!/bin/bash<br>echo &quot;Starting application&quot;<br>sudo systemctl start httpd<br><br>#!/bin/bash<br>echo &quot;Stopping existing application (if any)&quot;<br>sudo systemctl stop httpd || true</pre><p>Now files are ready, Create an S3 Bucket for placing these files as a zip. Create a folder named source and we are going to use that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkA7zMrTekV8nnEgLQK7Cg.png" /></figure><p>Create a zip file with all the required libraries and upload to S3 Bucket.</p><pre>Lambda Labs % zip -r myapp.zip buildspec.yml appspec.yml index.html scripts/<br>  adding: buildspec.yml (deflated 41%)<br>  adding: appspec.yml (deflated 57%)<br>  adding: index.html (deflated 48%)<br>  adding: scripts/ (stored 0%)<br>  adding: scripts/stop_server.sh (deflated 8%)<br>  adding: scripts/install_dependencies.sh (deflated 3%)<br>  adding: scripts/start_server.sh (deflated 1%)<br>  adding: scripts/clean_directory.sh (deflated 34%)<br>Lambda Labs %</pre><p>Upload myapp.zip into S3 Source folder as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81kIQR3WU9tgwGXqckV89A.png" /></figure><p>Now we are done with Source Code/EC2 Instance Setup, lets concentrate on AWS Developer Tools now. <strong>AWS CodeCommit</strong> is no longer available to new customers. Existing customers of AWS CodeCommit can continue to use the service as normal. So we are considering S3 as source for storing our artifacts.</p><p><strong>AWS CodeBuild</strong> is a fully managed service that automates the process of building and packaging your application. It runs build commands defined in a buildspec.yml file and outputs deployment-ready artifacts. In this setup, CodeBuild prepares static files like index.html and scripts, making them ready for deployment via CodeDeploy.</p><p>Before proceeding with code build project setup, we need to setup the role is required for the IAM authentication.</p><p><strong>codebuildlearningrole</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*54RPDmFPmeN8pd9ViDQwJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3tzKYhTZZlqnNCkx4COxg.png" /></figure><p>Setup the Code Build Project using below properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L0Ze8JRx8IWyz7aIyMvOng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sw8pulA80w-3OrlSJ7JE4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eVh6-HRgH-MX6PaVUKmAPA.png" /></figure><p>Select the role which we created in the previous step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RlZW6j2R6zN584ROdQhesg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ttCTX5r1DEI1Tn6H45ocrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n0ddpEgLWopr_cdoR0fqYg.png" /></figure><p>Once you created the project, it looks like these.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sbXEqLMeK5UyOWFa6coYsg.png" /></figure><p>Click Start Build</p><p>You will see the Phase details like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uay8qKR6wUAY0-gLPry5Dw.png" /></figure><p>Once the build is sucessfull, you can see a new folder related to artifact will be created in S3 Bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qv1TbZL258pIsbXgBXkUcQ.png" /></figure><p>Now we done with Code Build Section, lets move to Code Deploy section. As usual lets complete the Code Deploy IAM Role setup.</p><p><strong>codedeploylearningrole</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiXLmA9HvzoVyYHxSEYG2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KNmdZeb0rzgxxoZbf4tpPg.png" /></figure><p>Once this is done, we are good to go with Code Deploy Setup. As part of that we need to setup below things.</p><ol><li><strong>Application</strong></li><li><strong>Deployment Group</strong></li><li><strong>Deployment</strong></li></ol><p>Creating Application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VJ9nEEmNvxpU8CeZjgRHGw.png" /></figure><p>Once Application is created, setup Deployment group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WRGttfswHieuFp5ewylwYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SjPVFJ7uPvbN8dDoJxdLFA.png" /></figure><p>Select the IAM role which we created previously for Code Deploy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U30Kaoa-mLajvXjCNOHTRw.png" /></figure><p>NOTE: Make sure your instance have Name as testinstance or change it as per your instance tag. This is very important for code deploy to identify the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hlWM4xd-svkMLbqgwUky_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cKnxDFrLvMkydBtgSpQJrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bn2635mEp8wJ6ySIKWuVTQ.png" /></figure><p>once the deployment is completed, events looks like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LcnhWHYD3ePJyWxWHFZJWw.png" /></figure><p>now take the public ip of the instance and do a search, it displays page like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6X_yTlrkknXO3QJFkWX-cQ.png" /></figure><p>Now we have working Source Code/Code Build/Code Deploy pipelines.</p><p>Lets create Code Pipeline and integrate all these services in one workflow. But before this we need to make sure the IAM role in place for smooth setup.</p><p><strong>codepipelinetestrole</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eug24GedNSR-UaFYK_VINg.png" /></figure><p><strong>Code Pipeline Setup</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nc3nZhOdtU1ZZxdlXjEFtA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fp92YnIkveoe-IDW0CjRdQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KR5JIMrBrRy5BlqYNXzO4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wthYtsOVbb2e84UEc3EObQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuN1xzVJhSJ-AhFPT3UuhA.png" /></figure><p>Leave the test stage empty</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sP4Kp5c_m_bxiDrz3r_WMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AZ-HcI3P_-W0UdYpu-b6TQ.png" /></figure><p>Once created, you will see pipeline like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lfQl1j4rKjsojEDtttQAhw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fzvlVzwKszGIhj4nVikqWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EiHazZPFsucNH5FaJQiOdQ.png" /></figure><p>Now Lets Add a Manual Approval for Deploy Stage and deploy new index.html code.</p><p>Now click on Edit Pipeline and select Deploy Stage</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lp4CwV2f36GC3Gdb02EOjQ.png" /></figure><p>Leave everything for testing purpose and click done</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iiqy7Ziz9_pPlS6zDIWlsQ.png" /></figure><p>Click Save once Approval Action is added.</p><h4>Update the Source Code with new index.html</h4><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;/&gt;<br>  &lt;title&gt;MyApp — Landing Page&lt;/title&gt;<br>  &lt;style&gt;<br>    * {<br>      box-sizing: border-box;<br>    }<br><br>    body {<br>      margin: 0;<br>      padding: 0;<br>      font-family: &#39;Helvetica Neue&#39;, sans-serif;<br>      background-color: #121212;<br>      color: #f0f0f0;<br>      display: flex;<br>      flex-direction: column;<br>      align-items: center;<br>      justify-content: center;<br>      height: 100vh;<br>      text-align: center;<br>    }<br><br>    h1 {<br>      font-size: 3em;<br>      margin-bottom: 0.5em;<br>      color: #00bcd4;<br>    }<br><br>    p {<br>      font-size: 1.2em;<br>      color: #cccccc;<br>      max-width: 600px;<br>      margin-bottom: 2em;<br>    }<br><br>    .button {<br>      background: #00bcd4;<br>      border: none;<br>      color: #121212;<br>      padding: 0.75em 1.5em;<br>      font-size: 1em;<br>      border-radius: 5px;<br>      cursor: pointer;<br>      transition: background 0.3s ease;<br>    }<br><br>    .button:hover {<br>      background: #00acc1;<br>    }<br><br>    footer {<br>      position: absolute;<br>      bottom: 20px;<br>      font-size: 0.9em;<br>      color: #666;<br>    }<br>  &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br><br>  &lt;h1&gt;Welcome to MyApp&lt;/h1&gt;<br>  &lt;p&gt;A fast, reliable, and secure web application deployed seamlessly with AWS CodePipeline and CodeDeploy.&lt;/p&gt;<br>  &lt;button class=&quot;button&quot; onclick=&quot;alert(&#39;Deployment successful!&#39;)&quot;&gt;Check Status&lt;/button&gt;<br><br>  &lt;footer&gt;&amp;copy; 2025 MyApp. All rights reserved.&lt;/footer&gt;<br><br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>Now i am uploading new myapp.zip file into S3 bucket which automatically triggers new deployment with updated static page content.</p><p>once i uploaded new zip file , the pipeline triggers automatically as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fvo3nfYNMZ5Px88EYEYYHA.png" /></figure><p>It will wait for our approval because enabled Approval Action in Deploy Stage. As of now i haven’t added any external approvars so myself will approve this for demonstration purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQSi9q_CZPTr6kGEGr6wYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CC3Vu8MDduAG1vcmI3h78A.png" /></figure><p>Now everything is completed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xN3Zdz41_tlcfHXlKlV7dQ.png" /></figure><p>lets access the Public IP of the instance again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P1Shu8euZV9Div6gsQEAFw.png" /></figure><h4>Conclusion</h4><p>This implementation showcases a complete CI/CD pipeline using <strong>AWS CodePipeline</strong>, <strong>CodeBuild</strong>, and <strong>CodeDeploy</strong>, including <strong>manual approval</strong> and automated deployment of a <strong>static web application</strong> to an EC2 instance. It provides a solid foundation for extending to more complex, production-ready deployment workflows.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15122053a321" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering AWS Lambda: Layers, Deployments, Performance & Costs]]></title>
            <link>https://medium.com/@tams67680/mastering-aws-lambda-layers-deployments-performance-costs-810338c8a599?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/810338c8a599</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Wed, 13 Aug 2025 09:44:23 GMT</pubDate>
            <atom:updated>2025-08-13T09:44:23.520Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we’re going beyond the textbook definitions and diving straight into <strong>hands-on AWS Lambda implementations</strong>. Rather than spending too much time on theory, we’ll focus on practical, real-world scenarios that can give you an edge over others who’ve only read about these concepts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*ywduXFizeKvcU4WA" /></figure><p>Here’s what we’ll implement step-by-step:</p><ul><li><strong>Lambda Layers</strong> — modularizing and reusing code</li><li><strong>Aliases and Versions</strong> — managing function deployments effectively</li><li><strong>Canary Deployments</strong> — releasing new code safely with minimal risk</li><li><strong>Cold vs Warm Starts</strong> — understanding performance differences</li><li><strong>Billing Calculations</strong> — estimating costs accurately</li></ul><p><strong>What you’ll need to follow along:</strong></p><ul><li>An <strong>AWS Account</strong></li><li><strong>Python scripts</strong> (I’ll be providing these so you can replicate the steps exactly)</li></ul><p>By the end of this article, you’ll not only understand these Lambda concepts but also have the confidence to implement them in your own projects.</p><h4>Initial Setup</h4><p>Here is repository <a href="https://github.com/sarathtam242/aws-handson-sarath.git">Link</a></p><p>You will get the instructions for creating v1 and v2 of Layer compressed file from instructions folder and Lambda functions for testing from the Lambda Folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDr1AvOmWbdQ1FD3Wa2cAA.png" /></figure><p>Once you cloned the repository, you can upgrade the functions to a better version if required, i considered few simple functions for the demonstration purpose.</p><p>Login to your AWS Account and create IAM Role for Lambda Execution. Make sure the IAM Role have Cloudwatch Full access for Logging purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*D6_tX6Fx_XbXCG2zy9w-tQ.png" /><figcaption>Permissions View</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*1622AtHb3sB9c5dgNn3foA.png" /><figcaption>Trust Relationship View</figcaption></figure><p>Now open the Cloud shell and follow the below instructions for Version1 Layer creation.</p><pre># Step 1: In AWS Console, open CloudShell.<br><br># Step 2: Create a folder for layer v1<br>mkdir layer_v1 &amp;&amp; cd layer_v1<br>mkdir python<br><br># Step 3: Install dependencies into python/ folder<br>pip install requests -t python/<br>NOTE: Error like this may come in Cloudshell but that is fine.<br>ERROR: pip&#39;s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.<br>botocore 1.38.37 requires urllib3&lt;1.27,&gt;=1.25.4; python_version &lt; &quot;3.10&quot;, but you have urllib3 2.5.0 which is incompatible.<br><br># Step 4: Add your layer helper file<br>echo &quot;def get_layer_message():<br>    return &#39;This is from Layer v1&#39;&quot; &gt; python/layer_helper.py<br><br># Step 5: Zip the folder<br>zip -r layer_v1.zip python<br><br>Download the zip file into your local environment, we will use that while creating Layer<br></pre><p>Search for Lambda Service and click on Layers followed by Create Layer</p><p>Follow the below screenshot and upload the zip which we created in previous step using Cloudshell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ENx8D3XjWMXsUwXy6TG8Q.png" /><figcaption>Layer Creation</figcaption></figure><p>By default the created version will be considered as Version 1. Once version is created we can’t modify the version. you will see the screen like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LyZQmxAIsU9bmSKytxvsLQ.png" /></figure><p>Now we will create a Lambda Function and use this Lambda Layer.</p><p>A <strong>Lambda Layer</strong> is a way to package and share common code, dependencies, or libraries across multiple Lambda functions, avoiding duplication. It helps keep your function packages smaller, cleaner, and easier to maintain.</p><p>You can follow the below screenshot and create a function. Make sure the role which we created initially need to be used as part of this setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6xtIAkbzkAwu4Z6ODPMm0g.png" /></figure><p>Once the function is created, we will attach the Layer version1 which we created previously.</p><p>Now move to Lambda/version1 folder and copy the script and deploy in the function we created in the previous step.</p><pre>import requests<br>from layer_helper import get_layer_message<br><br>def lambda_handler(event, context):<br>    username = &quot;octocat&quot;  # Public GitHub test account<br>    repo_url = &quot;https://github.com/octocat/Hello-World&quot;  # Public repo<br><br>    r = requests.get(f&quot;https://api.github.com/repos/octocat/Hello-World&quot;)<br>    repo_info = r.json()<br><br>    return {<br>        &quot;statusCode&quot;: 200,<br>        &quot;lambda_version&quot;: &quot;Version 1&quot;,<br>        &quot;layer_message&quot;: get_layer_message(),<br>        &quot;repo_name&quot;: repo_info.get(&quot;name&quot;),<br>        &quot;stars&quot;: repo_info.get(&quot;stargazers_count&quot;),<br>        &quot;url&quot;: repo_url<br>    }</pre><p>Make sure you deployed the above code in the function.</p><p>Now scroll down and add your layer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbU7rtmg0Kg4udvXtCQJSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4h9njp0QrTH38sNBymO0g.png" /></figure><p>Once it is added to your function it will be listed as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h7vG7VZA7v_K9lX8UsoS4A.png" /></figure><pre>from layer_helper import get_layer_message</pre><p>Basically in this part of the code we are calling the Layer in our function. As of now it just display as message like “This is from Layer 1”. But in real world you will place all the dependencies and add it as layer so that function can use when it requires.</p><p>Now move to Test tab and click on test the script. You will get output like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*9LDc-obi8TpPygX0NSWZzQ.png" /></figure><p>Now follow the <a href="https://github.com/sarathtam242/aws-handson-sarath/blob/main/lambda-layer-demo/instructions/v2layer_creation.txt">v2layer_creation.txt</a> and generate the second layer. Once it is generated, you can add the new version as 2 to the layer we created previously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-2NZ1CLLbTD6DGoxd58Rw.png" /></figure><p>so now we have two versions as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DHS-rsWlb8zTt4i67O6FsA.png" /></figure><p>Now go to the function we created previously and change the layer version from 1 to 2 and also upload the below code in Lambda function.</p><pre>import requests<br>from layer_helper import get_layer_message<br><br>def lambda_handler(event, context):<br>    username = &quot;octocat&quot;<br>    repo_url = &quot;https://github.com/octocat/Spoon-Knife&quot;<br><br>    r = requests.get(f&quot;https://api.github.com/repos/octocat/Spoon-Knife&quot;)<br>    repo_info = r.json()<br><br>    return {<br>        &quot;statusCode&quot;: 200,<br>        &quot;lambda_version&quot;: &quot;Version 2&quot;,<br>        &quot;layer_message&quot;: get_layer_message(),<br>        &quot;repo_name&quot;: repo_info.get(&quot;name&quot;),<br>        &quot;forks&quot;: repo_info.get(&quot;forks_count&quot;),<br>        &quot;url&quot;: repo_url<br>    }</pre><p>Once it is deployed, you can do the test and below message will be visible which clearly shows this is from version 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5JX5GZGxcurvq69H76TYog.png" /></figure><p>You can see the invocations and LogStream information from Monitor Tab as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqUolp-prcq4QN_hO2NxSA.png" /></figure><p>Now lets use same version of the Layer but update the function to a better version.</p><pre>import os<br>import requests<br>from layer_helper import get_layer_message<br><br>def lambda_handler(event, context):<br>    username = &quot;octocat&quot;<br>    repo_name = os.getenv(&quot;GITHUB_REPO&quot;, &quot;Hello-World&quot;)<br>    repo_url = f&quot;https://github.com/{username}/{repo_name}&quot;<br><br>    try:<br>        r = requests.get(f&quot;https://api.github.com/repos/{username}/{repo_name}&quot;, timeout=5)<br>        r.raise_for_status()<br>        repo_info = r.json()<br><br>        return {<br>            &quot;statusCode&quot;: 200,<br>            &quot;lambda_version&quot;: &quot;Version 3&quot;,<br>            &quot;layer_message&quot;: get_layer_message(),<br>            &quot;repo_name&quot;: repo_info.get(&quot;name&quot;),<br>            &quot;watchers&quot;: repo_info.get(&quot;watchers_count&quot;),<br>            &quot;url&quot;: repo_url<br>        }<br>    except requests.exceptions.RequestException as e:<br>        return {<br>            &quot;statusCode&quot;: 500,<br>            &quot;error&quot;: str(e)<br>        }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xCFnuyU9bd1jRqQDh6mgjw.png" /></figure><p>The purpose of a <strong>Lambda Layer</strong> is to centralize and reuse shared code or dependencies across multiple AWS Lambda functions, reducing package size and simplifying updates. I hope we are clear with Lambda Functions and Layers.</p><h4>Aliases and Versions</h4><p><strong>Versions</strong> in Lambda are immutable snapshots of your function’s code and configuration at a specific point in time.<br> <strong>Aliases</strong> are named pointers to specific versions, allowing safe routing, gradual deployments, and easy rollbacks.</p><p>Update the Lambda function with below code and select Layer v1.</p><pre>import requests<br>from layer_helper import get_layer_message<br><br>def lambda_handler(event, context):<br>    username = &quot;octocat&quot;  # Public GitHub test account<br>    repo_url = &quot;https://github.com/octocat/Hello-World&quot;  # Public repo<br><br>    r = requests.get(f&quot;https://api.github.com/repos/octocat/Hello-World&quot;)<br>    repo_info = r.json()<br><br>    return {<br>        &quot;statusCode&quot;: 200,<br>        &quot;lambda_version&quot;: &quot;Version 1&quot;,<br>        &quot;layer_message&quot;: get_layer_message(),<br>        &quot;repo_name&quot;: repo_info.get(&quot;name&quot;),<br>        &quot;stars&quot;: repo_info.get(&quot;stargazers_count&quot;),<br>        &quot;url&quot;: repo_url<br>    }</pre><p>Make sure the Layer is 1 to differentiate the version message in Lambda output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rWG2arLofHwRA-kMlFfX1g.png" /></figure><p>Test it , you will see v1 in message as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xb6PxDZUGvpL3OvjlSlFaw.png" /></figure><p>Make sure you set the time limit to 3minutes to avoid any timeout issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gqKZCemhpDy6aK8UDoyDrg.png" /></figure><p>Now create a version 1 for this Function.</p><p>Come to Version tab and publish the version. So now we have one immutable version. In the same way we will change the layer to version2 and publish second version.</p><p>So now have two versions as shown below. one is serving V1 Layer and other is serving V2 Layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lvT5P71BB0C8wIjJLf5gRQ.png" /></figure><p>Lets create Alias now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hlJP4uKLhWc5v2MS0LsygA.png" /></figure><p>We will be considering both the versions with 50% weight. so technically we can use the link to redirect traffic 50–50 for both the versions.</p><p>Once it is created, it will displayed as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Lvy3iUOoOBM4i7LlgcbnA.png" /></figure><p>Once the Alias is created, we can test the code multiple times, if we click the test button 2–3 times, you can see the body is changing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*appOexNlzlKpLMoBLWJiRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rdxM-bMQWrrQt4C3wjVZzA.png" /></figure><p>So basically our alias is pointing to two versions which are holding 50% Traffic in each.</p><h4>Cold Vs Warm Start</h4><p><strong>Cold Start</strong><br> In AWS Lambda, a <em>cold start</em> happens when your function is invoked for the first time after being deployed, or after it has been idle for a certain period. During a cold start, AWS needs to allocate a new execution environment, download your function code, initialize the runtime (Node.js, Python, Java, etc.), and run any global-level initialization code before actually executing the handler function. This process can take a few milliseconds for lightweight runtimes like Node.js or Python, but it can stretch to several seconds for heavier runtimes like Java or .NET. Cold starts are more noticeable in synchronous, user-facing applications (like APIs) where latency matters.</p><p><strong>Warm Start</strong><br> A <em>warm start</em> occurs when a Lambda function is invoked again while a previously created execution environment is still available. In this case, AWS skips the environment creation and runtime initialization steps, directly reusing the already initialized container. Only your handler function runs, significantly reducing execution time. AWS keeps execution environments warm for a short period (typically a few minutes) after the last invocation, but the duration isn’t guaranteed. Warm starts result in faster response times and are generally preferred for performance-sensitive workloads.</p><p>Please consider this code <a href="https://github.com/sarathtam242/aws-handson-sarath/blob/main/lambda-layer-demo/lambda/lambda_coldstart.py">lambda_coldstart.py</a> for the implementation purpose.</p><p>Create a new function and generate a function url for the same.</p><p>Now get the url and do curl, you will see slight delay of 20 seconds which is part of the init. During this execution lambda will be creating a fresh container to perform the init operation and main execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bRbIVJw7BXz2VZPYgyQLTA.png" /></figure><p>You can see init_duration 20seconds and execution_duration 1second.</p><p>But if we invoke the lambda second time with in short time, aws will use the already existing container which means it performed a warm start.</p><p>You can see the screenshot below where init is showing zero. Basically if we have init duration more than 0 in the log we can conclude lambda did cold start but if it is zero then we can consider it as warm start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kXrCCoYIUM8s57wnxfT93w.png" /></figure><h4><strong>Billing Calculations</strong></h4><p>For a <strong>cold start</strong> with 128 MB memory, the total billed duration is <em>init time + execution time</em>.<br> So, 20.02s + 1.001s = 21.021s. At AWS’s 128 MB pricing (~$0.0000000021 per ms), that’s about <strong>$0.000044</strong>.</p><p>For a <strong>warm start</strong>, only execution time is billed: 1.001s, which costs about <strong>$0.0000021</strong>.</p><p>This shows cold starts can cost <strong>~20× more</strong> for the same function logic, especially for short executions.<br> Keeping Lambdas warm (via provisioned concurrency or regular triggers) can reduce latency <em>and</em> costs.</p><p><strong>Conclusion</strong><br> In this deep dive, we explored how AWS Lambda’s advanced features — from modular code with Layers, controlled rollouts with Aliases, safe Canary deployments, performance optimization through Cold vs Warm start awareness, to accurate cost estimation — can help you design serverless applications that are reliable, efficient, and cost-effective. By mastering these concepts, you’ll be able to build scalable functions with confidence, while keeping both performance and budget under control.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=810338c8a599" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From SCP to Guardrails: Building a Region-Safe AWS Environment]]></title>
            <link>https://medium.com/@tams67680/from-scp-to-guardrails-building-a-region-safe-aws-environment-81388e923ffa?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/81388e923ffa</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Fri, 08 Aug 2025 18:55:49 GMT</pubDate>
            <atom:updated>2025-08-08T18:55:49.636Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/819/0*nQ3CHxa7Dz8mlmf4.png" /><figcaption>Source:AWS Documentation</figcaption></figure><h3>Introduction</h3><h4>Have you ever encountered any of the following challenges while managing cloud operations?</h4><ul><li>Need to <strong>restrict specific AWS regions</strong> to comply with organizational or regulatory requirements?</li><li>Want to ensure <strong>all resources remain compliant</strong> with your internal policies and standards?</li><li>Looking to <strong>centralize billing</strong> across multiple AWS accounts under a single root account?</li><li>Need to <strong>set up a secure, standardized landing zone</strong> with mandatory compliance controls from day one?</li></ul><p>If so, this article will give you a clear overview of how to achieve these goals using <strong>AWS Organizations</strong>, <strong>Service Control Policies (SCPs)</strong>, <strong>AWS Control Tower</strong>, and <strong>Guardrails</strong>. We’ll walk through how these tools work together to help you build a <strong>region-safe and compliant AWS environment</strong> at scale.</p><h3>SCPs and AWS Organizations: The Foundation</h3><p><strong>AWS Organizations</strong> enables you to centrally manage and govern multiple AWS accounts under a single <strong>management account</strong>. You can create new accounts or invite existing ones to join your organization. Each new account requires a unique email address and inherits billing from the management account.</p><p>To organize workloads, accounts can be grouped into <strong>Organizational Units (OUs)</strong> — for example, Development, Staging, and Production. You can then apply <strong>Service Control Policies (SCPs)</strong> to those OUs or directly to individual accounts.</p><p><strong>Service Control Policies (SCPs)</strong> act as permission guardrails. They set the <strong>maximum available permissions</strong> for all IAM users, groups, and roles in an account. SCPs don’t grant permissions directly — they define what is <em>allowed</em> or <em>denied</em> regardless of the permissions assigned at the IAM level.</p><p><strong>Common Use Cases for SCPs with Examples</strong></p><h4>1. Restrict resource operations in specific regions</h4><p><strong>Use Case:</strong> Deny all operations in eu-west-1 (Ireland)</p><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Deny&quot;,<br>      &quot;Action&quot;: &quot;*&quot;,<br>      &quot;Resource&quot;: &quot;*&quot;,<br>      &quot;Condition&quot;: {<br>        &quot;StringEquals&quot;: {<br>          &quot;aws:RequestedRegion&quot;: &quot;eu-west-1&quot;<br>        }<br>      }<br>    }<br>  ]<br>}</pre><h4>2. Allow only approved EC2 instance types (e.g., t2.large)</h4><p><strong>Use Case:</strong> Deny launching of any EC2 instance types other than t2.large</p><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Deny&quot;,<br>      &quot;Action&quot;: &quot;ec2:RunInstances&quot;,<br>      &quot;Resource&quot;: &quot;*&quot;,<br>      &quot;Condition&quot;: {<br>        &quot;StringNotEqualsIfExists&quot;: {<br>          &quot;ec2:InstanceType&quot;: &quot;t2.large&quot;<br>        }<br>      }<br>    }<br>  ]<br>}</pre><h4>3. Restrict creation of unapproved resources</h4><p><strong>Use Case:</strong> Deny creating S3 buckets unless they match approved naming convention (project-xyz-*)</p><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Deny&quot;,<br>      &quot;Action&quot;: &quot;s3:CreateBucket&quot;,<br>      &quot;Resource&quot;: &quot;*&quot;,<br>      &quot;Condition&quot;: {<br>        &quot;StringNotLikeIfExists&quot;: {<br>          &quot;s3:BucketName&quot;: &quot;project-xyz-*&quot;<br>        }<br>      }<br>    }<br>  ]<br>}</pre><h4>4. Allow specific IAM roles to perform sensitive operations</h4><p><strong>Use Case:</strong> Deny iam:DeleteUser for everyone except a specific IAM role</p><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Sid&quot;: &quot;DenyDeleteUserExceptSecurityAdmin&quot;,<br>      &quot;Effect&quot;: &quot;Deny&quot;,<br>      &quot;Action&quot;: &quot;iam:DeleteUser&quot;,<br>      &quot;Resource&quot;: &quot;*&quot;,<br>      &quot;Condition&quot;: {<br>        &quot;StringNotEquals&quot;: {<br>          &quot;aws:PrincipalArn&quot;: &quot;arn:aws:iam::*:role/SecurityAdminRole&quot;<br>        }<br>      }<br>    }<br>  ]<br>}</pre><p><strong>Few key pointers on SCPs</strong></p><ul><li>Even if an SCP allows an action, the IAM policy must explicitly permit it. SCPs only define the <em>maximum possible</em> permissions.</li><li>Policies attached to OUs or accounts won’t apply to the identities in the management account (e.g., root user or IAM roles in the management account).</li><li>If an action is denied in an SCP, it cannot be allowed by any IAM or resource-based policy.</li><li>Policies are inherited downward — applying an SCP at a parent OU affects all nested OUs and accounts.</li><li>SCPs don’t block certain AWS-managed services (like AWS Config, CloudTrail, or GuardDuty) from delivering logs or data to a central monitoring account.</li><li>SCPs explain what actions maxmium can be done at account level and IAM explains who can do what.</li></ul><h4><strong>The Limits of Manual SCP Management</strong></h4><p>Creating complex SCPs can be time-consuming and requires thorough testing before attaching them to accounts. A misconfigured SCP can accidentally lock out IAM identities — and in some cases, even restrict the root user in member accounts.</p><p>As the number of accounts grows, <strong>scalability becomes a challenge</strong>. Maintaining consistent policies across multiple Organizational Units (OUs) becomes difficult without automation and policy orchestration tools.</p><p>Additionally, SCPs do not offer <strong>centralized visibility</strong> or <strong>contextual insights</strong>. There’s no built-in way to identify <strong>who</strong> violated a policy or <strong>when</strong> it happened — unless you integrate with services like <strong>AWS CloudTrail</strong> or <strong>AWS Config</strong>.</p><p>It’s also important to note that SCPs can only allow or deny AWS actions. They <strong>cannot enforce best practices</strong> such as mandatory <strong>tagging</strong>, <strong>encryption</strong>, or <strong>backups</strong> — these require additional tooling and configuration management.</p><h3>Control Tower and Guardrails: Governance at Scale</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9sXQeAHaQNPB2ora.png" /><figcaption>AWS Landing Zone by Control Tower Source: AWS Documentation</figcaption></figure><p>In an enterprise multi-account AWS environment, it’s common to set up a <strong>Landing Zone</strong> that separates workloads into dedicated <strong>Organizational Units (OUs)</strong> for <strong>Security</strong>, <strong>Logging</strong>, <strong>Auditing</strong>, and more. AWS <strong>Control Tower</strong> helps automate the creation of this structure and ensures consistent governance using <strong>Guardrails</strong>.</p><p>With <strong>Account Factory</strong>, Control Tower simplifies account provisioning based on predefined <strong>blueprints</strong>. These blueprints ensure each account adheres to organizational requirements from the start. A central <strong>dashboard</strong> provides visibility into organization-wide compliance across all enrolled accounts.</p><h4>What Are Guardrails?</h4><p>Guardrails are a combination of:</p><ul><li><strong>Preventive Controls:</strong> Enforced through <strong>SCPs</strong> (Service Control Policies) to stop non-compliant actions.</li><li><strong>Detective Controls:</strong> Implemented using <strong>AWS Config Rules</strong> to monitor and detect deviations from policies.</li></ul><p><strong>Each guardrail is categorized as either</strong>:</p><ul><li><strong>Mandatory:</strong> Always enforced; cannot be disabled.</li><li><strong>Strongly Recommended or Elective:</strong> Optional controls that can be enabled or disabled based on organizational needs.</li></ul><p>Guardrails are automatically applied to all accounts and OUs managed by Control Tower. If you need to bypass a mandatory guardrail for a specific account, that account must be <strong>removed from Control Tower management</strong>.</p><h4>Differences from Manually Managed SCPs</h4><p>SCPs created manually (outside Control Tower) offer <strong>greater flexibility</strong>, but they require careful planning, testing, and ongoing management. In contrast:</p><ul><li><strong>Control Tower-managed SCPs</strong> are applied automatically during landing zone setup.</li><li>They offer <strong>better scalability</strong>, <strong>standardization</strong>, and <strong>wide preventive coverage</strong>, but with <strong>less customization</strong> than manual SCPs.</li></ul><h4>Region Governance with Guardrails</h4><p>Control Tower also supports <strong>region-level governance</strong>. You can restrict which AWS regions are enabled for workloads, control where logs and data are aggregated, and ensure that reporting and compliance checks remain within approved geographic boundaries.</p><h3>Designing a Region-Safe Environment</h3><p>Use <strong>Organizational Units (OUs)</strong> to group accounts by purpose (e.g., Dev, Prod).<br> Apply <strong>SCPs</strong> to block unapproved regions completely — this gives hard enforcement.<br> Enable <strong>Guardrails</strong> in Control Tower to monitor region usage and catch violations.<br> Guardrails add visibility through compliance dashboards and alerts.<br> Keep SCPs <strong>simple and clear</strong> to avoid misconfigurations.<br> Review policies regularly and document your region governance strategy.<br> Combining SCPs and Guardrails gives you strong, scalable region control.</p><h4><strong>Conclusion</strong></h4><p>You’re correct that <strong>SCPs can enforce region restrictions directly</strong>, but <strong>Guardrails offer an additional monitoring layer</strong> that gives <strong>visibility and control</strong> — especially useful for <strong>audit and governance</strong> teams.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81388e923ffa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform vs. Bicep: Which IaC Tool Should You Choose for Azure and Beyond?]]></title>
            <link>https://medium.com/@tams67680/terraform-vs-bicep-which-iac-tool-should-you-choose-for-azure-and-beyond-bd61311c4fbf?source=rss-5809a46fb841------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd61311c4fbf</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[bicep]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Sarath Tamminana]]></dc:creator>
            <pubDate>Mon, 26 May 2025 11:50:34 GMT</pubDate>
            <atom:updated>2025-05-26T11:50:34.752Z</atom:updated>
            <content:encoded><![CDATA[<p>As a DevOps engineer, I regularly automate cloud infrastructure using <strong>Terraform</strong> — primarily for AWS and Azure environments. It’s a go-to tool in my day-to-day workflow thanks to its flexibility and multi-cloud support.</p><p>However, I recently had the opportunity to explore a different IaC approach during a 2-day <strong>hackathon</strong>, where the multiple challenge required us to deploy complex Azure infrastructure using <strong>Bicep</strong> and <strong>GitHub Actions</strong>. It was a great hands-on experience that gave me a fresh perspective on how Bicep compares to Terraform, especially in Azure-specific use cases.</p><p>In this post, I’ll share what I learned by comparing both tools from the lens of someone who uses Terraform regularly but had to adapt to Bicep for a real-world scenario.</p><h3><strong>Introduction</strong></h3><p>Managing infrastructure manually is inefficient and error-prone. That’s why modern DevOps teams embrace <strong>Infrastructure as Code (IaC)</strong> to automate and standardize cloud deployments.</p><p>Two prominent IaC tools are <strong>Terraform</strong> and <strong>Bicep</strong>. While both are designed to provision cloud infrastructure, they cater to different audiences and cloud strategies.</p><p>Let’s compare them side-by-side to help you choose the right tool for your team.</p><h3>Terraform: The Cloud-Agnostic Veteran</h3><p>Terraform is an open-source IaC tool created by HashiCorp. It uses a declarative configuration language called HCL (HashiCorp Configuration Language) and supports provisioning across multiple cloud providers, including Azure, AWS, Google Cloud, and others.</p><h3>Example: Azure Storage Account with Terraform</h3><pre>provider &quot;azurerm&quot; {<br>  features = {}<br>}<br><br>resource &quot;azurerm_resource_group&quot; &quot;hk&quot; {<br>  name     = &quot;hackathon-resource-group&quot;<br>  location = &quot;eastus&quot;<br>}<br><br>resource &quot;azurerm_storage_account&quot; &quot;storage&quot; {<br>  name                     = &quot;hackathonstorageacct&quot;<br>  resource_group_name      = azurerm_resource_group.hk.name<br>  location                 = azurerm_resource_group.hk.location<br>  account_tier             = &quot;Standard&quot;<br>  account_replication_type = &quot;LRS&quot;<br>}</pre><p>NOTE:HCL not supported so used plain text for code block</p><h3>Bicep: Azure’s Native Infrastructure as Code Tool</h3><p>Bicep is Microsoft’s domain-specific language (DSL) for deploying Azure resources. It simplifies the authoring experience compared to traditional ARM (Azure Resource Manager) templates, while still offering full functionality and integration with Azure.</p><h3>Example: Azure Storage Account with Bicep</h3><pre>resource rg &#39;Microsoft.Resources/resourceGroups@2021-04-01&#39; = {<br>  name: &#39;hackathon-resource-group&#39;<br>  location: &#39;eastus&#39;<br>}<br><br>resource storage &#39;Microsoft.Storage/storageAccounts@2022-09-01&#39; = {<br>  name: &#39;hackathonstorageacct&#39;<br>  location: rg.location<br>  sku: {<br>    name: &#39;Standard_LRS&#39;<br>  }<br>  kind: &#39;StorageV2&#39;<br>  properties: {}<br>}</pre><p>NOTE:Bicep not supported so used plain text for code block</p><p><strong>Feature Comparison: Terraform vs. Bicep</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FV49cA7CVsnKZAIJgOR9uQ.png" /></figure><h3>When to Use Each Tool</h3><h3>Use Terraform if:</h3><ul><li>You work across multiple cloud platforms.</li><li>You need robust state management and advanced modular infrastructure.</li><li>You prefer a widely adopted, mature IaC tool with strong community support.</li></ul><h3>Use Bicep if:</h3><ul><li>Your infrastructure is entirely on Azure.</li><li>You want a simplified, Azure-native syntax.</li><li>You’re migrating from ARM templates and want an easier authoring experience.</li></ul><h3>Final Thoughts</h3><p>Terraform and Bicep both solve the same core problem — managing infrastructure as code — but they’re optimized for different environments.</p><ul><li>Choose <strong>Terraform</strong> for flexibility, multi-cloud support, and enterprise-grade scalability.</li><li>Choose <strong>Bicep</strong> for Azure-native simplicity, clean syntax, and direct integration with Azure tooling.</li></ul><p>Whichever tool you select, adopting Infrastructure as Code is a significant step forward in automating, securing, and scaling your cloud infrastructure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd61311c4fbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>