title: AWS Cloud formation - create EC2 instance with security group name
body: <p>I am trying to create a cloud formation template to create EC2 instance. I would like to use Security Group Name instead of  Security Group Id. When I use that I am getting error "Encountered unsupported property SecurityGroup". How can I use Security Group Name while creating EC2 Instance through Cloud Formation</p>
  
  <pre><code>"Resources": 
  {
      "EC2Instance":
      {
          "Type" : "AWS::EC2::Instance",
          "Properties":
          {
              "InstanceType": 
              {
                  "Ref": "InstanceType"
              },
              "SecurityGroup":
              [
                  {
                      "Ref" : "InstanceSecurityGroup"
                  }
              ],
              "KeyName":
              {
                  "Ref" : "AWS::Region"
              },
              "ImageId":
              {
                  "Ref": "AMI"
              }
          }
      },
      "InstanceSecurityGroup":
      {
          "Type":"AWS::EC2::SecurityGroup",
          "Properties": 
          {
              "GroupDescription": "Enable SSH access via port 22",
              "GroupName": 
              {
                  "Fn::FindInMap":
                  [
                      "EnvironmentConfig",
                      {
                          "Ref": "Environment"
                      },
                      "SGGroupName"
                  ]
              },
              "SecurityGroupIngress":
              [
                  {
                      "IpProtocol": "tcp",
                      "FromPort": 22,
                      "ToPort": 22,
                      "CidrIp":"10.252.0.0/16"
                  },
                  {
                      "IpProtocol": "tcp",
                      "FromPort": 22,
                      "ToPort": 22,
                      "CidrIp":"10.251.0.0/16"
                  }           
              ],
              "VpcId": 
              {
                  "Fn::FindInMap":
                  [
                      "EnvironmentConfig",
                      {
                          "Ref":"Environment"
                      },
                      "VPC"
                  ]
              }
          }
      }
  </code></pre>