如何通过在 AWS CloudFormation YAML 模板中连接参数值和字符串来动态创建资源 (UserPool) 名称?
How to dynamically create Resource (UserPool) name by concatenating parameter value and string in AWS CloudFormation YAML template?
我正在尝试使用 YAML 创建 AWS CloudFormation 模板。我按如下方式添加 UserPool 资源。用户池名称和 ID 应通过参数值获取,即如果参数 paramUserPoolName 的值为 'Sample',则:
用户池名称 = 示例
UserPool 资源名称 = SampleUserPool 即 'paramUserPoolName + UserPool'
的串联值
Parameters:
paramUserPoolName:
Type: String
Resources:
<I need 'paramUserPoolName + UserPool' here >:
Type: 'AWS::Cognito::UserPool'
Properties: {
"UserPoolName": paramUserPoolName
}
如何在 CloudFormation 模板中动态创建资源 ID?
PS:
以下有效:
Resources:
SampleUserPool:
Type: 'AWS::Cognito::UserPool'
Properties:
UserPoolName: !Sub ${paramUserPoolName}UserPool
我正在尝试使用 YAML 创建 AWS CloudFormation 模板。我按如下方式添加 UserPool 资源。用户池名称和 ID 应通过参数值获取,即如果参数 paramUserPoolName 的值为 'Sample',则:
用户池名称 = 示例
UserPool 资源名称 = SampleUserPool 即 'paramUserPoolName + UserPool'
的串联值Parameters:
paramUserPoolName:
Type: String
Resources:
<I need 'paramUserPoolName + UserPool' here >:
Type: 'AWS::Cognito::UserPool'
Properties: {
"UserPoolName": paramUserPoolName
}
如何在 CloudFormation 模板中动态创建资源 ID?
PS:
以下有效:
Resources:
SampleUserPool:
Type: 'AWS::Cognito::UserPool'
Properties:
UserPoolName: !Sub ${paramUserPoolName}UserPool