<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Martin D</title>
    <description>The latest articles on DEV Community by Martin D (@martin_d_5a09a3d2755932b1).</description>
    <link>https://dev.to/martin_d_5a09a3d2755932b1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3702405%2F8c9f02db-291f-4b96-9ca7-35ee2406fa02.png</url>
      <title>DEV Community: Martin D</title>
      <link>https://dev.to/martin_d_5a09a3d2755932b1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/martin_d_5a09a3d2755932b1"/>
    <language>en</language>
    <item>
      <title>Hidden Resources to Consider When Removing an AWS Lambda Function</title>
      <dc:creator>Martin D</dc:creator>
      <pubDate>Thu, 03 Sep 2026 17:52:30 +0000</pubDate>
      <link>https://dev.to/martin_d_5a09a3d2755932b1/hidden-resources-to-consider-when-removing-an-aws-lambda-function-180e</link>
      <guid>https://dev.to/martin_d_5a09a3d2755932b1/hidden-resources-to-consider-when-removing-an-aws-lambda-function-180e</guid>
      <description>&lt;p&gt;Deleting an AWS Lambda function may look like a simple task, but the function itself can be connected to several AWS resources that remain in your account after the function is removed.&lt;/p&gt;

&lt;p&gt;These leftover resources can create unnecessary costs, security concerns, operational confusion, and maintenance overhead.&lt;/p&gt;

&lt;p&gt;As an AWS Cloud Developer or AWS Account Administrator, it is important to understand which resources should be reviewed before and after deleting a Lambda function.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. IAM Roles and Policies
&lt;/h2&gt;

&lt;p&gt;Many Lambda functions use a dedicated IAM role created specifically for their execution.&lt;/p&gt;

&lt;p&gt;Deleting the Lambda function does &lt;strong&gt;not automatically delete its IAM role or associated policies&lt;/strong&gt;. Over time, these unused roles can remain in the AWS account without anyone realizing they are no longer required.&lt;/p&gt;

&lt;p&gt;Before removing the function, review:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lambda execution IAM roles&lt;/li&gt;
&lt;li&gt;Custom IAM policies attached to the role&lt;/li&gt;
&lt;li&gt;Inline IAM policies&lt;/li&gt;
&lt;li&gt;Permissions created specifically for the Lambda function&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unused IAM roles and policies should be reviewed carefully before deletion to avoid unnecessary security exposure and account clutter.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Amazon CloudWatch Log Groups
&lt;/h2&gt;

&lt;p&gt;AWS Lambda automatically creates a CloudWatch Log Group using the following naming convention:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/aws/lambda/&amp;lt;function-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deleting the Lambda function does not necessarily remove its CloudWatch Log Group.&lt;/p&gt;

&lt;p&gt;As a result, logs may remain stored in Amazon CloudWatch for a long time and continue consuming storage.&lt;/p&gt;

&lt;p&gt;Before completing the cleanup, check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudWatch Log Groups&lt;/li&gt;
&lt;li&gt;Log retention settings&lt;/li&gt;
&lt;li&gt;Old log streams&lt;/li&gt;
&lt;li&gt;Log storage costs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the logs are no longer required for auditing, troubleshooting, or compliance purposes, consider deleting the log group or configuring an appropriate retention policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Elastic Network Interfaces (ENIs)
&lt;/h2&gt;

&lt;p&gt;If your Lambda function is configured to access resources inside an Amazon VPC, AWS manages network interfaces associated with Lambda connectivity.&lt;/p&gt;

&lt;p&gt;These resources may not disappear immediately after the Lambda function is deleted.&lt;/p&gt;

&lt;p&gt;Depending on the configuration and AWS resource lifecycle, cleanup can take some time.&lt;/p&gt;

&lt;p&gt;When removing a VPC-enabled Lambda function, review:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VPC configuration&lt;/li&gt;
&lt;li&gt;Subnets&lt;/li&gt;
&lt;li&gt;Security groups&lt;/li&gt;
&lt;li&gt;Elastic Network Interfaces associated with Lambda&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not immediately assume that an ENI is orphaned and delete it manually. Always verify whether it is still being used by another AWS-managed service or Lambda function.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Resource-Based Policies and Permissions
&lt;/h2&gt;

&lt;p&gt;Lambda functions can have resource-based permissions that allow other AWS services or accounts to invoke them.&lt;/p&gt;

&lt;p&gt;Examples include permissions for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon API Gateway&lt;/li&gt;
&lt;li&gt;Amazon EventBridge&lt;/li&gt;
&lt;li&gt;Amazon S3&lt;/li&gt;
&lt;li&gt;Amazon SNS&lt;/li&gt;
&lt;li&gt;Other AWS accounts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before deleting a Lambda function, review the integrations and permissions associated with it.&lt;/p&gt;

&lt;p&gt;Other AWS services may still contain references to the deleted Lambda ARN, which can result in failed events, broken integrations, or unnecessary troubleshooting later.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Event Sources and Triggers
&lt;/h2&gt;

&lt;p&gt;One of the most important areas to review is the Lambda function's triggers.&lt;/p&gt;

&lt;p&gt;A Lambda function may be invoked by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon API Gateway&lt;/li&gt;
&lt;li&gt;Amazon EventBridge&lt;/li&gt;
&lt;li&gt;Amazon S3&lt;/li&gt;
&lt;li&gt;Amazon SNS&lt;/li&gt;
&lt;li&gt;Amazon SQS&lt;/li&gt;
&lt;li&gt;Amazon DynamoDB Streams&lt;/li&gt;
&lt;li&gt;Amazon Kinesis&lt;/li&gt;
&lt;li&gt;AWS Step Functions&lt;/li&gt;
&lt;li&gt;Amazon CloudWatch scheduled rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before deletion, identify whether these services are still configured to invoke the Lambda function.&lt;/p&gt;

&lt;p&gt;Removing the function without cleaning up the integration can leave behind failed invocations or unused configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Lambda@Edge Replicas
&lt;/h2&gt;

&lt;p&gt;If the Lambda function is associated with Amazon CloudFront as a Lambda@Edge function, additional considerations are required.&lt;/p&gt;

&lt;p&gt;Lambda@Edge functions are replicated to AWS Regions as part of the CloudFront deployment process.&lt;/p&gt;

&lt;p&gt;Before removing such a function, ensure that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The function is no longer associated with any CloudFront distribution&lt;/li&gt;
&lt;li&gt;CloudFront changes have been fully deployed&lt;/li&gt;
&lt;li&gt;Lambda@Edge replicas have completed their lifecycle&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These resources may require additional time to be fully removed.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Infrastructure as Code Resources
&lt;/h2&gt;

&lt;p&gt;If the Lambda function was created using infrastructure-as-code tools such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS CloudFormation&lt;/li&gt;
&lt;li&gt;AWS CDK&lt;/li&gt;
&lt;li&gt;Terraform&lt;/li&gt;
&lt;li&gt;Serverless Framework&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Avoid manually deleting the Lambda function without first checking how it is managed.&lt;/p&gt;

&lt;p&gt;Manual deletion can cause configuration drift between your AWS account and the infrastructure code.&lt;/p&gt;

&lt;p&gt;Instead, where possible, remove the resource through the same infrastructure-as-code process that created it.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Monitoring, Alarms, and Dashboards
&lt;/h2&gt;

&lt;p&gt;Lambda functions may have associated monitoring resources such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon CloudWatch Alarms&lt;/li&gt;
&lt;li&gt;CloudWatch Dashboards&lt;/li&gt;
&lt;li&gt;AWS X-Ray tracing configuration&lt;/li&gt;
&lt;li&gt;SNS notifications for alarms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After deleting the Lambda function, these monitoring resources may remain in the account.&lt;/p&gt;

&lt;p&gt;Review and remove any alarms or dashboards that are no longer useful.&lt;/p&gt;




&lt;h1&gt;
  
  
  AWS Account Permissions Matter
&lt;/h1&gt;

&lt;p&gt;Finally, it is important to understand that an &lt;strong&gt;AWS Cloud Developer or Cloud DevOps Engineer may not always have sufficient permissions to perform all cleanup activities&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, a developer may be able to delete a Lambda function but may not have permission to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete IAM roles&lt;/li&gt;
&lt;li&gt;Remove IAM policies&lt;/li&gt;
&lt;li&gt;Delete VPC network interfaces&lt;/li&gt;
&lt;li&gt;Modify CloudFront distributions&lt;/li&gt;
&lt;li&gt;Delete CloudWatch Log Groups&lt;/li&gt;
&lt;li&gt;Review account-wide resource dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These activities may require additional IAM permissions or involvement from an &lt;strong&gt;AWS Account Administrator or Cloud Account Management team&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Therefore, managing AWS resources effectively is not only about having development or DevOps knowledge. It also requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Proper IAM access&lt;/li&gt;
&lt;li&gt;Clear ownership of resources&lt;/li&gt;
&lt;li&gt;Understanding of account-level dependencies&lt;/li&gt;
&lt;li&gt;Defined cleanup procedures&lt;/li&gt;
&lt;li&gt;Coordination between development, DevOps, security, and cloud administration teams&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Why Documentation Is Important
&lt;/h1&gt;

&lt;p&gt;Maintaining proper documentation for AWS resources is essential for effective account maintenance.&lt;/p&gt;

&lt;p&gt;For every important application or Lambda function, documentation should ideally include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lambda function name and purpose&lt;/li&gt;
&lt;li&gt;IAM role used&lt;/li&gt;
&lt;li&gt;VPC and security group configuration&lt;/li&gt;
&lt;li&gt;Event sources and triggers&lt;/li&gt;
&lt;li&gt;CloudWatch Log Group details&lt;/li&gt;
&lt;li&gt;Monitoring and alarms&lt;/li&gt;
&lt;li&gt;Infrastructure-as-code repository or stack&lt;/li&gt;
&lt;li&gt;Resource owner&lt;/li&gt;
&lt;li&gt;Dependencies on other AWS services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This documentation makes future maintenance and cleanup activities much easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Deleting an AWS Lambda function should not be treated as simply clicking the &lt;strong&gt;Delete&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;A Lambda function can be connected to IAM roles, CloudWatch logs, VPC networking, event sources, monitoring resources, CloudFront distributions, and infrastructure-as-code deployments.&lt;/p&gt;

&lt;p&gt;A proper cleanup process should therefore include a &lt;strong&gt;dependency review before deletion&lt;/strong&gt; and a &lt;strong&gt;resource verification after deletion&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Maintaining an AWS resource inventory and clear documentation helps organizations control unnecessary costs, reduce security risks, avoid orphaned resources, and keep AWS account maintenance under control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In AWS, deleting the main resource does not always mean the entire environment associated with that resource has been cleaned up.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>infrastructure</category>
      <category>serverless</category>
    </item>
    <item>
      <title>When AWS Lambda Versioning Was Not Enough</title>
      <dc:creator>Martin D</dc:creator>
      <pubDate>Sun, 08 Feb 2026 00:53:07 +0000</pubDate>
      <link>https://dev.to/martin_d_5a09a3d2755932b1/when-aws-lambda-versioning-was-not-enough-1fe8</link>
      <guid>https://dev.to/martin_d_5a09a3d2755932b1/when-aws-lambda-versioning-was-not-enough-1fe8</guid>
      <description>&lt;h1&gt;
  
  
  Postmortem: When AWS Lambda Versioning Was Not Enough
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;During a recent release, we ran into deployment and rollback challenges while relying on AWS Lambda versioning. While versioning worked well for changes limited to business logic, it broke down when changes involved Lambda layers and underlying architecture.&lt;/p&gt;

&lt;p&gt;This postmortem documents what went wrong, why it happened, and how we fixed it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Impact
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Increased deployment risk during releases involving dependency changes
&lt;/li&gt;
&lt;li&gt;Inability to safely reuse existing Lambda versions
&lt;/li&gt;
&lt;li&gt;Rollbacks became unreliable due to layer incompatibility
&lt;/li&gt;
&lt;li&gt;Slower release cycles for architectural changes
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No customer-facing outage occurred, but the risk of runtime failures increased.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Changed
&lt;/h2&gt;

&lt;p&gt;The release included changes to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lambda layers containing shared libraries
&lt;/li&gt;
&lt;li&gt;Dependency versions used across multiple functions
&lt;/li&gt;
&lt;li&gt;Runtime behavior dependent on updated layer code
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although the function interface remained unchanged, the underlying execution environment did not.&lt;/p&gt;




&lt;h2&gt;
  
  
  Expected Behavior
&lt;/h2&gt;

&lt;p&gt;We expected AWS Lambda versioning to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Support safe deployments&lt;/li&gt;
&lt;li&gt;Allow rollbacks using Lambda aliases&lt;/li&gt;
&lt;li&gt;Work for both code and dependency updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This assumption proved incorrect.&lt;/p&gt;




&lt;h2&gt;
  
  
  Actual Behavior
&lt;/h2&gt;

&lt;p&gt;AWS Lambda versioning creates immutable snapshots:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each published version is permanently bound to specific layer versions
&lt;/li&gt;
&lt;li&gt;Published versions cannot be updated to reference new layer versions
&lt;/li&gt;
&lt;li&gt;Lambda aliases cannot compensate for architectural incompatibilities
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Updating layers required publishing new Lambda versions&lt;/li&gt;
&lt;li&gt;Rollbacks could fail due to dependency mismatches&lt;/li&gt;
&lt;li&gt;Versioning alone was insufficient for architecture-level changes&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Root Cause
&lt;/h2&gt;

&lt;p&gt;We treated AWS Lambda versioning as a full deployment lifecycle solution.&lt;/p&gt;

&lt;p&gt;In reality, Lambda versioning is a code versioning mechanism, not an architecture versioning mechanism. The tight coupling between Lambda versions and Lambda layer versions was the core issue.&lt;/p&gt;




&lt;h2&gt;
  
  
  Resolution
&lt;/h2&gt;

&lt;p&gt;We introduced a separate Lambda function to represent the new architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New function name&lt;/li&gt;
&lt;li&gt;New layer references&lt;/li&gt;
&lt;li&gt;Independent deployment and testing&lt;/li&gt;
&lt;li&gt;Gradual traffic migration via upstream services (API Gateway, EventBridge, SQS)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach restored deployment safety and rollback confidence.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Lambda versioning works best for business logic changes
&lt;/li&gt;
&lt;li&gt;Lambda layers introduce hidden coupling across versions
&lt;/li&gt;
&lt;li&gt;Architectural changes require architectural isolation
&lt;/li&gt;
&lt;li&gt;Rollbacks must consider dependency compatibility, not just code
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Preventive Actions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use Lambda versions only for logic-level changes
&lt;/li&gt;
&lt;li&gt;Create new Lambda functions for dependency or architecture changes
&lt;/li&gt;
&lt;li&gt;Limit shared logic in Lambda layers where possible
&lt;/li&gt;
&lt;li&gt;Add dependency impact analysis to release reviews
&lt;/li&gt;
&lt;li&gt;Document decision criteria: version vs new function&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Takeaway
&lt;/h2&gt;

&lt;p&gt;Serverless does not remove architectural responsibility. Knowing when to version and when to isolate is critical for building reliable, production-grade Lambda systems.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If this post helped you, feel free to share or discuss your own Lambda versioning experiences below.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>aws</category>
      <category>devops</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
