无服务器从 vpc 声明中获取 VPC id
Serverless getting VPC id from vpc declaration
在我的 provider: 块中,我有一个 VPC 声明为 vpc:
如何在我的资源块中获取此 VPC 的 id/ARN/whatever?我有一个 AWS CloudFormation 资源,我想将我的 VPC 的 ID 作为 VpcId 传递。是否有一些 ${self:} 东西可以获取 id?
我试过 Ref: vpc 但没用。
您将无法使用 Ref
,因为资源不是在此堆栈中创建的。
通过在 functions
或 provider
块中设置 vpc
配置,您将引用现有资源。
如果现有资源是使用 CloudFormation 创建的,您可以 export it and make it available for import in this stack, but if it was created manually its not possible。
在我的 provider: 块中,我有一个 VPC 声明为 vpc:
如何在我的资源块中获取此 VPC 的 id/ARN/whatever?我有一个 AWS CloudFormation 资源,我想将我的 VPC 的 ID 作为 VpcId 传递。是否有一些 ${self:} 东西可以获取 id?
我试过 Ref: vpc 但没用。
您将无法使用 Ref
,因为资源不是在此堆栈中创建的。
通过在 functions
或 provider
块中设置 vpc
配置,您将引用现有资源。
如果现有资源是使用 CloudFormation 创建的,您可以 export it and make it available for import in this stack, but if it was created manually its not possible。