Cloud Tech Simplified
293 FOLLOWERS
Learn more about the practical tips, tricks and development techniques for building cloud native applications and services.
The Cloud Tech simplified is a blog by Mugilan Ragupathi. who builds cloud native applications & services and along with that he shares his learnings.
Cloud Tech Simplified
10M ago
In this article, we're going to discuss about how to run Fastify app in AWS Lambda.
If you're not aware of Fastify, Fastify is one of the high performant web frameworks on NodeJS.
?
TLDR: You need to use @fastify/aws-lambda package to bridge between AWS Lambda and Fastify application
Why you may want to run Fastify app in AWS Lambda?
If you have an existing Fastify application for your API, you many want to run that app in AWS Lambda because of the cost benefits and lower overhead in maintaining the infrastructure.
Infrastructure
We're going to use AWS CDK for creating the necessary infrastr ..read more
Cloud Tech Simplified
10M ago
In this article, we're going to discuss how to allow or restrict users of specific domains in AWS Cognito
Why you may want to restrict based on domains?
You may want to build a web application for your company event where you want only the employees of your company to register. One way to identify the employees of your company, he or she will have an email id with your company domain name.
For example, if I'm creating such an application, I would allow anyone whose email address ends with @cloudtechsimplified.com
?
TLDR: You can call a lambda function with pre signup trigger on ..read more
Cloud Tech Simplified
10M ago
In this article, we're going to discuss how to cache the response in AWS API Gateway
Why do we use cache in AWS API Gateway?
Caching is one of the most commonly used solutions to reduce the load on your backend.
Let's say you're building an API for a knowledge base for searching all of your documents. There could be scenarios where people search for popular documents such as leave policies :-) Instead of searching your database every time, you can search your db for the first time and you can cache the result for 5 minutes. Any subsequent requests which come to your API Gateway (in the next 5 ..read more
Cloud Tech Simplified
10M ago
In this article, we're going to discuss how to trigger an AWS Lambda when a user signs up
Whenever a user signs up, we want cognito to call a lambda function with the user's metadata so that we can save that data in dynamodb or do further processing.
Why you may need to store the user's metadata?
There are some instances where you may need to get the user's metadata information. For example, you may have an admin dashboard in your application - where you have a list of the users sorted by the date they signed up. You may also create a report where you want to know how many users have signed ..read more
Cloud Tech Simplified
11M ago
In this article, we will learn how to run Playwright with Python in AWS Lambda. For those who don't know what Playwright is - Playwright is the framework for web testing and automation. It allows testing Chromium, Firefox, and WebKit with a single API.
?
TLDR: There are 2 options to do this.
Option 1: Use the base image provided by AWS Lambda and install all the necessary dependencies(both browser and system dependencies)
Option 2:Create a standard docker image used for Playwright and implement the runtime interface client for AWS Lambda
Out of the above 2 options, option 2 is easier to i ..read more
Cloud Tech Simplified
1y ago
In this article, we will discuss how to use AWS Lambda with Application Load Balancer.
?
TLDR: Create a target group with lambda function in the load balancer and add action to the listener to forward the request to this newly created target group based on the path.
Read the article for more details.
Why do we need to use AWS Lambda with Application Load Balancer?
One of the popular integrations for AWS Lambda is API Gateway. With API Gateway, the architecture would be completely serverless- you might wonder why we need to use AWS Lambda with Application Load Balancer.
Let's assume you have ..read more
Cloud Tech Simplified
1y ago
In this article, we will discuss how to do pagination in DynamoDB.
?
TLDR: Use the LastEvaluatedKey from the response as the value for ExclusiveStartKey in the query parameters.
Why do we need Pagination?
If we're using a normal relational database such as Oracle, or Postgres - you would be able to retrieve all the records in a table in a single query.
But, DynamoDB has a constraint - your response payload should not exceed 1 MB. This is to make sure that the performance is constant for even heavy workloads. So, how can we retrieve all the records, in case we want to do something with them ..read more
Cloud Tech Simplified
1y ago
In this article, we'll discuss how to untar file to a target bucket automatically when you upload a tar file in an S3 bucket
Untar file in
?
The idea is to use tarfile python package to untar the files and write them to /tmp directory and then copy all the files to the target bucket
I've written a similar article to unzip files here
Infrastructure
We're going to use AWS CDK for creating the necessary infrastructure. It's an open-source software development framework that lets you define cloud infrastructure. AWS CDK supports many languages including TypeScript, Python, C#, Java, and ot ..read more
Cloud Tech Simplified
1y ago
In this article, we will learn how to fix the CORS issue using AWS Lambda with API Gateway. Here is the TLDR version.
?
TLDR: If you're using Lambda Proxy Integration in API Gateway, you just have to do 2 things to fix CORS error
- Add default CORS Pre-flight Options to REST API
- Return Access-Control-Allow-Origin header from lambda function allowing your domain
You can read rest of the article for more details.
What is CORS?
Let's say you have your API gateway at https://<random-id>.execute-api.us-east-1.amazonaws.com and your single-page application hosted in S3 backed by Clou ..read more
Cloud Tech Simplified
1y ago
In this article, we're going to discuss how to check for duplicates when inserting a record in dynamodb.
Let's consider a simple dynamodb table user-jobs, where userId is the primary key and you've another attribute jobId where you store the job id.
You want to prevent multiple jobs from running for the same user. For example, if the user user1 already has a job job1 running - the system should prevent him to create another job.
You can use ConditionExpression in DynamoDB for achieving the same.
Before discussing ConditionExpression , let us discuss what would happen if we don't use condition ..read more