如何将存储库资源作为参数传递给 AWS 代码管道模板?
How can I pass a repository resource in as a parameter to AWS codepipeline template?
我有一个用于 AWS codepipeline 构建的 yml cloudformation 模板 (A),我想在另一个模板 (B) 中对其进行变体。
原始 (A) 有一个存储库作为其资源之一,它最初是 运行 通过 cloudformation 创建的。我希望变体 (B) 模板使用在原始 (A) 中生成的相同 ECR 存储库来进行代码构建。
有没有一种方法可以让 (B) 模板通过将存储库资源值作为参数或其他方式传入来使用在 A 中创建的 ECR 资源?
例如,我想在 B 中重用(而不是重新创建)A 中的资源类似于:
Repository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Sub comp/${ServiceName}
RepositoryPolicyText:
Version: 2012-10-17
Statement:
...
根据你的问题我不确定你指的是什么资源。但一般来说,您可以使用 Output
部分
的 Export
属性 将任何值从一个堆栈导出到另一个堆栈
来自Exporting Stack Output Values
To share information between stacks, export a stack's output values.
Other stacks that are in the same AWS account and region can import
the exported values. For example, you might have a single networking
stack that exports the IDs of a subnet and security group for public
web servers. Stacks with a public web server can easily import those
networking resources. You don't need to hard code resource IDs in the
stack's template or pass IDs as input parameters.
我有一个用于 AWS codepipeline 构建的 yml cloudformation 模板 (A),我想在另一个模板 (B) 中对其进行变体。
原始 (A) 有一个存储库作为其资源之一,它最初是 运行 通过 cloudformation 创建的。我希望变体 (B) 模板使用在原始 (A) 中生成的相同 ECR 存储库来进行代码构建。
有没有一种方法可以让 (B) 模板通过将存储库资源值作为参数或其他方式传入来使用在 A 中创建的 ECR 资源?
例如,我想在 B 中重用(而不是重新创建)A 中的资源类似于:
Repository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Sub comp/${ServiceName}
RepositoryPolicyText:
Version: 2012-10-17
Statement:
...
根据你的问题我不确定你指的是什么资源。但一般来说,您可以使用 Output
部分
Export
属性 将任何值从一个堆栈导出到另一个堆栈
来自Exporting Stack Output Values
To share information between stacks, export a stack's output values. Other stacks that are in the same AWS account and region can import the exported values. For example, you might have a single networking stack that exports the IDs of a subnet and security group for public web servers. Stacks with a public web server can easily import those networking resources. You don't need to hard code resource IDs in the stack's template or pass IDs as input parameters.