The infrastructure-as-code concept allows you to manage an entire cloud infrastructure in a declarative way. AWS provides the CloudFormation service to enable the modeling of the entire infrastructure and application resources using a text file or programming languages in an automated way. Even though it’s very simple to learn and use, its main downside is that it’s tied to AWS only, and if you manage a multi-cloud infrastructure that consists of applications deployed in AWS, Azure, Google Cloud, etc., then you would use Terraform to build, change, and manage infrastructure in a safe and repeatable way throughout the clouds.
In this article, you will be introduced to the way Terraform allows you to define the infrastructure through its configuration language, called HCL. After that, we will model and apply changes to a multi-region infrastructure on AWS that will consist of multiple custom VPCs and EC2s. …
When developing a web application, you may decide to serve the landing page along with every static file through a CDN for better performance. CloudFront is a CDN offered by AWS that allows you to serve your content from different sources, known as origins, like S3 or a Load Balancer. Your application’s static files or dynamic data will be served through these origins to your users.
But during the development process of the application, you would need to host on AWS. …
When your application is ready to roll out in production, monitoring every single activity related to it has a significant impact on its performance. You might need to analyze the server’s CPU utilization, network bandwidth, number of connections that it serves at the same time and so on.
AWS provides a monitoring service called CloudWatch, which would enable you to monitor different metrics for the servers your application is hosted on and store these metrics for later analysis. However, your application might be generating custom internal logs that are related to different business events: are they executing as expected, how long each business event is running for, etc. …
A Docker Container is a lightweight executable program that includes everything from a runtime to system tools and libraries to run an application. When containerizing an application, we might often need to execute different commands inside the container — e.g., for debugging purposes or for running the application manually.
There are three ways to execute different commands inside a Docker container, and I’ll discuss each method in this article.
When building an image for an application, we need to specify a Dockerfile that’d contain instructions on how this image is going to be created and what application it’s going to execute. …
Running multiple concurrent threads requires special attention when they access (perform read and write operations) the same memory block. The piece of code where this memory access happens is called a critical section, and thread access should be synchronized in order to avoid a race condition. In Java, synchronizing the access to critical sections can be done using different mechanisms: Monitor, Lock and Semaphore.
In this article, I will give a thorough comparison between these mechanisms, while trying to synchronize the well-known Producer-Consumer problem. The following code shows the basic Buffer data structure implementation. …
Displaying long lists of items in a client application requires strict attention, as it’s well-known that the application performance can degrade rapidly while trying to render lists with hundreds or even thousands of items.
This happens since the browser must render the entire page and all the data inside it upfront, before showing it to the end-user, and as such, rendering thousands of items in a list would lead to great frustration.
Fortunately, we can use the virtual scrolling technique to address this problem.
From a high-level perspective, virtual scrolling allows the client to render just a small portion of the entire list at a time, for example, ten items, and as the user scrolls up or down that list, only the items that should be shown on the screen, regarding the scroll position, are rendered. …
When trying to design a solution architecture where the application can generate and store private files on a storage option like S3, and allow the possibility for these files to be accessed by specific users for a certain amount of time, and still remain private, we could follow two different approaches based on a real use case scenario.
Let’s write down some use cases and see how we can approach the best solution:
AWS S3 storage offers four ways of server-side data encryption:
Suppose that we are building a web application that would store data on S3, and that data should be encrypted using a private key that would be only known to the application.
In this scenario, we would utilize
SSE-C data encryption, where the application is responsible for creating and maintaining private keys for data encryption, and the objects stored on S3 are encrypted with the keys provided by the application. …
One common misunderstanding, especially when testing reactive streams, is treating synchronous data sources as asynchronous. In this post I will try to explore the differences between synchronous and asynchronous data sources, along with respective examples in
Every reactive library offers the possibility to create a stream from different types of data. For this example, we are going to take into consideration a simple array [2, 12, 35] that will be wrapped into an observable:
const sourceA = from([2, 12, 35]);
This example indicates that when the observable is subscribed to, the values of the array are emitted one by one until the array is exhausted, giving the output outlined above. The wrapped data could be a string, map or set as well. While processing a data item into the subscribe callback, each subsequent item will have to wait for the current item to finish being processed. …
If you are developing front-end applications in Angular, then you are definitely using RxJS one way or another. In this piece, I would like to talk about a problem I ran into while developing a large-scale application that heavily relies on RxJS, and the steps I took to solve it.
The requirements were simple: Allow the application to work in two modes: work mode and view mode. When in work mode, every kind of communication between components should take place (with every keyboard and mouse event handled accordingly), and the appropriate action should be triggered. When in view mode, the event handlers should be disabled so that no action is triggered on any keyboard or mouse events (or the interested subscribers should not be able to listen). …