title: CloudFormation: Unresolved resource dependencies [Ec2Instance] in the Outputs block of the template
body: <p>I am trying to create a EC2 instance using cloudFormation template.
  I have written below JSON for this and trying to upload json using  option in CloudFormation "Upload a template to Amazon S3".
  But after uploading JSON I am getting error:</p>
  
  <blockquote>
    <p>Template validation error: Unresolved resource dependencies [Ec2Instance] in the Outputs block of the template.</p>
  </blockquote>
  
  <p>Please advice what I am going wrong here?</p>
  
  <pre><code>{
      "Description": "Create an EC2 instance running the latest amazon Linux AMI.",
      "Parameters": {
          "KeyPair": {
              "Description": "The EC2 key Pair to allow SSH access to the instance",
              "Type": "String"
          }
      },
      "Resources": {
          "EC2Instance": {
              "Properties": {
                  "ImageId": "ami-9d23aeea",
                  "InstanceType": "t2.micro",
                  "KeyName": {
                      "Ref": "KeyPair"
                  }
              },
              "Type": "AWS::EC2::Instance"
          }
      },
      "Outputs": {
          "InstanceId": {
              "Description": "The InstanceId of newly created EC2 instance",
              "Value": {
                  "Ref": "Ec2Instance"
              }
          }
      },
      "AWSTemplateFormatVersion": "2010-09-09"
  }
  </code></pre>