Skip to content

Commit 1eb67aa

Browse files
Mufaddal5253110vjdhama
authored andcommitted
fix: correct grammer and words
1 parent 11dbc36 commit 1eb67aa

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

content/blog/multi-tenant-system-with-aws-cdk.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: "Building Scalable Multi-Tenant Systems with AWS CDK: An IaC Approach"
2+
title: "Building Scalable Multi-Tenant Systems with AWS CDK: An IAC Approach"
33
authorId: "mufaddal"
44
date: 2024-11-22
55
draft: false
66
featured: true
77
weight: 1
88
---
9-
In this blog I will be taking you on a journey of building the scalable and efficient IaC solution that we build for our multi-tenant system. Here we are not going to debate why we chose the CDK; that will be another discussion that can be highlighted in another blog. Instead, how we approached solving using AWS CDK is going to be discussed in this blog. Even if you are not very familiar with CDK, this blog can help to build a mental model of how we can think while writing the code for the infrastructure of such a complex system.
9+
In this blog, I will be taking you on a journey of building the scalable and efficient IAC solution that we build for our multi-tenant system. Here we are not going to debate why we chose the CDK; that will be another discussion that can be highlighted in another blog. Instead, how we approached solving using AWS CDK is going to be discussed in this blog. Even if you are not very familiar with CDK, this blog can help to build a mental model of how we can think while writing the code for the infrastructure of such a complex system.
1010

1111
## What are Multi-tenant Systems?
1212

@@ -28,7 +28,7 @@ AWS CDK, which is built on TypeScript, is tightly integrated with AWS CloudForma
2828

2929
## Understanding Our Requirements
3030

31-
Our use case involves the linear growth of services alongside the exponential growth of tenants.A critical requirement is that each tenant must have database isolation to ensure robust tenant data integrity and confidentiality.This leads us to choose an architecture where services and databases for each tenant are deployed in isolation.
31+
Our use case involves the linear growth of services alongside the exponential growth of tenants. A critical requirement is that each tenant must have database isolation to ensure robust tenant data integrity and confidentiality. This leads us to choose an architecture where services and databases for each tenant are deployed in isolation.
3232

3333
Key requirements include:
3434

@@ -47,17 +47,17 @@ To visualize our architecture, consider the following components:
4747

4848
## What do we know?
4949

50-
Now let’s briefly see what all things we have in our bucket and what is expected from IaC.
50+
Now let’s briefly see what all things we have in our bucket and what is expected from IAC.
5151

5252
As we were using AWS as our cloud provider, we started looking into finalizing the architecture that we were going to use for our system. After all the R&D, we decided to go with the Multi-VPC architecture that is one of the recommendations from AWS, and yes, this was written in AWS CDK. And hence, taking recommendations from this CDK solution, we were able to achieve a single VPC for a single tenant, which then solved our complete isolation problem along with the platform VPC connectivity with the tenant VPCs. We will be looking at this in detail in this blog too.
5353

5454
Considering we have what we wanted for our networking infrastructure, then for applications we are going to use Fargate ECS services, RDS for databases, SSM for application environment variables, Secret Manager for application secrets, and Route 53 for maintaining the DNS records.
5555

5656
And for continuous integration and continuous deployment, we are going to use GitHub Actions. From all this decision, you might realize that we are avoiding anything self-hosted for now.
5757

58-
Before we start looking into CDK code, let me tell you I will only be going through the configuration file with you, not the actual code, because CDK only differs from other IaC tools in that it is written in imperative form, which means we make the configuration file public-facing and the actual code an abstraction, which then helps each member of the org to just learn how to manipulate the configuration file and not the actual code, which helps the infrastructure manipulation be very easy, quick, and scalable.
58+
Before we start looking into CDK code, let me tell you I will only be going through the configuration file with you, not the actual code, because CDK only differs from other IAC tools in that it is written in imperative form, which means we make the configuration file public-facing and the actual code an abstraction, which then helps each member of the org to just learn how to manipulate the configuration file and not the actual code, which helps the infrastructure manipulation be very easy, quick, and scalable.
5959

60-
## IaC of Networking
60+
## IAC of Networking
6161

6262
Let’s first start looking into how we break down the [recommended](https://github.com/aws-samples/aws-vpc-builder-cdk/tree/main) networking architecture to fit our solution.
6363

@@ -117,7 +117,7 @@ providers:
117117
firewallName: InspectionEgress
118118
```
119119
120-
For incoming traffic from the internet Central ingress is considered as ingress VPC, and similarly, central egress is the VPC from where all traffic will go out to the internet.
120+
For incoming traffic from the internet, Central ingress is considered the ingress VPC, and similarly, central egress is the VPC from where all traffic will go out to the internet.
121121
122122
```yaml
123123
providers:
@@ -150,7 +150,7 @@ providers:
150150
151151
Platform VPC has connectivity with tenants VPCs, and tenants are not having cross-connectivity, as we can verify this with dynamicRoutes.
152152
153-
This setup was the first milestone as a part of the infrastructure, as now to onboard any new tenants we just need to add a small block of code and the routes like below.
153+
This setup was the first milestone as a part of the infrastructure, as now to onboard any new tenants we just need to add a small block of code and the routes, like below.
154154
155155
```yaml
156156
vpcs:
@@ -184,18 +184,18 @@ transitGateways:
184184
inspectedBy: inspectionVpc
185185
```
186186
187-
Moving forward from networking to application was going to be a little tricky because considering this networking setup using CDK, we have to be sure that we maintain the consistency across networking and application code for infrastructure.
187+
Moving forward from networking to application was going to be a little tricky because, considering this networking setup using CDK, we have to be sure that we maintain the consistency across networking and application code for infrastructure.
188188
189189
So we had two options: either edit the same code to add another support for the application or create a new CDK project that will only care about the application, considering the networking part is already set up.
190190
191-
We chose to go with the 2nd approach because
191+
We chose to go with the second approach because
192192
193-
1. Change in application-related configuration will be more aggressive than networking.
193+
1. Changes in application-related configuration will be more aggressive than networking.
194194
2. To make application configuration manipulated by developers, we have to keep the unusual data, according to developers, as little as possible in the same place.
195195
3. Changes in networking configuration can impact the entire ecosystem, and hence maintenance of that should only come under specific teams like SRE/DevOps and should not be available to manipulate so easily by any member of the organization.
196-
4. By keeping application IaC separate, it also helps in automating the CI/CD, which is also another topic we can discuss in a further blog.
196+
4. By keeping application IAC separate, it also helps in automating the CI/CD, which is also another topic we can discuss in a further blog.
197197
198-
## IaC of Application
198+
## IAC of Application
199199
200200
The basic idea of writing AWS CDK code is to bundle the unit of deployment into the same stack. CDK Stack represents a single CloudFormation stack, which is a collection of resources that are deployed together. So here, I have created the stack with a collection of resources that are going to be deployed together and are linked.
201201
@@ -250,29 +250,29 @@ This is the first stack that we have written to create common IAM roles that are
250250

251251
### ECS Service Stack (with EFS)
252252

253-
The stack creates the ECS service for the tenants cluster by identifying via configuration file alongside the ALB, NLB, EFS, and security groups.
253+
The stack creates the ECS service for the tenant cluster by identifying via the configuration file alongside the ALB, NLB, EFS, and security groups.
254254

255255
### RDS Stack
256256

257257
Keeping the stateful resources separate is one of the best practices that we followed, and hence the creation of the RDS stack is kept in a different stack along with the KMS key, security groups, and updating the secret manager with RDS credentials.
258258

259259
### Public ALB
260260

261-
This is one of the common stacks we identified to create a public-facing application load balancer separately by following practices of attaching ACM and proper security groups.
261+
This is one of the common stacks we identified to create a public-facing application load balancer separately by following the practices of attaching ACM and proper security groups.
262262

263263
### Internal ALB
264264

265265
CDK Stack that is used to create a separate internal ALB, such as in the platform VPC, to communicate with the tenants VPC services
266266

267267
## Conclusion
268268

269-
In conclusion, building a scalable and efficient multi-tenant system on AWS requires careful planning and design. By using AWS CDK, we were able to define and provision our cloud infrastructure resources in a flexible and scalable way. Our approach to separating IaC code for networking and applications allowed us to maintain consistency and make changes more easily. We hope that this blog post has provided a useful example of how to use AWS CDK to build a multi-tenant system.
269+
In conclusion, building a scalable and efficient multi-tenant system on AWS requires careful planning and design. By using AWS CDK, we were able to define and provision our cloud infrastructure resources in a flexible and scalable way. Our approach to separating IAC code for networking and applications allowed us to maintain consistency and make changes more easily. We hope that this blog post has provided a useful example of how to use AWS CDK to build a multi-tenant system.
270270

271-
We look forward to sharing more of our experiences in future blog posts with follow-up questions like below.
271+
We look forward to sharing more of our experiences in future blog posts, with follow-up questions like below.
272272

273273
1. How to automate CDK infrastructure provisioning with GitHub Actions?
274274
2. When to choose CDK over Terraform?
275275
3. What are the downsides of choosing a multi-VPC AWS architecture?
276-
4. How to design a scalable deployment pipeline for multiple services and tenants?
277-
5. How to plan for disaster recovery?
276+
4. How do you design a scalable deployment pipeline for multiple services and tenants?
277+
5. How do you plan for disaster recovery?
278278
6. How to optimize multi-VPC architecture to reduce costs?

0 commit comments

Comments
 (0)