Amazon cloudformation 如何通过连接AWS CloudL模板中的参数值和字符串来动态创建资源(用户池)名称?
我正在尝试使用YAML创建AWS CloudFormation模板。我添加了一个UserPool资源,如下所示。应通过参数值获取用户池名称和id,即,如果参数paramUserPoolName的值为“Sample”,则: UserPoolName=Sample UserPool资源名称=SampleUserPool,即“paramUserPoolName+UserPool”的串联值Amazon cloudformation 如何通过连接AWS CloudL模板中的参数值和字符串来动态创建资源(用户池)名称?,amazon-cloudformation,amazon-cognito,aws-userpools,Amazon Cloudformation,Amazon Cognito,Aws Userpools,我正在尝试使用YAML创建AWS CloudFormation模板。我添加了一个UserPool资源,如下所示。应通过参数值获取用户池名称和id,即,如果参数paramUserPoolName的值为“Sample”,则: UserPoolName=Sample UserPool资源名称=SampleUserPool,即“paramUserPoolName+UserPool”的串联值 Parameters: paramUserPoolName: Type: String Resourc
Parameters:
paramUserPoolName:
Type: String
Resources:
<I need 'paramUserPoolName + UserPool' here >:
Type: 'AWS::Cognito::UserPool'
Properties: {
"UserPoolName": paramUserPoolName
}
用这个。您也可以使用,但是!Sub
更容易
Parameters:
paramUserPoolName:
Type: String
Resources:
Type: 'AWS::Cognito::UserPool'
Properties:
UserPoolName: !Sub ${paramUserPoolName}UserPool
至少关于piont 1):不,你可能不知道。YAML中没有参数,这种解释取决于加载YAML的程序。YAML中也没有连接标量的功能。你是否知道第2点)我不知道,但如果你有兴趣学习如何做到这一点,你应该问这个问题,而不是问是否可能/你是否被允许知道它(这只能用是或否来正确回答)。我从你的帖子中删除了不相关的内容,否则,就有很好的动机将其作为一个重复的
Parameters:
paramUserPoolName:
Type: String
Resources:
Type: 'AWS::Cognito::UserPool'
Properties:
UserPoolName: !Sub ${paramUserPoolName}UserPool