Publishing to SNS Topic from Lambda Using VPC Endpoint with SAM Template: AWS Serverless Application Model (SAM) Pub/Sub Architecture

Amazon Web Services provides a multitude of tools for developers to build robust and scalable cloud applications. In this article, I’ll guide you through publishing to a Simple Notification Service (SNS) topic from a Lambda function through a VPC Endpoint. We’ll encode this architecture using the AWS Serverless Application Model (SAM) toolset. This setup is part of a Pub/Sub architecture which offers several benefits: Better Security: Placing the Lambda function within a Virtual Private Cloud (VPC) through a VPC Endpoint ensures that the communication between the Lambda function and SNS topic remains private, isolated from the public internet, and protected from unauthorized access. Performance Improvement: Directly accessing SNS through a VPC Endpoint often results in lower latencies since the communication stays within the AWS network infrastructure. Also, in general, the Pub/Sub architecture enables untethers the function from downstream side-effects. This relieves the function from the latency and error handling responsibility for these side effects which directly improves the user experience. Scalability and Flexibility: The pub-sub architecture scales to varying workloads effectively. SNS can handle thousands of messages being published concurrently and the downstream Lambda consumers scale automatically. In this tutorial, we will discuss Briefly what AWS Lambda, SNS, and VPC endpoints are. How to configure a VPC endpoint. How to publish messages to SNS from Lambda using the configured VPC endpoint. Code snippets of AWS SAM templates. What Are AWS Lambda, SNS, and VPC endpoints? Before diving into the practical aspect of this article, let’s briefly review the building blocks we’ll be using: ...

July 31, 2023 · 5 min

Tips for Integration Testing with GitHub Actions CI pipeline: AWS SAM Backend Integration Testing with GitHub Actions

This article contains some tips and code to help with adding Serverless Backend Integration tests to GitHub Actions. Integrating tests into the CI pipeline improves confidence that existing behavior has not been broken by changes. Typically a production code base will have tests integrated into the CI, and any merge request must pass the tests before being merged and deployed to production. Regarding the local implementation of AWS SAM backend integration tests, have a look at this article. ...

December 31, 2022 · 5 min