0
votes

I have defined my parameters like this:

{
    "PrivateSubnets":{
       "Description":"db subnetlist",
       "Type": "List<AWS::EC2::Subnet::Id>"
    },

    "VPCLIST": {
       "Description": "VPC list",
       "Type": "List<AWS::EC2::VPC::Id>"
    }
}

and referring the above parameters in "resources" section like below:

    "InstanceSecurityGroup" : {
      "Type" : "AWS::EC2::SecurityGroup",
      "Properties" : {
        "VpcId" : {"Ref": "VPCLIST"} ,
        "GroupDescription" : "Enable 3306/80/SSH access via port 22"
}

and while executing this I am getting the below error.

AWS::EC2::SecurityGroup InstanceSecurityGroup "Value of property VpcId must be of type String"

Note: I have only default VPC available which is not taken as string? any solutions to this issue...

2
Below is the error message : Error Unable to list data: Internal Failurebell.com

2 Answers

0
votes

The Security Groups requires the VpcId to be a string, the property is an array list, So you need to change the property to Type: String, or use the Fn::Select function.

{ "Fn::Select" : [ 0, VPCLIST ] }

List – An array of VPC IDs

{
  "Type" : "AWS::EC2::SecurityGroup",
  "Properties" : {
     "GroupName" : String,
     "GroupDescription" : String,
     "SecurityGroupEgress" : [ Security Group Rule, ... ],
     "SecurityGroupIngress" : [ Security Group Rule, ... ],
     "Tags" :  [ Resource Tag, ... ],
     "VpcId" : String
  }
}

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html

0
votes

The correct way is make this change:

{
  "PrivateSubnets": {
    "Description":"db subnetlist",
    "Type": "AWS::EC2::Subnet::Id"
  },
  "VPCLIST": {
    "Description": "VPC list",
    "Type": "AWS::EC2::VPC::Id"
  }
}