创建堆栈时的AWS CloudFormation模板验证

时间:2020-10-23 10:03:41

标签: amazon-web-services amazon-cloudformation

我正在使用CF模板创建一个AWS Stack,其中我的InstanceHostname限制为最大。在“ AllowedPattern”中使用正则表达式15个字符(普通字母和数字):

"InstanceHostname": {
  "Type": "String",
  "AllowedPattern": "^((?![0-9]{1,15}$)[a-zA-Z0-9-]{1,15}$)?$",
  "ConstraintDescription": "The EC2 instance hostname must be 15 characters or less and must not...",
  "Description": "A custom name for the EC2 instance…."
},

在“指定堆栈详细信息”页面上输入主机名时,是否可以使用“ AllowedPattern”正则表达式验证触发器?现在,只有在两页之前选择“创建堆栈”,验证才会进行。

1 个答案:

答案 0 :(得分:2)

遗憾的是,没有没有这种方式。另一种方法是让您的用户通过AWS Service Catalog启动模板,这使您可以更好地控制用户放入模板中的参数。