Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services Cloudformation AWS:使用参数为CustomerGateway分配ip地址_Amazon Web Services_Amazon Ec2_Amazon Cloudformation_Ip Address_Ipsec - Fatal编程技术网

Amazon web services Cloudformation AWS:使用参数为CustomerGateway分配ip地址

Amazon web services Cloudformation AWS:使用参数为CustomerGateway分配ip地址,amazon-web-services,amazon-ec2,amazon-cloudformation,ip-address,ipsec,Amazon Web Services,Amazon Ec2,Amazon Cloudformation,Ip Address,Ipsec,我正在设计一个cloudformation模板,但我需要将源IP定义为一个参数 我试图将参数定义为字符串,但它产生以下错误: Value (${MyCustomerGateway}) for parameter ipAddress is invalid. Invalid Format. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue; Request ID: 4de02112-fb1f-47a1-9

我正在设计一个cloudformation模板,但我需要将源IP定义为一个参数

我试图将参数定义为字符串,但它产生以下错误:

Value (${MyCustomerGateway}) for parameter ipAddress is invalid. Invalid Format. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue; Request ID: 4de02112-fb1f-47a1-931c-97727568df99)
这是模板的片段:

Parameters:
  MyCustomerGateway:
    Description: IpAddress.
    Default: 0.0.0.0
    Type: String  

Resources:
  CustomerGateway_1:
    Type: 'AWS::EC2::CustomerGateway'
    Properties:
      Type: ipsec.1
      BgpAsn: 3352
      IpAddress: ${MyCustomerGateway} 
      Tags:
        - Key: Name
          Value: CustomerGateway_1
IP翻译是否有特殊数据


我不确定哪种方法正确

IpAddress:${MyCustomerGateway}
更改为
IpAddress:!参考myCustomerGateway

更多关于:

内在函数Ref返回指定值的值 参数或资源

>指定参数的逻辑名称时,它将返回 参数。

指定资源的逻辑名称时,它将返回一个 您通常可以使用来引用该资源,例如物理资源 身份证

奖金:

如果要验证参数输入,可以使用属性

用法:

PrimaryIPAddress:
    Type: String
    Description: This must be a valid IP address.
    AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})
    ConstraintDescription: must be a valid IP address of the form x.x.x.x.
输入无效IP时出错: