Concepts
line

Serverless microservices developed with AWS CDK

Serverless microservices developed with AWS CDK

Servers have been around the world of IT for a long time, always managing, setting up, scaling them, giving and restricting access to them as they are fundamental in software deployment. Consciously or not, servers have been part of our lives for many years and they have enriched experiencing life so far. Serverless architecture has risen in recent years, making it a lot easier to build applications since developers no longer need to access the servers directly in order to run them. So the idea of a serverfull world might be a little bit out of date right now, considering the fast ascension of serverless, but let’s find out together if we will keep on using servers and discover how AWS Cloud Development Kit is used to build a serverless application. 

Tech people used to have a hard time building monolithic applications because the resources consumed were high, the sizes were too big and they were tricky to manage. Microservice architecture was like a breath of fresh air for the software development industry due to the independent small processes using their APIs for communication with each other. Disting programming languages can be used for developing each microservice, offering a huge flexibility for the developing process. The architecture of the systems became more complex due to the allocated nature of the microservices, but scalability became the best benefit out of this change, developers being able to individually scale every microservice and its demanding resources.

The possibility of focusing more on the developing and design of smaller modular components and the idea of detaching from working with gigantic black box monoliths was happily embraced by developers and managers who felt satisfaction rising as the work became more efficient. Even though it’s still a strong challenge to develop microservice architecture in the parts of deployment and infrastructure management for allocated systems, this is a powerful evolution into a serverless software architecture and now it enjoys its best time in existence.  

It’s kind of paradoxical naming it serverless because it still deals with server processes and server hardware in the same way as with other software architectures. The company that runs the serverless application doesn’t manage or own those servers and this is the main difference, that they use FaaS (Function as a Service) and BaaS (Backend as a Service) as Service platforms without actually owning them.

The service model in which the delivery of services is in charge of server side logic assigned to cloud providers is called BaaS (Backend as a Service). The services often included in this model are cloud storage, database management, user authentication, hosting, push notifications and others, while during this process client applications operate directly on these cloud services rather than communicating with their dedicated servers.

The method of executing the code in stateless, transient computing environments that are managed completely by third party providers beyond the underlying servers is called FaaS (Function as a Service). Developers just upload their code and the Function as a Service platform is accountable for running it. Events like calls, schedulers, or  HTTP(S) requests from different cloud services can trigger the functions. The AWS Lambda service is perhaps the most admired implementation of Function as a Service (FaaS), nevertheless the corresponding options belong to each provider.

Amazon Cognito is used for authorization and authentication by the system, providing access to the APIs only for authorized parties. The API Gateway is responsible for dealing with requests throttling, the routing, DDOS protection and others,  allowing also the implementation of custom authorizers if Amazon Cognito is not used. The Lambda functions for the business logic layer in the perspective of microservices can be looked at like every lambda such as a service procedure and an endpoint controller that handles certain categories of requests, communicating with additional services like caches, databases, config servers, notification services, queues, or different information that may be required by the application. 

The difference is that the independent applications called microservices which run on servers often in the cloud are packed as feathery containers that can be accessed, scaled and managed whenever it is needed. Tools are used in order to look after these containers, so in other words, the application splits in small self-supported parts that get deployed on servers while arranging through their lifecycle. 

As for the serverless functions, after writing the function code you simply upload it to the Function as a Service (FaaS) platform and wait for the cloud provider to manage the execution, packaging, scaling and deployment, while you don’t need to run it by accessing some physical resources. When the microservices are deployed, you’ll find out that surprisingly, they always remain active despite the fact that there’s no processing on the servers allocated for them. This is why requiring host servers with a frequency of days or months needs to be paid, so it’s quite the opposite when it comes to serverless functions that are active solely when they are being executed, saving resources when having no requests.

Now that you’ve discovered what serverless microservices developed with AWS CDK are and how they work, you can ask HyperSense Software to create your own serverless application. It can be done manually through the Command Line Interface (CLI) or through the console of the provider. IaaS (Infrastructure as a Service) is another popular solution that uses AWS Cloud Formation Service (CFS). But the best solution and by far, the one used the most, is AWS CDK (Cloud Development Kit) which was launched a few years ago.  

This software development framework is open source and allows you to outline architecture by operating with renowned programming language like C#, Javascript, Python, Typescript and Java, offering developers pre-configured components on a high level named constructs that you can further extend and use while building the fastest infrastructures. AWS CDK uses CFS (Cloud Formation Service) in the backend to supply secure and reusable resources, helping developers build remarkable software solutions.

HyperSense Software built HSCompress using AWS Cloud Development Kit microservices where you can easily compress any GIF, JPEG or PNG image to optimize the storage size or to send it smoothly over social media and emails. This cloud based image compression preserves the quality while reducing the sizes up to 90%, making it simple and free to use. You can drag and drop your image or select up to 300 images to be resized with HSCompress, with a maximum image size of 50 MB. Enjoy a fast compression that usually takes up to 10 seconds for a 5 MB image.

Contact us to find out more about what we do and how we can help you!