Skip to main content

Posts

Design a movie ticketing platform

Greetings! Movies are everyone's fun hobby. Designing a movie system is even more fun. We can design mainly 2 systems; System to support a single theater (or group) System to support all theaters What I am interested in in this exercise is the high-level architecture of a system to support all theaters, which is a movie platform. These sorts of systems are not built overnight. It takes a lot of engineering effort, designs, re-designs, etc to achieve the desired output. User requirements Our main requirement is browsing movies and booking a ticket. Other than that, we can add a few more useful features. Browse available movies in nearby cinemas Book a ticket with online payments Find movie information Notifications Recommended movies Comments and ratings User Registration Cinema registration We also need our system too; Better response time Searches by movie names Secure payments High-level design At a very high level, our system will look like this. We are going to explore and expa...

How to get the access token with Amazon Cognito

Greetings! AWS Cognito is a serverless identity and access management server. We don't have to manage any server or database to handle user data and authentication, and authorization flows. In this article, we focus on how to create a Cognito user pool and retrieve an access token that can be used to access back-end data (we will not create a backend service though). Cognito User Pools Amazon Cognito User Pools makes it easy to create and maintain a user directory and add sign-up (user onboarding) and sign-in to your mobile or web application for authentication, authorization, and resource access and control. Let's get started. What we do Create a Cognito user pool Register a user and retrieve the authorization token Retrieve access token Create a Cognito user pool Go to AWS Console > Amazon Cognito to navigate to the Cognito page. Click on the "Create user pool"....

How to run a scheduled job with EventBridge and Lambda

Greetings! Triggering a piece of code by a timer has multiple use cases. Hence I am going to talk about how can we do it using AWS EventBridge. Run daily/monthly reports Send reminders Scheduled data mining Send marketing emails The source code for this article can be found here . Let's learn how we can achieve this architecture using AWS EventBridge and Lambada. EventBridge AWS EventBridge is a serverless event bus service that you can use to connect your applications with data from a variety of sources including AWS services and external services. An event is an indicator of a change in the environment. When an event receives, it applies a rule to route the event to a target. Rules match events to targets based on either an event pattern or on a schedule which is the focus of this article. Let's build the architecture using the serverless framework. Initialize the project Let's initialize the project using serverless cli. mkdir eventbridge-lambda-t...

How to secure an API using Lambda authorizer

Greetings! I wrote about creating a CRUD API using API Gateway and Lambda in a previous article. However, I did not talk about how to secure it. In this article, I am going to explain how we can use Lamda Authorizer to secure an API. The complete code is here . Lambda Authorizer Lambda authorizer is an API gateway feature to control access to your API. It uses the provided lambda function to do so. This is useful when we want to implement a custom authorization scheme that uses a bearer token (JWT) or a request parameter. Token authorizer - uses a token to authorize uses. It receives the caller's identity in a bearer token, such as a JSON Web Token (JWT) or an OAuth token Request authorizer - uses parameters, headers, and query strings to pass user identity In this article, we use a token-based authorizer. For simplicity, we expect our token to be "cat". Initialize the project Let's initialize the project using the serverless framework. ...

Handling file uploads with S3 and Labmda

Greetings File uploading and invoking logic based on that can be a common business scenario. We can categorize a few such use cases as below. Image resizing such as thumbnail creation Read JSON file content and invoke logic Image processing The source code for this article can be found here . Let's learn how we can achieve this architecture using AWS S3 and Lambada. S3 Events We can enable events for a particular S3 bucket for bucket operations such as file added, and updated. When we enable this feature, we need to provide the event recipient such as a lambda function. When the bucket operations occur, the provided target will be invoked. Let's build the architecture using the serverless framework. Initialize the project Let's initialize the project using serverless cli. mkdir s3-lambda-trigger cd s3-lambda-trigger serverless create --template aws-nodejs npm init -y npm install @aws-sdk/client-s3 --save We have installed the S3 dependency...