如何在CDK中引用现有的时间播放表?

发布于 2025-01-24 10:22:42 字数 360 浏览 3 评论 0原文

我正在使用AWS CDK(Python)来管理基础架构,包括Amazon Timestream数据库和表。

假设我有一个现有的时间播放表,我想在使用CDK时设置权限。

我看到的持有时间播放表的唯一方法是使用cfntable构造,一种所谓的级别1构造。这是因为时间流尚未公开2级构造。但是,使用此构造,我创建一个表作为堆栈的一部分,我没有引用现有资源。

对于级别2构造,例如lambda的函数,可以使用function.from_function_name()方法来引用现有资源。我还没有找到任何对1级结构类似的方式。

是否可以?如果是这样,怎么样?

I am using AWS CDK (Python) to manage infrastructure, including Amazon Timestream databases and tables.

Suppose i have an existing Timestream table that i want to set permissions on using CDK.

The only way i have seen to get a hold of a Timestream table is to use the CfnTable construct, a so called level 1 construct. This is because Timestream does not expose level 2 constructs yet. However, using this construct, i am creating a table as part of my stack, I am not referencing an existing resource.

For level 2 constructs, such as Function for Lambda, it is possible to reference an existing resource, for example by using the Function.from_function_name() method. I have not found any way of doing something similar for level 1 constructs.

Is it possible? If so, how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听风吹 2025-01-31 10:22:42

只需将表的ARN直接用作IAM 基于身份的策略。然后将策略添加到适当的 a>,例如lambda的角色。

Just use the table's ARN directly as a resource in an IAM identity-based policy. Then add the policy to the appropriate Role, e.g. a Lambda Role.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文