【发布时间】:2021-02-26 13:32:58
【问题描述】:
我正在尝试创建一个满足以下条件的安全组:
一个名为 WordpressDbSecurityGroup 的安全组,它允许从 WebServerSecurityGroup 对标准 MySQL 端口进行传入访问
下面是如何使用 WordPressDbSecurityGroup 和 WebServerSecurityGroup。当我去构建堆栈时,我收到以下错误:
“遇到不受支持的属性 FromPort”
有人能解释一下原因吗?我在the documentation 中找不到任何关于如何为 dbsecurity 组指定从端口访问的内容。
"WebServerSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "wordpressVpc"
},
"GroupDescription": "Allow access from HTTP and SSH traffic",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "80",
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "3306",
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"CidrIp": {
"Ref": "YourIp"
}
}
]
}
},
"wordpressDBSecurityGroup": {
"Type": "AWS::RDS::DBSecurityGroup",
"Properties": {
"EC2VpcId": {
"Ref": "wordpressVpc"
},
"GroupDescription": "Enable access to the db via port 3306.",
"Tags": [
{
"Key": "Name",
"Value": "wordpressDBSecurityGroup"
}
],
"DBSecurityGroupIngress": [
{
"IpProtocol": "TCP",
"FromPort": "3306",
"ToPort": "3306",
"SourceSecurityGroupID" : {"Ref" : "WebServerSecurityGroup"}
}
]
},
"DependsOn": [
"WebServerSecurityGroup"
]
},
【问题讨论】:
标签: json amazon-web-services ansible amazon-cloudformation