Repository: getmoto/moto

Issue:
Run Instances throwing error from Golang AWS sdk
Hello,

I am not able to run instances using the Golang sdk : github.com/aws/aws-sdk-go with the Stand-alone Server Mode.
This is the piece of code I am using to run instances:
```
package main
import (
	"fmt"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/credentials"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/ec2"
)
func main() {
	sess, err := session.NewSession(&aws.Config{
		Region:      aws.String("us-east-1"),
		Credentials: credentials.NewStaticCredentials("a", "IBTVO4hqOK+v", ""),
		Endpoint:    aws.String("http://localhost:5000"),
	})
	if err != nil {
		fmt.Println("Error while creating session", err)
		return
	}
	ec2Client := ec2.New(sess)
	runResult, err := ec2Client.RunInstances(&ec2.RunInstancesInput{
		ImageId:      aws.String("ami-03cf127a"),
		InstanceType: aws.String("t2.micro"),
		MinCount:     aws.Int64(1),
		MaxCount:     aws.Int64(1),
	})
	if err != nil {
		fmt.Println("Error in run instances:", err)
		return
	}
	fmt.Println(runResult.Instances)
}
```
I get this error when I run the above code:
```
SerializationError: failed decoding EC2 Query response
	status code: 200, request id:
caused by: strconv.ParseBool: parsing "None": invalid syntax
```
Go sdk unmarshall function present in github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go is failing to parse the response from mock server.
```
// Unmarshal unmarshals a response body for the EC2 protocol.
func Unmarshal(r *request.Request) {
	defer r.HTTPResponse.Body.Close()
	if r.DataFilled() {
		decoder := xml.NewDecoder(r.HTTPResponse.Body)
		err := xmlutil.UnmarshalXML(r.Data, decoder, "")
		if err != nil {
			r.Error = awserr.NewRequestFailure(
				awserr.New(request.ErrCodeSerialization,
					"failed decoding EC2 Query response", err),
				r.HTTPResponse.StatusCode,
				r.RequestID,
			)
			return
		}
	}
}
```
I tried to print the r.Data sent the function causing the error. I get the following output:
```
Data is {
}
Data is {
  Groups: [{
      GroupId: "sg-245f6a01",
      GroupName: "default"
    }],
  Instances: [{
      AmiLaunchIndex: 0,
      Architecture: "x86_64",
      ClientToken: ""
    }]
}
Data is {
  Groups: [{
      GroupId: "sg-245f6a01",
      GroupName: "default"
    }],
  Instances: [{
      AmiLaunchIndex: 0,
      Architecture: "x86_64",
      ClientToken: ""
    }]
}
Data is {
  Groups: [{
      GroupId: "sg-245f6a01",
      GroupName: "default"
    }],
  Instances: [{
      AmiLaunchIndex: 0,
      Architecture: "x86_64",
      ClientToken: ""
    }]
}
Error in run instances: SerializationError: failed decoding EC2 Query response
	status code: 200, request id:
caused by: strconv.ParseBool: parsing "None": invalid syntax
```
Data printed does not have the required fields.
I am using the latest moto version 1.3.14.

Thank You


Discussion:

Resolving patch:
diff --git a/moto/ec2/responses/instances.py b/moto/ec2/responses/instances.py
--- a/moto/ec2/responses/instances.py
+++ b/moto/ec2/responses/instances.py
@@ -52,7 +52,7 @@ def run_instances(self):
         private_ip = self._get_param("PrivateIpAddress")
         associate_public_ip = self._get_param("AssociatePublicIpAddress")
         key_name = self._get_param("KeyName")
-        ebs_optimized = self._get_param("EbsOptimized")
+        ebs_optimized = self._get_param("EbsOptimized") or False
         instance_initiated_shutdown_behavior = self._get_param(
             "InstanceInitiatedShutdownBehavior"
         )


Test patch:
diff --git a/tests/test_ec2/test_instances.py b/tests/test_ec2/test_instances.py
--- a/tests/test_ec2/test_instances.py
+++ b/tests/test_ec2/test_instances.py
@@ -1319,6 +1319,12 @@ def test_create_instance_ebs_optimized():
     instance.load()
     instance.ebs_optimized.should.be(False)
 
+    instance = ec2_resource.create_instances(
+        ImageId="ami-12345678", MaxCount=1, MinCount=1,
+    )[0]
+    instance.load()
+    instance.ebs_optimized.should.be(False)
+
 
 @mock_ec2
 def test_run_multiple_instances_in_same_command():