通过 Cloudformation 创建 inboud/outbound 规则
Create the inboud/outbound rules by Cloudformation
在我的安全组中,我有这些规则:
这是我在我的 cloudformation 模板中创建的:
{
"SecurityGroupIngress": [
{
"IpProtocol": "NFS",
"FromPort": "tcp",
"ToPort": "2049",
"CidrIp": "0.0.0.0/0"
}
],
"SecurityGroupEgress": [
{
"IpProtocol": "All traffic",
"FromPort": "All",
"ToPort": "All",
"CidrIp": "0.0.0.0/0"
}
]
}
但是在创建堆栈的过程中我得到了错误:Encountered non numeric value for property FromPort
我需要知道什么值对应于 All Trafic 和来自端口 tcp
知道如何使用正确的值正确创建规则吗?
错误的意思就是它所说的 - 'tcp' 不是一个端口,它是一个协议。您需要提供一个数字,例如 25 (SMTP) 或 22 (SSH)。文档指定参数需要一个整数:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-fromport
'All' 也不会削减它,而且没有任何意义。即使您允许所有 CIDR 块 (0.0.0.0/0)
,您也需要绑定到端口
在我的安全组中,我有这些规则:
这是我在我的 cloudformation 模板中创建的:
{
"SecurityGroupIngress": [
{
"IpProtocol": "NFS",
"FromPort": "tcp",
"ToPort": "2049",
"CidrIp": "0.0.0.0/0"
}
],
"SecurityGroupEgress": [
{
"IpProtocol": "All traffic",
"FromPort": "All",
"ToPort": "All",
"CidrIp": "0.0.0.0/0"
}
]
}
但是在创建堆栈的过程中我得到了错误:Encountered non numeric value for property FromPort
我需要知道什么值对应于 All Trafic 和来自端口 tcp
知道如何使用正确的值正确创建规则吗?
错误的意思就是它所说的 - 'tcp' 不是一个端口,它是一个协议。您需要提供一个数字,例如 25 (SMTP) 或 22 (SSH)。文档指定参数需要一个整数:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-fromport
'All' 也不会削减它,而且没有任何意义。即使您允许所有 CIDR 块 (0.0.0.0/0)
,您也需要绑定到端口