英文:
get an existing Amplify app with AWS CDK Amplify lib
问题
我想使用AWS CDK获取现有的Amplify应用程序,以便我可以为其添加自定义域名。
我在文档中看到可以创建整个Amplify应用程序并部署它,但无法获取已经部署的现有应用程序。
我希望该库有一个类似于"getAppByName"之类的函数。
是否有一种方法可以实现这一点,最好使用CDK v2?
谢谢!
英文:
I would like to get hold of an existing Amplify app using the AWS CDK so I can add custom domains to it.
I see in the docs that it is possible to create a whole Amplify app and deploy it, but not getting an existing one that is already deployed.
I was hoping the lib to have a function like "getAppByName" or something.
Is there a way to achieve that, preferably using CDK v2?
Thanks!
答案1
得分: 1
The @aws-cdk/aws-amplify-alpha 模块的 App 构造具有 fromAppId 静态方法。它返回一个只读的 引用 到现有的 (外部) Amplify App。返回类型是 IApp
,您可以在其他构造中使用它,但不能用于修改现有的 App。
注:这种只读模式适用于所有返回 ISomething
构造的 CDK fromSomethingId
类型方法。
英文:
The @aws-cdk/aws-amplify-alpha module's App construct has a fromAppId static method. It returns a read-only reference to an existing (external) Amplify App. The return type is IApp
, which you can use in other constructs, but not use to modify your existing App.
N.B. This read-only pattern applies to all CDK fromSomethingId
type methods that return an ISomething
construct.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论