Using moto how can you create an EC2 instance since theres no AMIs available to launch an instance with. This repo seems to be "pre-loading" AMIs that are later used within tests but im not sure how these are being created https://github.com/spulec/moto/blob/master/tests/test_ec2/test_instances.py#L25 https://github.com/spulec/moto/blob/master/moto/ec2/resources/amis.json
I've tried calling .describe_images(Owners=["amazon"])
however, all the AMIs returned when used in the run_instances call give the below error.
from moto import mock_ec2
@mock_ec2
def Test_create_ec2():
boto3.client('ec2').run_instances(ImageId="ami-1234abcd", MinCount=1, MaxCount=1)
botocore.exceptions.ClientError: An error occurred (InvalidAMIID.NotFound) when calling the RunInstances operation: The image id '[ami-1234abcd]' does not exist
This issue also relates to the unresolved question How to create ami with specific image-id using moto?