Skip to main content

Posts

Showing posts from February, 2023

Introduction to Elasticsearch

Greetings! Elasticsearch is a powerful tool that most companies use for various use cases. It is the best tool we can use to give users a seamless search experience. Before jumping in, let's try to understand it at a high level. We know that our data is there in our databases, however, we are not able to retrieve them faster mostly due to the spreadsheet-like data structure. Elasticsearch is document-oriented, meaning it stores data as documents as it is. It not only saves documents but also makes them easy to searchable. What is Elasticsearch Elasticsearch is a distributed, free, and open search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured. Elasticsearch is built on top of Apache Lucine but hides the complexity behind a simple, coherent, restful API. We can name a few use cases. Search in websites Logging and log analytics Application performance monitoring Geospatial data analysis and visualization Security ana...

How to create an AWS Cognito user pool using CloudFormation

Greetings! In my previous article, I created a Cognito user pool using the AWS console. However, that is not a good practice in real projects as it involves a lot of manual work. That is why we need to leverage infrastructure as code. In this article, we create the same setup using CloudFormation. It turned out that there is no proper example in the documentation and the documentation is also a little confusing. Had to do a little trial and error and dig the internet as well. What we need We need to create a user pool and register a client. After that, we need to retrieve an access token for the logged-in user. Steps We mainly need to configure; UserPool UserPoolClient UserPoolDomain Here is the complete CloudFormation template. AWSTemplateFormatVersion: "2010-09-09" Description: Cognito Stack Resources: MyWebAppUserPool: Type: AWS::Cognito::UserPool Properties: UserPoolName: my-web-app-user-pool Policies: PasswordPolicy: ...

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"....