AWS is currently one of the most powerful and influential players in the Cloud Computing market. It has over a million customers and a customer base that is active in over 190 countries. At the moment, more than one-third of all Internet users take a trip on an AWS-powered website or application. It has a sizable market share in the Cloud Computing industry.
Furthermore, AWS offers a cloud computing kit known as CDK (Cloud development kit), which allows you to characterize your cloud-based resources by using an open-source software development framework and getting acquainted with programming languages. It provides superior components known as constructs that up in the coming cloud resources with proven deficiencies, allowing you to easily build cloud applications. AWS CDK uses AWS CloudFormation to provide your resources securely and repeatable.
Today we will take a follow up on
CDK for module- federated micro frontends AWS Architecture-
Most AWS resources would be procured using CDK. You will have a production-ready, dependable and provision relating deployed to your AWS account in minutes, enabling your teammates to expand independently and give strong business iterations via their individual micro-frontends.
However to know better insights on Cloud Computing, definitely AWS Architecture training plays an important role.
cloud computing
The architecture is made up of three major components:
- Changes to mono-repo code trigger specific deployment pipelines.
- Deployment pipelines create and deploy a bunch of artefacts to AWS resources.
- A worldwide modular is able to host infrastructure designed specifically for client-side micro-frontends.
A word or two about the Mono-repo setup:
Micro-frontends have been an aspect of a mono-repo setup, which is a single compendium with nested folders containing independent web apps and is held together by the Webpack Module Federation plugin and Lerna. You can see how Module Federation systems represent micro-frontends in the short version below.
The code above enables us to simulate micro-frontends as systems that can be loaded lazily as Web components in your app. The technique is to interactively infuse each micro-frontend script inside the app page so that the host /shell app can load them remotely. As previously stated, there will be more in the upcoming article. For the time being, we will focus on the three sub-architectures mentioned earlier.
Triggers for single repositories:
This first step aims to capture individual micro-frontend repository shifts and trigger those for subsequent use by server-less components.
Developers use Github to push changes to their micro-frontend, though the same can be done with other well-known version control source platforms such as BitBucket. Modifications are managed by a Lambda function subjected as Restful API via an ApiGateway via a Github webhook. The primary goal of Lambda is to link micro-frontend code changes to their destination pipeline.
Pipeline for deployment:
The second step’s goal is to ensure that modifications to individual micro-frontend repo trigger individual code pipelines. This promotes team independence because if only one micro-frontend is modified, we want to trigger the latter’s related pipeline, not all of them.
An AWS Code Pipeline is launched once a code modification is associated. This consists of four major steps:
- The Code Pipeline, on its own, appears to be able to handle the GitHub connection and retrieves the GitHub source code.
- The Code Build creates a build artefact from the receiving source code. Because micro-frontends are JavaScript-based, yarn will be used to construct them together into a set of bundles used in the next step.
- Deploy the code. This step deploys the packaged files created in the previous steps to a single Simple Storage Service (S3). Each micro-frontend would be saved in its own “folder” (or key) so that it can be deployed independently.
- Invalidation of the Code Build Cache. The final step is another Code Build step that ensures the CloudFront cache is invalidated each time we post and deploy new artefacts to S3.
Infrastructure for hosting:
Lastly, basic AWS resources must be provisioned. The main objective of this final step is to ensure that this occurs using a scalable, simple yet savvy, and credible architecture.
Given that the micro-frontends are customer-facing optimized applications, end-users might access online applications via a CloudFront distribution protected by WAF. CloudFront makes a connection to the private S3 bucket using an OAI identity, ensuring that data would be only available publicly through the CDN and just not straightforwardly from the bucket. CloudFront employs a Lambda@Edge function to ensure proper dispatching from a single bucket to multiple origins.
CDK- To rule over all of them:
The above will then be provisioned using a CDK application that includes a single stack.
The micro-frontends stack consists of three constructs that provide the foundational AWS resources being used attend the app as well as all deployment-related resources such as CodePipelines, an S3 bucket, a Lambda@Edge function, a CloudFront distribution, and various IAM policies, roles, and OAI to support proper privacy and security when connecting to GitHub.
A further underlying stack is generated once provisioning the Lambda@Edge feature via the CDK Experimental CloudFront API, as it is required to implement the Lambda@Edge on a specific AWS region once deploying your architecture to a region other than us-east-1.
Conclusion:
We went over a CDK stack capable of provisioning an entire AWS architecture for mono-repo client-side micro-frontends. You could get a production-ready environment that is ready to scale within a couple of minutes and adheres to architectural guiding principles and cornerstones by using a set of constructs. As there is a lot to cover, you can learn more about a high-level overview of a serverless AWS architecture for hosting and deploying mono-repo micro-frontends using the Module Federation Webpack plugin.
Author Bio:
My name is Korra Shailaja working as a content contributor at MindMajix. I’m a tech enthusiast and have a great understanding of today’s technology. I am an expert in writing content on demanding technologies such as Salesforce tutorial, Cybersecurity tutorial, Software Testing, QA, Data analytics, Project Management, ERP tools, etc.