How to set up parameterized components automatically in a declarative way?

0

Hello everyone,

we need to set up some AWS resources automatically for some users of our system. The current approach is to have the user authenticate and redirect his request to a Lambda endpoint. The Lambda checks if the user already has the resources and if not creates the desired resources in an imperative way. The resources are always the same (S3 Bucket, Encryption Key, Role, ELB Listener Rule, Target Group).

This has several disadvantages. Tagging of resources is tedious and also resource creation is not an atomic operation and thus the process is error prone. Therefore we would like to change to a declarative approach.

Our current idea is to create a CfnTemplate with the desired resources and proper parameters to create the individual resources. The Lambda back end would than deploy the CfnTemplate up on user authentication.

While this looks like a step in the right direction we would like to confirm if this is the best approach or if there are other/better options.

Specifically many resources created in our project already use the TypeScript CDK and if there is a way to define something like a "component factory" in CDK, that would be nice as well!

Any guidance or link to useful resources is highly appreciated. Thanks in advance!

1 個回答
0

Your plan to use a CloudFormation (CFn) template to define the AWS resources for your users is a good approach. Using CFn templates will help you to define your infrastructure in a declarative way, which is more scalable and maintainable than an imperative approach. In addition to using CFn templates, you can also consider using AWS Cloud Development Kit (CDK) to define your infrastructure as code in TypeScript. CDK is a higher-level abstraction over CFn templates, allowing you to define your infrastructure in a more programmatic way. With CDK, you can define reusable components, called constructs, which can be used to create infrastructure resources. You can also define your own constructs and reuse them across your projects. Using CDK can help you to reduce the amount of boilerplate code needed to create and manage your AWS resources.

已回答 1 年前
  • Can you be more specific about how the CDK can be used to deploy the resources on demand?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南