p.magalhaes
p.magalhaes

Reputation: 8354

Cloud formation Template - Creation error

I am getting an error creating stack:

The parameter groupName cannot be used with the parameter 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"
            }
        }
    }

Upvotes: 0

Views: 260

Answers (1)

Piyush Patil
Piyush Patil

Reputation: 14523

You need Security group ID here and not the name of the security group. Change "InstanceSecurityGroup" to security group ID it will work.

"Ref": "InstanceSecurityGroup"

Upvotes: 1

Related Questions