Name an EC2 Instance in the CloudFormation template?

I have a template that works and generates a stack but I cannot find a property to set or something else that allows me to give a Name to the EC2 Instance I have created. When it is generated the Name is blank.


You need to add a tag with key Name to the cloud formation template. Like this...

"ec2-instance" : {
    "Type" : "AWS::EC2::Instance",
    "Properties" : {
        "ImageId" : "ami-0102022,
        "SecurityGroupIds" : [{ "Ref" : "SecurityGroup" }],
        "SubnetId" : { "Ref" : "Subnet" },
        "InstanceType" : "m1.medium",
        "Tags" : [
            {"Key" : "Name", "Value" : "Instance name"},
            {"Key" : "Environment", "Value" : { "Ref" : "Environment" }},
            {"Key" : "Owner", "Value" : { "Ref" : "Owner" }}
        ]
    }
}