云形成模板 - 创建错误

时间:2016-06-24 21:13:44

标签: amazon-web-services amazon-cloudformation

我在创建堆栈时遇到错误:

参数groupName不能与参数subnet

一起使用
 {
        "Description": "AWS CloudFormation to Airflow production enviroment",
        "Resources": {
            "InstanceSecurityGroup": {
                "Properties": {
                    "GroupDescription": "Enable SSH and HTTP access on the inbound port",
                    "SecurityGroupIngress": [
                        {
                            "CidrIp": "0.0.0.0/0",
                            "FromPort": "22",
                            "IpProtocol": "tcp",
                            "ToPort": "22"
                        },
                        {
                            "CidrIp": "0.0.0.0/0",
                            "FromPort": "8080",
                            "IpProtocol": "tcp",
                            "ToPort": "8080"
                        }
                    ],
                    "VpcId": "vpc-f283cb97"
                },
                "Type": "AWS::EC2::SecurityGroup"
            },
            "airflow": {
                "Properties": {
                    "ImageId": "ami-f303fb93",
                    "InstanceType": "t2.micro",
                    "SecurityGroups": [
                        {
                            "Ref": "InstanceSecurityGroup"
                        }
                    ],
                    "SubnetId": "subnet-0820796d",
                    "Tags": [
                        {
                            "Key": "Name",
                            "Value": "ec2-airflow-production"
                        }
                    ]
                },
                "Type": "AWS::EC2::Instance"
            }
        }
    }

1 个答案:

答案 0 :(得分:1)

您需要此处的安全组ID,而不是安全组的名称。改变" InstanceSecurityGroup"安全组ID可以使用。

"Ref": "InstanceSecurityGroup"
相关问题