I have a file tree in a directory. This is used to build bootable systems on hard drives and flash drives. I've also used it to build images for virtual machines. I would like to make an AWS AMI from it (plus whatever tweaks are needed to make it cloud worthy, like the cloud-init stuff). For now I am exploring how to make an EBS backed AMI. All the documentation and answered questions I have found focus on other ways to build AMIs, and involve using existing AMIs, or starting instances and saving what's in a running state. But I want to make something from scratch based on my system setup.
I envisioned a couple ways to do this based on what I can figure out from AWS documentation (nothing literally addresses by needs). In both cases I create a new volume and attach it to an instance running an arbitrary Linux AMI. In method A, in that instance I format the volume with ext4, mount it as /mnt/xvdf, then run rsync to upload my system file tree into the volume itself, and then unmount it. In method B, I create a loopback file on my home machine, format it, mount it, populate it from the system tree, unmount it, and and transmit the image file to the instance with the volume attached, and just copy the image to the volume device such much like dd. In both cases I would end up with a filesystem on the volume likes like I have on hard drives, flash drives, and VM image files (raw).
Then I make a snapshot of that volume and register it as an AMI. But it does not work. The error obtained from the instance log is that the kernel panicked because the filesystem type could not be mounted (has an unsupported feature).
Am i basically doing the right process and just goofed up a step (like formatting a filesystem type it doesn't like ... I am using ext4)?
Or am I doing it wrong? It did get far enough that it let me register the AMI, and launch an instance from it.
I'm sure I need to make many tweaks to the file tree to get it to work right in the cloud environment. I will be learning what those are. But right now it has not gotten far enough to even consider whether my files are right or wrong.
Please don't suggest for me to try making an S3-backed AMI or make one from a running instance. I do plan to try those methods as part of learning everything, but those are later. This is now and the goal is to make an AMI from an unbooted scratch image/tree (which works in other places).